Zoho Practice Set 7
Zoho Practice Set 7
Given such an array, find the index of the element in the array in
faster than linear time. If the element doesn't exist in the array,
return null.
For example, given the array [13, 18, 25, 2, 8, 10] and the element
8, return 4 (the index of 8 in the array).
You can assume all the integers in the array are unique.
2.
For example, given the multiset {15, 5, 20, 10, 35, 15,
10}, it would return true, since we can split it up into {15, 5, 10,
15, 10} and {20, 35}, which both add up to 55.
Given the multiset {15, 5, 20, 10, 35}, it would return false,
since we can't split it up into two subsets that add up to the same
sum
and the target word 'FOAM', you should return true, since it's the
leftmost column. Similarly, given the target word 'MASS', you should
return true, since it's the last row.
5.
[[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10],
[11, 12, 13, 14, 15],
[16, 17, 18, 19, 20]]
You should print out the following:
1
2
3
4
5
10
15
20
19
18
17
16
11
6
7
8
9
14
13
12