Professional Documents
Culture Documents
Programs Statements by Saurabh
Programs Statements by Saurabh
1. Check if given 2 strings contains same characters and same length but in different order. Print
‘true’ if criteria satisfied else print ‘false’
(Difficult Level: Easy)
E.g.
Input: army, mary
Output: true
2. You can create measuring weight of any size. Given size ‘n’ kg, you should able to measure
anything from 1 to n (only integer) kilograms using given weights. Find minimum number of
weights required for given ‘n’ kg.
3. Two distinct elements will be given in the input and an array. You need to find the minimum
distance between the 2 elements. Minimum Distance is defined as if P != Q then |(A[P] – A[Q])|
(Difficult Level: Medium)
Example: [1,7,2,11,3,4,7,9,11,14,7,21,2,6,2,8,4,11,4]
If the given elements are 7 and 11, the minimum distance will be 2.
Set 2: : Solve any Two of the following.
1. Implement java solution to find single missing number from 1 to n from array size of (n-1). Note
that numbers can be given in any order and only one number will be missing. Solution should be
O(n).
(Difficult Level: Easy)
2. Generate string by using all given characters without having repetitive character in sequence
(Any 1 output required if multiple outputs are possible). (Duplicate characters are allowed;
however, it cannot be adjacent to each other). If string generation isn’t possible, then print
‘INVALID INPUT’
(Difficult Level: Medium)
E.g.
1) a,a,b,c : a,b,c,a
Example
Input: “GOD”