Sudhir sharma has Published 1206 Articles

Find maximum average subarray of k length in C++

sudhir sharma

sudhir sharma

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

97 Views

In this problem, we are given an array arr[] of size n consisting of positive and negative values and an integer k. Our task is to find the maximum average subarray of k length. Let’s take an example to understand the problem,  Input: arr[] = {4, -1, 5, 6, -2, 4} k ... Read More

Find maximum in an array without using Relational Operators in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:24:40

177 Views

In this problem, we are given an array arr[] of size n consisting of positive values. Our task is to find maximum in an array without using Relational Operators. Let’s take an example to understand the problem, Input: arr[] = {5, 1, 6, 7 , 8, 2}Output: 8Solution ApproachSince we need to ... Read More

Find maximum among x^(y^2) or y^(x^2) where x and y are given in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:22:01

63 Views

In this problem, we are given two values x and y. Our task is to find maximum among x^(y^2) or y^(x^2) where x and y are given. Let’s take an example to understand the problem,  Input: x = 4, y = 3Output: 3^(4^2)Explanation: x^(y^2) = 4^(3^2) = 4^9 = 262144y^(x^2) = 3^(4^2) = 3^16 ... Read More

Find maximum among all right nodes in Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:21:35

48 Views

In this problem, we are given a Binary Tree. Our task is to find maximum among all right nodes in Binary Tree. Problem Description: Here, we need to find the maximum value amongst all right child nodes of the binary Tree.Let’s take an example to understand the problem,  Input: Output: 9Explanation: All right nodes are: ... Read More

Find maximum (or minimum) sum of a subarray of size k in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:21:14

313 Views

In this problem, we are given an  array arr[] and a number k. Our task is to Find the maximum (or minimum) sum of a subarray of size k. Let’s take an example to understand the problem,  Input: arr[] = {55, 43, 12, 76, 89, 25, 99} , k = 2Output: 165Explanation:The subarray ... Read More

Find maximum (or minimum) in Binary Tree in C++

sudhir sharma

sudhir sharma

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

827 Views

In this problem, we are given a binary tree. Our task is to Find maximum (or minimum) in Binary Tree. Problem Description: We need to find the nodes of the binary tree that have maximum and minimum value in the binary tree.Let’s take an example to understand the problem,  Input: Output: max = 9 ... Read More

Find longest length number in a string in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:13:50

322 Views

In this problem, we are given a string str consisting of character and alphabets only. Our task is to find the longest length number in a string. Problem Description: we need to find the length of the number i.e. consecutive numerical characters in the string.Let’s take an example to understand the problem, ... Read More

Find M-th number whose repeated sum of digits of a number is N in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:13:26

108 Views

In this problem, we are given two positive numbers N and M. Our task is to find the M-th number whose repeated sum of digits of a number is N. Problem description: Here, we need to find the Mth number whose sum of digits till the sum becomes single digit is equal ... Read More

Find max of two Rational numbers in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:12:19

137 Views

In this problem, we are given two Rational Numbers. Our task is to find max of two Rational numbers. Here, the rational numbers are in the form of p/q.Let’s take an example to understand the problem,  Input: rat1 = 5/4, rat2 = 3/2Output: 3/2Explanation: 5/4 = 1.253/2 = 1.5Solution Approach −A simple solution to ... Read More

Find letter's position in Alphabet using Bit operation in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 05:12:08

640 Views

In this problem, we are given a string str consisting of english alphabets. Our task is to find the letter's position in the Alphabet using the Bit operation. Problem Description: Here, we will return the position of each character of the string as it is in english alphabets.The characters of the string ... Read More

Advertisements