Remove nodes from a BST that have keys outside a valid range
Given a BST and a valid range of keys, remove nodes from BST that have keys outside the valid range.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a BST and a valid range of keys, remove nodes from BST that have keys outside the valid range.
This post will discuss how to reverse a string using the stack data structure in C/C++, Java, and Python using explicit stack and call stack.
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.
This post will discuss how to traverse the given directory and list out all files present in it and all its sub-directories using BFS and DFS.
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.
Given a sorted integer array, find the floor and ceiling of a given number in it. The floor and ceiling map the given number to the largest previous or the smallest following integer.
Given a binary search tree, find a pair with a given sum present in it.
Given a directed acyclic graph (DAG) and a source vertex, find the shortest path’s cost from the source vertex to all other vertices present in the graph. If the vertex can’t be reached from the given source vertex, print its distance as infinity.
Given a binary tree, write an efficient algorithm to compute the maximum number of nodes in any level in the binary tree.