Narendra Kumar has Published 196 Articles

Maximum value of arr[i] % arr[j] for a given array in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:39:20

171 Views

In this problem, we are given an array of n elements. Our task is to create a program that will find the maximum value of arr[i]%arr[j] for a given array.So, basically we need to find the value of the maximum remainder while dividing two elements of the array.Let’s take an ... Read More

Maximum value of XOR among all triplets of an array in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:37:31

87 Views

In this problem, we are given an array of integers. Our task is to create the maximum value of XOR among all triplets of an array.Let’s take an example to understand the problem, Input − array = {5, 6, 1, 2}Output − 6Explanation −All triplets are: 5^6^1 = 2 5^6^2 ... Read More

Maximum weight path ending at any element of last row in a matrix in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:36:08

266 Views

In this problem, we are given an integer n and a matrix of size n X n which contains the weight of the cell. Our task is to create a program that will find the maximum weight path ending at any element of the last row in a matrix. While ... Read More

Maximum XOR using K numbers from 1 to n in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:33:54

278 Views

In this problem, we are given two positive integers n and k. Our task is to find maximum xor between 1 to n using maximum X numbersLet’s take an example to understand the problem, Input − n = 5, k = 2Output − 7Explanation −elements till 5 is 1, 2, ... Read More

Maximum XOR value in matrix in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:32:35

85 Views

In this problem, we are given a matrix of size n X n. Our task is to create a program that will calculate the maximum XOR value of a complete row or a complete column.Let’s take an example to understand the problem, Input −N = 3 mat[N][N] = {{4, 9, ... Read More

Mean and Median of a matrix in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:29:59

1K+ Views

In this problem, we are given a 2D array of size n*n. Our task is to create a program that will print the mean and median of the matrix in C++.Mean is the average of the date set. In a matrix mean is the average of all elements of the ... Read More

Mean of range in array in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:27:58

328 Views

In this problem, we are given an array of n integers and some m querries. Our task is to create a program that calculates the integral value(round down) of the mean of the ranges given by the querries.Let’s take an example to understand the problem, Input −array = {5, 7, ... Read More

Measure one litre using two vessels and infinite water supplys in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:26:25

97 Views

In this problem, we are given two vessels with capacities x and y and a supply of infinite water. Our task is to create a program that will be able to calculate exactly 1 liter in one vessel. Given the condition that x and y are co-primes. Co-primes also is ... Read More

Median after K additional integers in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:24:50

36 Views

In this problem, we are given an array of n integers and we are adding K elements to the array and then find the median of the resultant array. Given the condition, N+k is odd.Let’s take an example to understand the problem, Input −array = {23, 65, 76, 67} ; ... Read More

Median Of Running Stream of Numbers in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:22:47

259 Views

In this problem, we are given a data stream that is continuously reading integers. Our task is to create a program that will read elements and calculate the medians for these elements.The Median of an array is the middle element from a sorted sequence(it can be ascending or descending).Calculating medianFor ... Read More

Advertisements