Find the length of the longest balanced parenthesis in a string
Given a string consisting of opening and closing parenthesis, find the length of the longest balanced parenthesis in it.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a string consisting of opening and closing parenthesis, find the length of the longest balanced parenthesis in it.
There are two players, A & B, in the Pots of the gold game, and pots of gold arranged in a line, each containing some gold coins. The players can see how many coins are there in each gold pot, and each player gets alternating turns in which the player can pick a pot from one of the ends of the line.
Given a sorted doubly linked list, in-place convert it into a height-balanced Binary Search Tree (BST). The difference between the height of the left and right subtree for every node of a height-balanced BST is never greater than 1.
Given a map containing employee to manager mappings, find all employees under each manager who directly or indirectly reports him.
Design a stack to support an additional operation that returns the minimum element from the stack in constant time. The stack should continue supporting all other operations like push, pop, top, size, empty, etc., without degradation in these operations’ performance.
In this post, we will see how to find all lexicographic permutations of a string where the repetition of characters is allowed.
Find all n–digit binary numbers with an equal sum of left and right half, where n varies from 1 to 9 and the binary number should not start with 0.
In the previous post, we have discussed how to merge two sorted linked lists into one list. This post will merge k sorted linked lists into a single list efficiently.
Given a set S, generate all distinct subsets of it, i.e., find a distinct power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.
Given a string, find minimum cuts needed to partition it such that each partition is a palindrome.
In the k–partition problem, we need to partition an array of positive integers into k disjoint subsets that all have an equal sum, and they completely cover the set.
In this post, we will see how to list out all permutations of a string in Python.