Narendra Kumar has Published 196 Articles

Maximum sum of i * arr[i] among all rotations of a given array in C++

Narendra Kumar

Narendra Kumar

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

380 Views

In this problem, we are given an array arr. Our task is to create a program that will find the maximum sum of i*arr[i] among all rotations of the given array in C++.Program description − Here, we will find the maximum sum of out the sums of all the elements ... Read More

Maximum sum of lengths of non-overlapping subarrays with k as the max element in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:57:17

142 Views

In this problem, we are given an array and an integer k. Our task is to create a program that will find the maximum sum of lengths of non-overlapping subarrays with k as the max element in c++.Problem description − here, we have an array and an integer k. We ... Read More

Maximum sum of non-leaf nodes among all levels of the given binary tree in C++

Narendra Kumar

Narendra Kumar

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

100 Views

In this problem, we are given a binary tree. Our task is to create a program that will find the maximum sum of non-leaf nodes among all levels of the given binary tree in c++.Problem description − we will calculate the sum of all non-leaf nodes of the tree and ... Read More

Maximum sum subarray having sum less than or equal to given sums in C++

Narendra Kumar

Narendra Kumar

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

507 Views

In this problem, we are given an array and a sum. Our task is to create a program that will find the maximum sum subarray having a sum less than or equal to given sums in c++.We have to find the subarray of any length less than or equal to ... Read More

Maximum sum subarray removing at most one element in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:49:56

95 Views

In this problem, we are given an array. Our task is to create a program that will find maximum sum subarray removing at most one element in c++.Basically, we need to find one element which when removed provides the maximum sum for the elements remaining in the array.Let’s take an ... Read More

Maximum value of |arr[i] – arr[j] - + |i – j| in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:48:06

225 Views

In this problem, we are given an array of n integers. Our task is to create a program that will find the maximum value of |arr[i]-arr[j]| + |i-j|.Let’s take an example to understand the problem, Input − array = {4, 1, 2}Output − 4Explanation −|arr[0] - arr[1]|+|0-1| = |4-1| + ... Read More

Maximum sum two non-overlapping subarrays of given size in C++

Narendra Kumar

Narendra Kumar

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

120 Views

In this problem, we are given an array of positive integers and a number k. Our task is to create a program that will find the maximum sum of two nonoverlapping subarrays of the given size(k).So, basically we have two print two non-overlapping (distinct) subarrays that have the maximum sum ... Read More

Maximum triplet sum in array in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:44:34

123 Views

In this problem, we are given an array. Our task is to create a program that will find the maximum triplet sum in the array i.e. find the set of three elements whose sum is maximum.Let’s take an example to understand the problem, Input − array = {4, 6, 1, ... Read More

Maximum Unique Element in every subarray of size K in c++

Narendra Kumar

Narendra Kumar

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

197 Views

In this problem, we are given an array of integers and a integers K. our task is to create a program that will find the maximum unique element in every subarray of size K with no duplicates.Let’s take an example to understand the problem, Input −array = {4, 1, 1, ... Read More

Maximum value of |arr[0] – arr[1] - + |arr[1] – arr[2] - + … +|arr[n – 2] – arr[n – 1] - when elements are from 1 to n in C++

Narendra Kumar

Narendra Kumar

Updated on 03-Jun-2020 07:40:53

111 Views

In this problem, we are given an array of n integers of range [1, n]. Our task is to create a program that will find the maximum value of |arr[0] – arr[1] - + |arr[1] – arr[2] - + … +|arr[n – 2] – arr[n – 1].Let’s take an example ... Read More

Advertisements