Sudhir sharma has Published 1149 Articles

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

352 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

468 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

10K+ 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

330 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

Find speed of man from speed of stream and ratio of time with up and down streams in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:41:00

150 Views

In this problem, we are given two values S and N denoting the speed of stream in Km/h and ratio of time with up and down streams. Our task is to Find speed of man from the speed of stream and ratio of time with up and down streams.Let’s take ... Read More

Find smallest permutation of given number in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:38:31

834 Views

In this problem, we are given a large number N. Our task is to find the smallest permutation of a given number.Let’s take an example to understand the problem, InputN = 4529016Output1024569Solution ApproachA simple solution to the problem is by storing the long integer value to a string. Then we ... Read More

Find smallest number with given number of digits and sum of digits in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:37:29

1K+ Views

In this problem, we are given two values that are the sum (denoting the sum of digits) and digit (denoting the number of digits). Our task is to find the smallest number with a given number of digits and sum of digits.Let’s take an example to understand the problem, Inputsum ... Read More

Find smallest and largest elements in singly linked list in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:35:28

889 Views

In this problem, we are given a singly linked list. Our task is to find the smallest and largest elements in single linked list.Let’s take an example to understand the problem, Inputlinked List : 5 -> 2 -> 7 -> 3 ->9 -> 1 -> 4OutputSmallest element = 1 Largest ... Read More

Find smallest and largest element from square matrix diagonals in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:33:02

1K+ Views

In this problem, we are given a square matrix of size nXn. Our task is to Find smallest and largest element from square matrix diagonals. We need to find the smallest and largest elements of the primary and secondary diagonals of the matrox.Let’s take an example to understand the problem, ... Read More

Find single Movement in a Matrix in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:30:24

138 Views

In this problem, we are given four values x1, y1, x2, y2 denoting two points (x1, y1) and (x2, y2). Our task is to find single movement in a Matrix. We need to find the direction using which we can move from one point (x1, y1) to (x2, y2). There ... Read More

Advertisements