In the early days of the digital age, a single photograph emerged that seemed to capture a terrifying, cinematic moment of ...
In a previous post, I dealt with word ladders, the puzzle genre invented by Lewis Carroll. As you might recall, you are given two words, with steps in between, as in a ladder. For example, there are ...
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array.
- find successors and predecessors using BST (both list will be sorted); in the end, we can easily get top k from the two sorted list - with BST: **inorder traversal gives us sorted predecessors - ...