Monthly Archive: February 2017

0

Format the given number into an American currency format

Convert a given number into the formatted number. Logic Traverse the string in the reverse order Consider the following cases : Positive numbers, Negative numbers, Positive floating point numbers, Negative floating point numbers   Solution

0

Connect nodes at the same level in a binary tree

PSEUDO ALGORITHM (Breadth first search approach) We will use the same algorithm discussed in level-order-breadth-first-search-or-zig-zag-traversal-of-a-binary-tree with slight modification. Create an empty queue q Initialize roots height = 0; Enqueue q with the root node Loop...