Find all permutations of a string in C++ (Using Backtracking and STL)
This post will find all permutations of a string containing all distinct characters in C++. For example, the string ABC has 6 permutations, i.e., ABC, ACB, BAC, BCA, CBA, CAB.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedThis post will find all permutations of a string containing all distinct characters in C++. For example, the string ABC has 6 permutations, i.e., ABC, ACB, BAC, BCA, CBA, CAB.
Given n lists of characters and a number whose digits lie between 1 and n, print all possible combinations by replacing its digits with the characters of the corresponding list.
Given a sequence of numbers between 2 and 9, print all possible combinations of words formed from the mobile keypad with some digits associated with each key.
Find all interleavings of given strings that can be formed from all the characters of the first and second string where the order of characters is preserved.
Given a binary pattern containing ? wildcard character at a few positions, find all possible combinations of binary strings that can be formed by replacing the wildcard character by either 0 or 1.
Given a string, check if a repeated subsequence is present in it or not. The repeated subsequence should have a length of 2 or more.
Given a string, check if it is a rotated palindrome or not. For example, CBAABCD is a rotated palindrome as it is a rotation of palindrome ABCDCBA.
In previous post, we have introduced the heap data structure and covered heapify-up, push, heapify-down and pop operations. This article covers Java implementation of Priority Queue Data Structure (Max Heap and Min heap).
Given two integers, x and n, where n is non-negative, efficiently compute the power function pow(x, n) using Divide & Conquer.
Given an integer array, find the maximum sum among all subarrays possible using divide and conquer algorithm.
Given an array, find the peak element in it. A peak element is an element that is greater than its neighbors. There might be multiple peak elements in an array, and the solution should report any peak element.
Given a sorted binary array, efficiently find the total number of 1’s in it.