Sudhir sharma has Published 1206 Articles

Find the other end point of a line with given one end and mid using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 12:42:55

122 Views

In this problem, we are given the coordinates of two points of a line starting point A(xA, yA) and midpoint M(xM, yM) .Our task is to find the other end point of a line with given one end and mid.Let’s take an example to understand the problem, InputA = [1, ... Read More

Find the only repetitive element between 1 to n-1 using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 12:00:18

123 Views

In this problem, we are given an unordered array arr[] of size N containing values from 1 to N-1 with one value occuring twice in the array. Our task is to find the only repetitive element between 1 to n-1.Let’s take an example to understand the problem, Inputarr[] = {3, ... Read More

Find the only repeating element in a sorted array of size n using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:50:52

174 Views

In this problem, we are given an arr[] of size N containing values from 1 to N-1 with one value occuring twice in the array. Our task is to find the only repeating element in a sorted array of size n.Let’s take an example to understand the problem, Inputarr[] = ... Read More

Find the only missing number in a sorted array using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:45:42

1K+ Views

In this problem, we are given an arr[] of size N containing values from 1 to N with one value missing in the array. Our task is to find the only missing number in a sorted array.Let’s take an example to understand the problem, Inputarr[] = {1, 2, 3, 5, ... Read More

Find the only element that appears b times using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:41:26

96 Views

In this problem, we are given an arr[] of size n and two integers a and b. Our task is to find the only element that appears b times.All values of the array occur a time except one value which occurs b times in the array and we need to ... Read More

Find the only different element in an array using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:36:37

159 Views

In this problem, we are given an arr[] of size n. Our task is to find the only different element in an array.There are only two different types of elements in the array. All the elements are the same except one.Let’s take an example to understand the problem, Inputarr[] = ... Read More

Find the one missing number in range using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:31:24

377 Views

In this problem, we are given an arr[] of size n. Our task is to find the one missing number in range.The array consists of all values ranging from smallest value to (smallest + n). One element of the range is missing from the array. And we need to find ... Read More

Maximum occurring character in an input string using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:27:16

5K+ Views

In this problem, we are given an input string of lowercase characters. Our task is to maximum occurring character in an input string.In case of multiple values with the same frequency of occurrence, we need to print lexicographically smaller values.Let’s take an example to understand the problem, Inputstring = “programming”OutputgSolution ... Read More

Find the number of zeroes using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:22:03

649 Views

In this problem, we are given a binary array bin[] consisting of only 0’s and 1’s. Our task is to find the number of zeroes.The array is sorted i.e. all 0’s are arranged together after 1’s.Let’s take an example to understand the problem, Inputarr[] = {1, 1, 1, 0, 0, ... Read More

Find the number of solutions to the given equation in C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:20:12

341 Views

In this problem, we are given three integer values A, B, C. Our task is to find the number of solutions to the given equation.EquationX = B*Sm(X)^A + Cwhere Sm(X) is the sum of digits of X.We need to count all the values of X such that it satisfies the ... Read More

Advertisements