Sudhir sharma has Published 1206 Articles

Find sum of Series with n-th term as n^2 - (n-1)^2 in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2022 08:38:47

304 Views

In this problem, we are given an integer value N. Our task is to find Sum of Series n^2 - (n-1)^2 upto n terms.Let's take an example to understand the problem, Input : N = 3 Output : 6Explanation −[12 - (0)2] + [22 - (1)2] + [32 - (2)2] ... Read More

Find Sum of Series 1^2 - 2^2 + 3^2 - 4^2 ... upto n terms in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2022 08:31:46

686 Views

In this problem, we are given an integer value N. Our task is to find Sum of Series 1^2 - 2^2 + 3^2 - 4^2 ... upto n terms.Let's take an example to understand the problem, Input : N = 3 Output : 6Explanation −12 - 22 + 32 = ... Read More

Find Sum of pair from two arrays with maximum sum in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2022 08:24:46

201 Views

In this problem, we are given two arrays, positive and distinct. Our task is to find the sum of pairs from two arrays with maximum sum.We will find the pair with the maximum sum with one element from each array.Let's take an example to understand the problem, Input : arr1[] ... Read More

Find sum of even and odd nodes in a linked list in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2022 08:18:57

669 Views

In this problem, we are given a linked list. Our task is to find the sum of even and odd nodes in a linked list.Let's take an example to understand the problem, Input : linked list : 3 -> 2 -> 5 -> 7 -> 1 -> 9 Output : ... Read More

Find sum of divisors of all the divisors of a natural number in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2022 08:11:18

810 Views

In this problem, we are given a natural number N. Our task is to find the sum of divisors of all the divisors of a natural number.Let's take an example to understand the problem, Input : N = 12 Output : 55Explanation −The divisors of 12 are 1, 2, 3, ... Read More

Find Sum of all unique subarray sum for a given array in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 14:17:49

564 Views

In this problem, we are given an array arr[] consisting of n integer values. Our task is to find the sum of all unique subarray sum for a given array. Subarray sum is the sum of elements of the given subarray.Let's take an example to understand the problem, Input : ... Read More

Find sum of all right leaves in a given Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 14:01:09

302 Views

In this problem, we are given a binary tree. Our task is to find the sum of all left right in a given Binary Tree.Let's take an example to understand the problem, Input :Output : 8Explanation −All leaf nodes of the tree are : 1, 8 Sum = 1 + ... Read More

Find sum of all left leaves in a given Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 13:26:08

314 Views

In this problem, we are given a binary tree. Our task is to find the sum of all left leaves in a given Binary Tree.Let's take an example to understand the problem, Input : Output : 11Explanation −All leaf nodes of the tree are : 2, 9 Sum = 2 + ... Read More

Find subarray with given sum - (Handles Negative Numbers) in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 13:06:14

428 Views

In this problem, we are given an array arr[] consisting of N integers stored in unsorted order. Our task is to find a subarray with a given sum.Let's take an example to understand the problem, Input : arr[] = {2, 5, -1, 4, 6, -9, 5} sum = 14 Output ... Read More

Find subarray with given sum - (Nonnegative Numbers) in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 12:52:30

316 Views

In this problem, we are given an array arr[] consisting of N positive integers stored in unsorted order. Our task is to find a subarray with a given sum.Let's take an example to understand the problem, Input : arr[] = {2, 5, 1, 4, 6, 9, 5} sum = 11 ... Read More

Advertisements