Narendra Kumar has Published 191 Articles

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

567 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

517 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

106 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

158 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

186 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

238 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

Minimum positive integer required to split the array equally in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 11:04:23

217 Views

Problem statementGiven an array of N positive integers, the task is to find the smallest positive integer that can be placed between any two elements of the array such that, the sum of elements in the subarray occurring before it, is equal to the sum of elements occurring in the ... Read More

Minimum possible final health of the last monster in a game in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 10:58:54

401 Views

Problem statementGiven N monsters, each monster has initial health h[i] which is an integer. A monster is alive if its health is greater than 0.In each turn a random monster kills another random monster, the monster which is attacked, its health reduces by the amount of health of the attacking ... Read More

Minimum number of Square Free Divisors in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 10:54:48

208 Views

Problem statementGiven an integer N. Find the minimum number of square free divisors.The factorization of N should comprise of only those divisors that are not full squareExampleIf N = 24 then there are 3 square free factors as follows −Factors = 2 * 6 * 2AlgorithmFind all prime factors upto ... Read More

Minimum number of single digit primes required whose sum is equal to N in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 10:48:56

225 Views

Problem statementFind the minimum number of single-digit prime numbers required whose sum will be equal to N.ExampleIf N = 9 then we require 2 prime numbers i.e. 7 and 2 to make sum 9.Example#include using namespace std; bool isValidIndex(int i, int val) {    return (i - val) < ... Read More

Advertisements