Problem Statement: You are given n*n matrix, where every row and column is sorted in non descending order. You need to find kth smallest element in the given 2D array. Example Input: k = 3 array = 10, 20, 30, 40 50, 60, 70, 80 …
Problem Statement: You are given a matrix arr. You need to find the sum of pair with max sum. Example Input : mat = {{1, 2, 3, 4}, {25, 3, 5, 1}, {8, 9, 3, 9}, {3, 10, 5, 16}} Output : 41 Pair (25, 16) …
Problem Statement: You are given an integer array and an integer K, you need to return true if you are able to divide the Example Input: , k = 4 Output: true It is possible to divide into 4 sub array with equal sum as: (5), …
Problem Statement: You are given 2 values, low, high. You need to find the sequential digits, where one number is more than the previous digit. You need to return the result in sorted order. Example Input: low = 100, high = 300 Output: Solution …
Problem Statement: You are given an n * n chessboard, you need to return the number of queens possible in the chess board. Example n = 4 Output = 2 You can place 2 queens such that they dont attack each other Input: 4 Output: …
Problem Statement: You are given a string, you need to transform every letter individually to be lowercase or uppercase to create another string. Example Input: "a1b" Output: "a1b", "A1b", "a1B", "A1B" Solution We can solve this problem by using DFS method. Explanations is as below: …
Problem Statement: You are given two numbers K and N, you need to find all valid combinations of k numbers that sum up to n. Such that only the numbers 1 to 9 are used and at-most only once. Example Input: k = 3, n …
Problem Statement: You are given 2 integers n and k, you need to return all possible combination of K numbers from the range Example Input: n = 4, k = 2 Output: , , , , , , ] Solution We will use backtracking …
Problem Statement: You are given an array with repeated elements, and a key element. You need to return the unique combination in that array where the sum is equal to the target. Example Input: array = , key = 5 Output: , ] …