## Detect a loop in cyclic/circular linked list

Logic : If a linked list has a cycle then no node has a null as next pointer. A simple loop exists when p1.next.next !== null as shown below. While iterating over the linked...

Skip to content
# Category: Intermediate

##
Detect a loop in cyclic/circular linked list

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

##
Given the binary tree create linked lists of the nodes at the same level

##
Word break problem dynamic programming

##
Pascals triangle javascript code

##
Generate all permutations of a given array using backtracking

##
Justify if a string consists of valid parentheses

##
Find a pair of elements from an array whose sum equals a given number

##
Determine given a pattern and string are isomorphic

##
Determine if given strings are isomorphic

Logic : If a linked list has a cycle then no node has a null as next pointer. A simple loop exists when p1.next.next !== null as shown below. While iterating over the linked...

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...