Narendra Kumar has Published 196 Articles

Minimum Sum Path in a Triangle in C++

Narendra Kumar

Narendra Kumar

Updated on 20-Dec-2019 09:58:12

111 Views

Problem statementGiven a triangular structure of numbers, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.ExampleIf input is −   5   7 3  8 1 2 9 6 4 5Then minimum sum is 13 as follows −5 + ... Read More

Minimum sum path between two leaves of a binary trees in C++

Narendra Kumar

Narendra Kumar

Updated on 20-Dec-2019 09:49:26

144 Views

Problem statementGiven a binary tree in which each node element contains a number. The task is to find the minimum possible sum from one leaf node to another.ExampleIn above tree minimum sub path is -6 as follows: (-4) + 3 + 2 + (-8) + 1AlgorithmThe idea is to maintain ... Read More

Minimum sum of two numbers formed from digits of an array in C++

Narendra Kumar

Narendra Kumar

Updated on 20-Dec-2019 09:33:40

338 Views

DescriptionGiven an array of digits which contains values from 0 to 9. The task is to find the minimum possible sum of two numbers formed from digits of the array. Please note that we have to use all digits of given arrayExampleIf input array is {7, 5, 1, 3, 2, ... Read More

Minimum operations required to set all elements of binary matrix in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 11:58:52

134 Views

Problem statementGiven a binary matrix of N rows and M columns. The operation allowed on the matrix is to choose any index (x, y) and toggle all the elements between the rectangle having top-left as (0, 0) and bottom-right as (x-1, y-1). Toggling the element means changing 1 to 0 ... Read More

Minimum operations to make the MEX of the given set equal to x in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 11:57:49

420 Views

Problem statementGiven a set of n integers, perform minimum number of operations (you can insert/delete elements into/from the set) to make the MEX of the set equal to x (that is given).Note − The MEX of a set of integers is the minimum non-negative integer that doesn’t exist in it. ... Read More

Minimum operations to make XOR of array zero in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 11:57:20

334 Views

Problem statementWe are given an array of n elements. The task is to make XOR of whole array 0. We can do following to achieve this.We can select any one of the element −After selecting element, we can either increment or decrement it by 1.We need to find the minimum ... Read More

Minimum partitions of maximum size 2 and sum limited by given value in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 11:24:10

47 Views

Problem statementGiven an array arr[] of positive numbers, find minimum number of sets in array which satisfy following property, A set can contain maximum two elements in it. The two elements need not to be contiguous.Sum of elements of set should be less than or equal to given Key. It ... Read More

Minimum Players required to win the game in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 11:19:18

92 Views

Problem statementGiven N questions and K options for each question, where 1

Minimum positive integer value possible of X for given A and B in X = P*A + Q*B in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 11:13:15

117 Views

Problem statementGiven values of A and B, find the minimum positive integer value of X that can be achieved in the equation X = P*A + Q*B, Here P and Q can be zero or any positive or negative integer.ExampleIf A = 2 and B = 4 then answer will ... Read More

Minimum Possible value of |ai + aj – k| for given array and k in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 11:09:01

166 Views

Problem statementYou are given an array of n integer and an integer K. Find the number of total unordered pairs {i, j} such that absolute value of |ai + aj – k| is minimal possible where i != j.ExampleIf arr[ ] = {0, 4, 6, 2, 4} and k = ... Read More

Advertisements