Sudhir sharma has Published 1206 Articles

Find the maximum possible value of the minimum value of modified array in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 12:57:38

329 Views

In this problem, we are given an array arr[] of size n and a number S. Our task is to Find the maximum possible value of the minimum value of the modified array.Here, are the rules to modify the array, The difference between the sum of the array elements before ... Read More

Maximum occurrence of prefix in the Array in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 12:49:31

179 Views

In this problem, we are given an array of characters all in lowercase. Our task is to Maximum occurrence of prefix in the Array.We need to count the occurrence of non-empty prefixes whose occurrence count is maximum.Let’s take an example to understand the problem, Input : string = “xyyzkxyyzk” Output ... Read More

Find the number of divisors of all numbers in the range [1, n] in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 12:46:16

641 Views

In this problem, we are given a number N. Our task is to find the number of divisors of all numbers in the range [1, n].Let’s take an example to understand the problem, Input : N = 7 Output : 1 2 2 3 2 4 2Solution ApproachA simple solution ... Read More

Find the number of different numbers in the array after applying the given operation q times in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 12:36:02

110 Views

In this problem, we are given a number N which is the size of an array consisting of all zeros and Q queries each of the following type −update(s, e, val ) -> this query will update all elements from s to e (both inclusive) to val.Our task is to ... Read More

Find the number of boxes to be removed in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 12:26:25

119 Views

In this problem, we are given an array arr[] in which each element represents a pile of boxes (each of unit height). Our task is to find the number of boxes to be removed.The person is standing at index 0 of the array at the height of the pile of ... Read More

Find the Nth term of the series 9, 45, 243,1377…in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 12:18:13

141 Views

In this problem, we are given an integer value N.Our task is to Find the nth term of the series −9, 45, 243, 1377, 8019, …Let’s take an example to understand the problem, Input : N = 4 Output : 1377Solution ApproachA simple solution to find the problem is by ... Read More

Find the nth term of the series 0, 8, 64, 216, 512,... in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 10:58:49

263 Views

In this problem, we are given an integer value N. Our task is to find the nth term of the series −0, 8, 64, 216, 512, 1000, 1728, 2744…Let’s take an example to understand the problem, Input: N = 6 Output: 1000Solution ApproachTo find the Nth term of the series, ... Read More

Find the nth term of the given series 0, 0, 2, 1, 4, 2, 6, 3, 8, 4… in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 08:37:36

384 Views

In this problem, we are given an integer value N. Our task is to Find the nth term of the given series −0, 0, 2, 1, 4, 2, 6, 3, 8, 4, 10, 5, 12, 6, 14, 7, 16, 8, 18, 9, 20, 10… Let’s take an example to understand the ... Read More

Practice Questions on Time Complexity Analysis in C++

sudhir sharma

sudhir sharma

Updated on 02-Aug-2021 12:05:47

8K+ Views

Time complexity of any algorithm is the time taken by the algorithm to complete. It is an important metric to show the efficiency of the algorithm and for comparative analysis. We tend to reduce the time complexity of algorithm that makes it more effective.Example 1Find the time complexity of the ... Read More

Find pairs with given sum in doubly linked list in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 14:05:05

207 Views

In this problem, we are given a doubly linked list and a value sum. Our task is to find pairs with a given sum in a doubly linked list.Let’s take an example to understand the problem, Inputhead − 2 5 6 9 12 x = 11Output(2, ... Read More

Advertisements