Construct the largest number whose sum of cost of digits is K
Given a positive integer K, and an array arr[] consisting of N( =9) integers such that arr[i] represents the cost of the digit (i+1), the task is to find the largest number that can be formed using the digits over the range [1, 9] such that the sum of the cost of digits of the number formed is K....
read more
Minimum score possible for a player by selecting one or two consecutive array elements from given binary array
Given a binary array arr[] of size N and two players, A and B. The task is to minimize the score for player A by selecting the scores for the players as per the given constraints:...
read more
Merge the elements in subarray of all even elements of the Array
Given an array arr[] containing N numbers, the task is to merge the subarray of consecutive even numbers by replacing all consecutive even numbers by the first even element of that subarray.Note: A series of even integers are said to be consecutive if there are at least three even numbers in the given series. Therefore, merge elements in subarray which have at least 3 consecutive even numbers.Examples:...
read more
Hike Interview Experience | Set 5
Round I 1.Implement expiry cache system : every page in cache have id and expiry time (TTL of few seconds). After page expires it behaves as free space and can be used for new pages/replacement. Had a long discussion on everything....
read more
Substitution Method to solve Recurrence Relations
Recursion is a method to solve a problem where the solution depends on solutions to smaller subproblems of the same problem. Recursive functions (function calling itself) are used to solve problems based on Recursion. The main challenge with recursion is to find the time complexity of the Recursive function. In this article, we will learn about how to find the time complexity of Recursive functions using Substitution Method....
read more
Construct a Doubly linked linked list from 2D Matrix
Given a 2D matrix, the task is to convert it into a doubly-linked list with four pointers that are next, previous, up, and down, each node of this list should be connected to its next, previous, up, and down nodes.Examples:...
read more
Find the node with maximum value in a Binary Search Tree using recursion
Given a Binary Search Tree, the task is to find the node with maximum value....
read more
Print all unique combinations of setting N pieces on an NxN board
Given an integer N, the task is to print all the unique combinations of putting N pieces in an NxN board....
read more
Find all Unique Subsets of a given Set
Given an array A[] of positive integers, print all the unique non-empty subsets of the array...
read more
Minimum of the Maximum distances from any node to all other nodes of given Tree
Given a tree with N vertices and N-1 edges represented by a 2D array edges[], the task is to find the minimum value among the maximum distances from any node to all other nodes of the tree....
read more
Sum of nodes within K distance from target
Given a binary tree, a target node and a positive integer K on it,  the task is to find the sum of all nodes within distance K from the target node (including the value of the target node in the sum)....
read more
Count of distinct Numbers that can be formed by chess knight in N moves on a mobile keypad
Given an integer N and a chess knight placed in mobile keypad. The task is to count the total distinct N digit numbers which can be formed by the chess knight with N moves. As the answer can be very large give the value of answer modulo 109 + 7....
read more