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....
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:...
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:...
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....
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....
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:...
Given a Binary Search Tree, the task is to find the node with maximum value....
Given an integer N, the task is to print all the unique combinations of putting N pieces in an NxN board....
Given an array A[] of positive integers, print all the unique non-empty subsets of the array...
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....
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)....
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....