Sudhir sharma has Published 1206 Articles

Find m-th summation of first n natural numbers in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:11:42

381 Views

In this problem, we are given two integers m and n. Our task is to Find m-th summation of the first n natural numbers. Problem Description: we will find sum of sum of n natural numbers m times. The sum is given by the formula, if (m > 1),       ... Read More

Find m-th smallest value in k sorted arrays in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:11:04

151 Views

In this problem, we are given k different arrays of different sizes. Our task is to find m-th smallest value in k sorted arrays. Problem Description: Here, we need to find m-th smallest element of the merged array of all k arrays.Let’s take an example to understand the problem,  Input:     ... Read More

Find length of the largest region in Boolean Matrix in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:05:38

548 Views

In this problem, we are given a 2-D matrix of size nXm consisting of 0’s and 1’s only. Our task is to find the length of the largest region in the Boolean Matrix. Problem Description: If a cell contains 1, it is a filled Cell. We need to find the length of connected ... Read More

Find length of loop in linked list in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:04:42

379 Views

In this problem, we are given a linked list that might contain loops. Our task is to find the length of the loop in the linked list. Problem Description: we need to count the number of nodes in the loop if it contains a loop otherwise return -1.Let’s take an example to ... Read More

Find length of Diagonal of Hexagon in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:03:38

94 Views

In this problem, we are given an integer n denoting the length of the side of a regular hexagon. Our task is to Find length of Diagonal of Hexagon.Problem Description: Here, we have the side of a regular hexagon. And we need to find the length of the diagonal of the ... Read More

Find last five digits of a given five digit number raised to power five in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:00:05

197 Views

In this problem, we are given a number N. Our task is to find the last five digits of a given five digit number raised to power five. Let’s take an example to understand the problem,  Input: N = 25211Output:Solution ApproachTo solve the problem, we need to find only the last five ... Read More

Find Last Digit of a^b for Large Numbers in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:58:42

824 Views

In this problem, we are given two numbers a and b. Our task is to find Last Digit of a^b for Large Numbers. Let’s take an example to understand the problem,  Input: a = 4 b = 124Output: 6Explanation: The value of a^b is 4.523128486 * 1074Solution ApproachThe solution to the problem is based ... Read More

Find largest sum of digits in all divisors of n in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:58:23

126 Views

In this problem, we are given an integer n. Our task is to find the largest sum of digits in all divisors of n. Problem  Description: Here, we will find the divisor of the number n whose sum of digits in largest.Let’s take an example to understand the problem,  Input: 18Output: 9Explanation: All divisors of ... Read More

Find largest subtree sum in a tree in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:56:41

275 Views

In this problem, we are given a binary tree. Our task is to find the largest subtree sum in a tree. Problem Description: The  binary tree consists of positive as well as negative values. And we need to find the subtree that has the maximum sum of nodes.Let’s take an example to ... Read More

Find largest number smaller than N with same set of digits in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:56:14

240 Views

In this problem, we are given a string N that represents a number. Our task is to find the largest number smaller than N with the same set of digits.  Problem Description: we need to find a number using all the digits of the given number which is the largest smaller number ... Read More

Advertisements