Monthly Archives: December 2012

Reversing directions

Chef recently printed directions from his home to a hot new restaurant across the town, but forgot to print the directions to get back home. Help Chef to transform the directions to get home from the restaurant. A set of … Continue reading

Posted in Information Technology | Leave a comment

New number system

In China, number “4” is not good because it is has the same pronunciation as “death” in Chinese. So there is a new number system which we may make 4 disappear in the current decimal system like: 1,2,3,5,6,7…….13,15…….23,25…….33,35….39,50…….. Here 5 … Continue reading

Posted in Information Technology | Leave a comment

Adding two numbers given in the form of digitized array

Given two array, where each item in the array is a digit of a number i.e. {1,0,1} is number 101 and {1,3,5} = 135, create a sum function that takes two arrays and outputs the sum of the array. A1 … Continue reading

Posted in Information Technology | Leave a comment

Find the maximum sum of leaf to root path in a binary tree

Given a binary tree, find the maximum sum path from a leaf to root. For example, in the following tree, there are three leaf to root paths 8->-2->10, -4->-2->10 and 7->10. The sums of these three paths are 16, 8 … Continue reading

Posted in Information Technology | Leave a comment

Lowest Common Ancestor of two nodes in a binary tree

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace ConsoleApplication1 { public class Node { private Node left; private Node right; private int value; public Node(Node left, Node right, int value) { this.left = left; this.right = right; … Continue reading

Posted in Information Technology | Leave a comment