## Determine if a binary tree is a binary search tree

Binary tree and Binary search tree are defined as follows : Binary tree is a tree data structure in which each node has at most two child nodes. A binary search tree (BST) is...

Binary tree and Binary search tree are defined as follows : Binary tree is a tree data structure in which each node has at most two child nodes. A binary search tree (BST) is...

Problem description : Convert a given binary tree to a linked list of all the nodes at each depth (if you have a binary tree with depth D, you’ll have D linked lists). Logic...

Problem : Given a string and an array of words, find out if the input string can be broken into a space-separated sequence of one or more words. For example, inputDict = [“I” ,...

Problem : Create a pascal’s triangle using javascript. More details about Pascal’s triangle pattern can be found here. Input: #Rows = 6 Output: Logic : Pascal’s triangle can be simulated using 2-D array While...

A permutation is a rearrangement of the elements in a list. A string/array of length n has n! permutation. Input: An array // [‘A’, ‘B’, ‘C’] Output: [‘A’, ‘B’, ‘C’] [‘A’, ‘C’, ‘B’], [‘B’,...

You are given an array of strings. Each of these strings is made up of bracket characters only : ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘, ‘]’. Programming languages utilize these brackets in balanced pairs, so...

Input: An array of n integers and given a number X. Expected output: All the unique pairs of elements (a, b), whose summation is equal to X. Example <pre>Given<span class=”pl-k”>var</span> unSortedArr <span class=”pl-k”>=</span> [<span...

Problem : Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and...

Problem : Given two (dictionary) words as Strings, determine if they are isomorphic. Two words are called isomorphic if the letters in one word can be remapped to get the second word. Remapping a...

Problem : Number list compressing. Given an sorted array. Input: sorted number list [ 1, 2, 3,10, 25, 26, 30, 31, 32, 33] Output: find consecutive segments print: 1-3, 10, 25-26, 30-33 Logic :...