Find all permutations of a string in Python
In this post, we will see how to list out all permutations of a string in Python.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedIn this post, we will see how to list out all permutations of a string in Python.
Given a binary tree, write a recursive algorithm to print all paths from leaf to root node.
Given a positive integer n, find all n–digit binary numbers having more 1’s than 0’s for any prefix of the number.
Given a linear equation of k variables, count the total number of possible solutions to it. The problem is similar to finding the total number of ways to get the denomination of coins. Here, coefficients of an equation can be considered coins denominations, and the RHS of an equation can be considered the desired change.
Given a binary tree, write an efficient algorithm to invert it.
Given an array representing a min-heap, convert it into a max-heap. The conversion should be done in-place and in linear time.
Given a BST and a positive number k, find the k’th smallest node in it.
Given an array, reverse every group of consecutive m elements in a given subarray of it.
Given an integer array, find all distinct combinations of a given length k. The program should print only distinct combinations.
Given an integer array, find a subset in it having the maximum product of its elements.
Given a sorted array containing duplicates, efficiently find each element’s frequency without traversing the whole array.
Quickselect is a selection algorithm to find the k’th smallest element in an unordered list. It is closely related to the Quicksort sorting algorithm. Like Quicksort, it is efficient traditionally and offers good average-case performance, but has a poor worst-case performance.