Professional Documents
Culture Documents
5. How to find all pairs on integer array whose sum is equal to given number?
For example, if an array with length 5 contains numbers {0, 3, 4, 2, 3}, and given
number is 6, then your answer should be (4,2) and (3,3).
10. There is an array with every element repeated twice except one. Find that
element?
For example if given array is {1, 1, 2, 2, 3, 4, 4, 5, 5} then your program should return 3.
11. How to find kth smallest element in unsorted array?
For example if given array is {1, 2, 3, 9, 4} and k=2 then you need to find the 2nd
smallest number in the array, which is 2
Examples:
Examples:
17. How to find the smallest positive integer value that cannot be represented as
sum of any subset of a given array?
Examples:
Input: {1, 3, 6, 10, 11, 15};
Output: 2
Example:
19. How to find if there is a sub array with sum equal to zero?
Examples:
For example,
Given input array A = [1,1,2],
24. How to find sub array with largest product in array of both positive and
negative number?
In this problem, your task is to write a program in Java or C++ to find the contiguous
sub-array within an array (containing at least one number) which has the largest
product.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4.
29. Consider the two String array and find the duplicates between the two.?
For example,
Given [“Orchard”,”Kalinga”,”Orchard”,”Mindtree”],
Given [“Kalinga”,”Hello”,”World”]
Output is Kalinga
29. Consider one lowercase String array convert all the character present at the
index(multiple of 2) to UpperCase.
For example,
Given [“welcome” ,”to”, “possible”],
Answer [“weLc0mE”, “to” ,”poSsIbLe”].