Narendra Kumar has Published 196 Articles

Minimum flips to make all 1s in left and 0s in right in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 09:52:57

279 Views

Problem statementGiven a binary string in which we can flip all 1’s in left part and all 0’s in right part. The task is to calculate minimum flips required to make all 1’s in left and all 0’s in rightExampleGiven binary string is 0010101. In this string there are 3 ... Read More

Minimum height of a triangle with given base and area in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Nov-2019 09:49:26

188 Views

DescriptionGiven two integers a and b, find the smallest possible height such that a triangle of atleast area ‘a’ and base ‘b’ can be formed.ExampleIf a = 16 and b = 4 then minimum height would be 8AlgorithmArea of triangle can be calculate using below formula −area = ½ * ... Read More

Minimum number of power terms with sum equal to n using C++.

Narendra Kumar

Narendra Kumar

Updated on 31-Oct-2019 07:40:40

212 Views

Problem statementGiven two positive integer N and X. The task is to express N as a sum of powers of X (X0 + X1 +…..+ Xn) such that the number of powers of X should be minimum.Print the minimum number of power of N used to make the sum equal ... Read More

Minimum number of points to be removed to get remaining points on one side of axis using C++.

Narendra Kumar

Narendra Kumar

Updated on 31-Oct-2019 07:37:14

533 Views

Problem statementWe are given N points in a Cartesian plane. Our task is to find the minimum number of points that should be removed in order to get the remaining points on one side of any axis.If given input is {(10, 5), (-2, -5), (13, 8), (-14, 7)} then if ... Read More

Minimum Number of Platforms Required for a Railway Station using C++.

Narendra Kumar

Narendra Kumar

Updated on 31-Oct-2019 07:35:09

209 Views

Problem statementGiven arrival and departure times of all trains that reach a railway station, the task is to find the minimum number of platforms required for the railway station so that no train waits.We are given two arrays that represent arrival and departure times of trains that stop.For below input, ... Read More

Minimum number of palindromes required to express N as a sum using C++.

Narendra Kumar

Narendra Kumar

Updated on 31-Oct-2019 07:30:17

128 Views

Problem statementGiven a number N, we have to find the minimum number of palindromes required to express N as a sum of themIf N = 15 then 2 palindromes are required i.e. 8 and 7.Algorithm1. Generate all the palindromes up to N in a sorted fashion 2. Find the size ... Read More

Minimum number of page turns to get to a desired page using C++.

Narendra Kumar

Narendra Kumar

Updated on 31-Oct-2019 07:26:43

397 Views

Problem statementGiven a book of N pages, the task is to calculate the minimum number of page turns to get to a give desired page K.we can either start turning pages from the front side of the book (i.e from page 1) or from the backside of the book (i.e ... Read More

Minimum number of operations required to sum to binary string S using C++.

Narendra Kumar

Narendra Kumar

Updated on 31-Oct-2019 07:24:59

118 Views

Problem statementGiven a binary string str. Find the minimum number of operations required to be performed to create the number represented by str. Only following operations can be performed −Add 2xSubtract 2xIf binary string is “1000” then we have to perform only 1 operation i.e. Add 23If binary string is ... Read More

Minimum number of operations required to delete all elements of the array using C++.

Narendra Kumar

Narendra Kumar

Updated on 31-Oct-2019 07:21:16

1K+ Views

Problem statementGiven an integer array arr, the task is to print the minimum number of operations required to delete all elements of the array. While deleting element following restriction is imposed −Any element from the array can be chosen at random and every element divisible by it can be removed ... Read More

Minimum number of operations on an array to make all elements 0 using C++.

Narendra Kumar

Narendra Kumar

Updated on 31-Oct-2019 07:18:01

258 Views

Problem statementGiven an array of size N and each element is either 1 or 0. The task is to calculated the minimum number of operations to be performed to convert all elements to zero. One can perform below operations −If an element is 1, You can change its value equal ... Read More

Advertisements