## Check if given number is power of 4 or not

Given a number, check if it is power of four or not.

Read More Check if given number is power of 4 or notCoding made easy

Given a number, check if it is power of four or not.

Read More Check if given number is power of 4 or notGiven M sorted lists of variable length, print them in sorted order efficiently.

Read More Merge M sorted lists of variable lengthGiven a string, calculate its rank among all its lexicographically sorted permutations. For example, consider below lexicographically sorted permutations

Read More Calculate rank of given string among all its lexicographically sorted permutationsGiven a linked list containing 0’s, 1’s and 2’s, sort linked list by doing single traversal of it.

Read More Sort linked list containing 0’s, 1’s and 2’sGiven two Boolean arrays X and Y, find the length of longest continuous sequence that starts and ends at same index in both arrays and have same sum. In other words, find max(j-i+1) for every j >= i where sum of sub-array X[i, j] is equal to sum of sub-array Y[i, j].

Read More Length of longest continuous sequence with same sum in given binary arraysImplement Quicksort efficiently for inputs containing many repeated elements. Quicksort exhibits poor performance for inputs that contain many repeated elements. The problem is clearly visible when all the input elements are equal. Then at each recursion, the left partition is empty (no input values are less than the pivot), and the right partition …

Read More Quicksort using Dutch National Flag AlgorithmIn this article, we will implement Ternary Search algorithm and compare its performance with Binary Search.

Read More Ternary Search vs Binary searchGiven an integer, reverse its bits using binary operators. The idea is to initialize the result by 0 (all bits 0) and process the given number starting from its least significant bit. If the current bit is 1, then we set the corresponding most significant bit in the result and finally move on …

Read More Reverse Bits of a given IntegerGiven a mobile keypad having digits from [0-9] associated with each key, count total possible combinations of digits having length n. We can start with any digit and press only four adjacent keys of any digit. Keypad also contains * and # key which we are not allowed to press.

Read More Count total possible combinations of N-digit numbers in a mobile keypadThe longest common subsequence (LCS) problem is the problem of finding the longest subsequence that is present in given two sequences in the same order. i.e. find a longest sequence which can be obtained from the first original sequence by deleting some items, and from the second original sequence by deleting other items.

Read More Longest Common Subsequence of K-sequencesHuffman Coding is a algorithm for doing data compression and it forms the basic idea behind file compression. This post talks about fixed length and variable length encoding, uniquely decodable codes, prefix rules and construction of Huffman Tree.

Read More Huffman CodingGiven a directed graph, check if it is strongly connected or not. A directed graphs is said to be strongly connected if every vertex is reachable from every other vertex.

Read More Check if given Graph is Strongly Connected or not using one DFS TraversalFind all N-digit strictly increasing numbers where N varies from [1 to 9]. If we process the number from left to right and for every pair of adjacent digits, if every digit is greater than the preceding digit, we can say that the digits are strictly increasing.

Read More Find all N-digit strictly increasing numbers (Bottom-Up and Top-Down Approach)Given a binary tree, write an efficient algorithm to check if tree is height balanced or not. In a height balanced tree, the absolute difference between height of left subtree and right subtree for every node is 0 or 1.

Read More Check if given binary tree is height balanced or not