Core Java Assignment 9 – Complex
1) Given the daily stock prices of a share during last 30 days, write a program to find out best buying and selling dates for maximum gain.
for ex: index 0 1 2 3 4 5 6
int[] array= {10,05,04,12,32,04,35};
in this case, buying at index 5 and selling at index 6, would give you the max price gain of 31(35-04)
2) In an Array – Find an element which appeared most.
for Ex: int array[] = {6,4,5,7,3,6,4,7,6,2,9,6}
in this 6 is the most appeared number and appeared 4 times.
3)Find Duplicate Characters in a String
for ex:
If you enter 'Repeated' output should be
e – 3 times
If you enter 'Ramsamkamdamyumnum'
a -4 times
m – 6
u – 2
4) Write a program to simulate a deadlock situation?
5) Print first non-repeated character in String?
6) Write a program to find a number of vowels and consonents in a String?
7) Find duplicates in an array if there is more than one duplicate?