Amazon Fresher Interview Questions

Amazon Fresher Interview Questions
1. Write a Java program to find the number of words in a given string, the signature could be like :

int getWords(String s); or,
int getWords(char[] s);

2. Modify the above program to print the different words in different lines.

3. Write a program in O(n) or less order to find a unique character in an array of duplicates, e.g. the content of the array could be like ['a','c','a','b','b' ...]

4. Optimize the above algorithm when the array is sorted.

No comments:

 
Top Blogs