Sudhir sharma has Published 1206 Articles

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

76 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

630 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

950 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

653 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

81 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

Find size of the largest ‘+’ formed by all ones in a binary matrix in C++

sudhir sharma

sudhir sharma

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

138 Views

In this problem, we are given an NxN binary matrix bin[][]. Our task is to find the size of the largest ‘+’ formed by all ones in a binary matrix.Let’s take an example to understand the problem, Input0 1 1 1 1 1 0 1 0Output5Solution ApproachA simple solution to ... Read More

Find single in an array of 2n+1 integer elements in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:22:50

166 Views

In this problem, we are given an array consisting of (2n+ 1) integer values. Out of all these values, n elements appear twice in the array and there is only one element in the array that appears once. Our task is to Find single in an array of 2n+1 integer ... Read More

Find shortest unique prefix for every word in a given list in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:19:50

149 Views

In this problem, we are given an array of words arr[]. Our task is to find the shortest unique prefix for every word in the given list.Let’s take an example to understand the problem, Inputarr[] = {“learn”, “programming”, “code”}Outputc leap lear pSolution ApproachA simple solution to the problem is by ... Read More

Find shortest safe route in a path with landmines in C++

sudhir sharma

sudhir sharma

Updated on 16-Mar-2021 06:17:01

706 Views

In this problem, we are given a matrix mat[][]. It defines a path with landmines which are marked as 0. Our task is to Find shortest safe route in a path with landmines.While traversing through the safe path, we need to avoid walking adjacent cells of the landmine (left, right, ... Read More

Advertisements