Find all n-digit binary numbers with an equal sum of bits in their two halves
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.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedFind 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.
Consider a directed graph where the weight of its edges can be one of x, 2x, or 3x (x is a given integer), compute the least-cost path from source to destination efficiently.
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.
Given a set S of positive integers, determine if it can be partitioned into three disjoint subsets that all have the same sum, and they cover S.