|
-11
Most of the easy problems from tags like "constructive algorithms", "implementation", "brute force" etc. could be what you're looking for. Are you sure you checked this? |
|
0
Please also include Interviewbit under interview questions / online sites to practice. |
|
0
No, you store the results of first round in a Map, then for every result in second round, you search it in the map, O(n^2 * logn). Assuming, you didn't store the results in a map, but just in a array, to search for every a[p] ^ a[q] in second round, it would take O (n^3). |
|
+4
For B, The solution is simple. You anyhow have to check by XORring four elements at a time, i.e. a[i] ^ a[j] ^ a[p] ^ a[q]. But, instead of brute force'ing at one single time, you can divide the brute force into two. i.e. first compute a[i] ^ a[j], i.e. run brute force once in ( O(n^2) ) save the results, again brute force ( in O(n^2) again ) for a[p] ^ a[q] now either you can brute force again through previous results or just simply look for k ^ ( a[p] ^ a[q] ) in the previous results if you've stored them in a Map. |
|
-9
Why are people downvoting ? If you're here reading this post, then it is because you too were looking for an easy implementation of Suffix Tree, ryt? So, this is not fair. |
|
-16
Could you please also write a small function to search if a string exists as a substring in the original string ? |
|
0
Only for Asia Pacific. |