Find maximum cost path in a graph from a given source to a given destination
Given a weighted graph, find the maximum cost path from a given source to a destination that is greater than a given integer k. The path should not contain any cycles.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a weighted graph, find the maximum cost path from a given source to a destination that is greater than a given integer k. The path should not contain any cycles.
Given an expression consisting of an opening brace { and a closing brace }, find the minimum number of inversions needed to balance the expression.
Given a positive integer n, print all combinations of numbers between 1 and n having sum n.
Given a positive integer n and k, perform a circular shift on the binary representation of n by k positions.
Write a program to count the number of ways to calculate a target number from the specified array elements using only addition and subtraction operator. The use of any other operator is forbidden.
Given n lists of words, print all combinations of phrases that can be formed by picking one word from each list.
Given a linked list, rearrange it by separating odd nodes from even ones. All even nodes should come before all odd nodes in the output list, and the relative order of even and odd nodes should be maintained.
Write an algorithm to generate any one of the given n numbers according to given probabilities.
Given a binary tree, find the maximum difference between a node and its descendants in it.
Given an M × N rectangular grid, print all shortest routes in the grid that start at the first cell (0, 0) and ends at the last cell (M-1, N-1). We can move down or right or diagonally (down-right), but not up or left.
Given an integer array, check if only consecutive integers form the array.
Given an array of n integers where every element appears an even number of times except one element, which appears an odd number of times, find that odd occurring element in logarithmic time and constant space.