## Riyad Parvez

BAN USERI like the bitfield approach, but what about converting the number to hexadecimal so that no bit patterns will be wasted. In decimal representation you have to waste 6 bit patterns per 4 bits.

- Riyad Parvez July 29, 2013If range is densely populated, then hash table will be the best option. You can check from a starting element to last element, whether it exists in hash table. But it begins to underperform when you have lot less elements than your range or you need huge has table to avoid collision. Otherwise you can use BST. And red black tree is the best choice here.

- Riyad Parvez July 29, 2013Everyone think about BFS or DFS. But I'm thinking A* search. As you have the whole dictionary you can preprocess the dictionary to have heuristics which assigns a value how many steps will need to transform string A into string B.

- Riyad Parvez July 28, 2013Use AVL tree for stream of integers. The root will be pretty good estimate of median

- Riyad Parvez July 27, 2013Just use Java HashCode algorithm for string.

- Riyad Parvez July 26, 2013Starvation, invalid program state, corrupted data.

- Riyad Parvez February 27, 2013I this is a viable answer. As there are millions of parking space. On the other hand you can check free space by bit operation as they are extremely fast.

- Riyad Parvez January 09, 2013Interval tree.

- Riyad Parvez January 09, 2013Use rooted tree and solve it in O(n+m).

- Riyad Parvez January 03, 2013Great solution. Can you elaborate? How did you match this problem to flood fill algorithm?

- Riyad Parvez January 03, 2013Better on which criteria. First option is more readable and maintainable. And some performance gain by 3rd option (assumed) will it matter for modern compilers and modern CPU. I think 1st option is better, 2nd and 3rd option are less readable and just premature optimization

- Riyad Parvez December 30, 2012If your stack is linked list, just reverse the list. Pop and reverse again. You can reverse list using O(1) space

- Riyad Parvez December 30, 2012Easy. Try fibonacci f(n) = f(n-1)+f(n-2)+f(n-3)

- Riyad Parvez December 28, 2012try 4321, fails miserably

- Riyad Parvez December 28, 2012Your solution is wonderful. Restriction was we can't use extra space.

- Riyad Parvez December 28, 2012Use flood fill algorithm, just don't stop there, also go to more k levels

- Riyad Parvez December 28, 2012For unsliced matrix you have (p+q)Cp or (p+q)Cq ways. But as there are some paths cut off due to slicing of a*b sub matrix, it will be (p+q)Cp - sum((m+n-x)C(m-x)) when x>0 + 1

- Riyad Parvez December 28, 2012If this is a serious interview question, then I'll think twice before joining this company. This sort of questions really have no values

- Riyad Parvez December 25, 2012It has O(nlgn) in worst case, if your array is already sorted and heapify process takes O(lgn) time for n elements

- Riyad Parvez December 25, 2012**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

Use rolling hash technique. First compute the hash of the small technique such that it same anagram would give same hash in a hashing algorithm. Such hashing may be simply multiplying the integer representation of each character. Then use rolling hash to find the substring.

- Riyad Parvez July 29, 2013