Sudhir sharma has Published 1206 Articles

Find minimum possible digit sum after adding a number d in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 07:01:15

155 Views

In this problem, we are given two numbers n and d. Our task is to Find the minimum possible digit sum after adding a number d.Problem Description − we need to minimise the digits sum by adding kth multiple of d to n.Let’s take an example to understand the problem, ... Read More

Find minimum operations needed to make an Array beautiful in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:58:26

475 Views

In this problem, we are given a binary array bin[] consisting n binary values which happen to be 0 and 1. Our task is to find minimum operations needed to make an Array beautiful.Beautiful array is a special type of binary array which consists of a pattern of alternate 0’s ... Read More

Find minimum number of merge operations to make an array palindrome in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:56:17

652 Views

In this problem, we are given an array arr[] consisting of n positive numbers. Our task is to Find minimum number of merge operations to make an array palindrome.Palindrome array are similar to palindrome strings, the elements at index i and n-i should be the same.Example{5, 1, 7, 2, 7, ... Read More

Find minimum in an array without using Relational Operators in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:52:40

119 Views

In this problem, we are given an array arr[] consisting of n positive elements. Our task is to find minimum in an array without using Relational Operators.Relational operators in programming are those operators which are used to check the relationship between two values. Like == (equals), greater than (>), less ... Read More

Find Minimum Depth of a Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:50:39

339 Views

In this problem, we are given a binary tree. Our task is to Find Minimum Depth of a Binary Tree.Binary Tree has a special condition that each node can have a maximum of two children.The minimum depth of a binary tree is the shortest path between the root node to ... Read More

Find middle point segment from given segment lengths in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:46:56

116 Views

In this problem, we are given an array arr[] of size m representing the lengths of line segments.The line segments are from 0 to arr[0] , arr[0] to arr[1] and so on. Our task is to find the segment which is at the middle of all segments.Let’s take an example ... Read More

Find median in row wise sorted matrix in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:44:06

193 Views

In this problem, we are given a 2D array mat[r][c] whose elements are sorted row-wise. Our task is to Find median in a row-wise sorted matrix.Description − we need to find the median of elements of the matrix.Let’s take an example to understand the problem, Inputmat = {    {2, ... Read More

Find mean of subarray means in a given array in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:41:56

117 Views

In this problem, we are given an array arr[] of size n and an integer m. Our task is to Find mean of subarray means in a given array.Code Description − Here, we need to find the mean of array as the mean of means of subarray of size m.Let’s ... Read More

Find Maximum XOR value of a sub-array of size k in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:38:36

434 Views

In this problem, we are given an array arr[] consisting of n elements and an integer k. Our task is to find the Maximum XOR value of a sub-array of size k.Let’s take an example to understand the problem, Inputarr[] = {3, 1, 6, 2 ,7, 9} k = 3Output12ExplanationAll ... Read More

Find maximum XOR of given integer in a stream of integers in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:36:47

109 Views

In this problem, we are given Q queries each of which is one of the following type, Type 1 − insertion (1, i) to add the element with value i, in your data structure.Type 2 − findXOR (2, i), to find the XOR of all elements of the data structure ... Read More

Advertisements