Blue Ocean

Tuesday, July 22, 2014

In-Order Flatten A Binary Tree to Linked List

›
In-order flatten binary tree, the idea here is similar to in-order traverse of the tree, keep a pointer to previous node visited, then link ...

Pre-Order Flatten A Binary Tree to Linked List

›
To do it iteratively is little bit tricky, since when we do down to the left of tree, we need to remember the way to go back to right. The...
Friday, May 9, 2014

Construct Tree from given Inorder and Preorder traversals

›
Problem: Give two strings representing the inorder and preorder traversals of binary tree, construct the tree. The key here is that preor...

Find the maximum sum from leaf to root in a binary tree

›
Given a Binary Tree, find the maximum sum from a leaf to root and return this leaf as well. The key is from root to leave, add up the nod...

divide number and return result in a string

›
This is a google interview question:  Divide number and return result in form of a string. e.g 100/3 result should be 33.(3) Here 3 is in ...
3 comments:
Wednesday, April 30, 2014

Permutations for digits represented by Phone Number

›
This is a stackoverflow question: http://stackoverflow.com/questions/1851239/permutations-for-digits-represented-by-phone-number This can ...

Print all valid combinations of n-pairs of parentheses

›
For example, if n=1 {} for n=2 {}{} {{}} Most of the solutions found online are using recursion. Here is the version which does iterat...
‹
›
Home
View web version
Powered by Blogger.