Sudhir sharma has Published 1149 Articles

Find median in row wise sorted matrix in C++

sudhir sharma

sudhir sharma

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

288 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

166 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

542 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

187 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

Find maximum value of Sum( i*arr[i]) with only rotations on given array allowed in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:32:48

178 Views

In this problem, we are given an array arr[] consisting of n elements. We need to Find maximum value of Sum( i*arr[i]) with only rotations on a given array allowed. For find the maximum sum of (i*arr[i]), we can perform any number of rotations.Let’s take an example to understand the ... Read More

Find Maximum value of abs(i – j) * min(arr[i], arr[j]) in an array arr[] in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:30:15

474 Views

In this problem, we are given an array arr[] insisting of N integer values.Our task is to Find Maximum value of abs(i – j) * min(arr[i], arr[j]) in an array arr[].Problem description − we need to find the maximum product value of the minimum value of two elements and the ... Read More

Find maximum sum taking every Kth element in the array in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 06:27:09

273 Views

In this problem, we are given an array arr[] and an integer k. Our task is to Find the maximum sum taking every Kth element in the array.Problem description: We need to find the maximum sum of the elements of the array such that they are k indexes apart. i.e. ... Read More

Find maximum sum array of length less than or equal to m in C++

sudhir sharma

sudhir sharma

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

159 Views

In the problem, we are given n arrays of different length. Our task is to Find the maximum sum array of length less than or equal to m.We need to find sub-arrays from the arrays to maximise the sum and make the length of all subarrays combined equal to m.Let’s ... Read More

Find Maximum side length of square in a Matrix in C++

sudhir sharma

sudhir sharma

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

276 Views

In this problem, we are given a 2-D matrix mat[][] of size n, n being an odd number. Our task is to Find Maximum side length of a square in a Matrix.Problem Description − We need to find the length of the square matrix whose perimeter values are the same ... Read More

Find maximum possible stolen value from houses in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 05:57:40

693 Views

In this problem, we are given n houses with some values in them. Our task is to Find the maximum possible stolen value from houses.Problem Description − We have an array houses[] that consist of the values that are in each house. A thief robs the houses but he cannot ... Read More

Advertisements