Sudhir sharma has Published 1206 Articles

Find sub-string with given power in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 12:06:06

177 Views

In this problem, we are given a string str and an integer pow. Our task is to find a sub-string with given power.We need to return the substring whose power is equal to pow.Power of string is the sum of powers of its characters.Power of character : a -> 1, ... Read More

Find sub-matrix with the given sum in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 11:16:54

1K+ Views

In this problem, we are given a 2D matrix of size N*N and two variables sum and size. Our task is to find a sub-matrix with the given sum.We need to find a sub-matrix of size*size with element sum equal to sum.Let's take an example to understand the problem, Input ... Read More

Find start and ending index of an element in an unsorted array in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 08:48:09

786 Views

In this problem, we are given an array aar[] of n integer values which are not sorted and an integer val. Our task is to find the start and ending index of an element in an unsorted array.For the occurrence of the element in the array, we will return, "Starting ... Read More

Find Square Root under Modulo p (Shanks Tonelli algorithm) in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 08:28:01

400 Views

In this problem, we are given two values n and a prime number p. Our task is to find Square Root under Modulo p.Let's take an example to understand the problem, Input : n = 4, p = 11 Output : 9Solution ApproachHere, we will be using Tonelli-Shanks Algorithm.Tonelli-Shanks Algorithm ... Read More

Find Square Root under Modulo p (When p is in form of 4*i + 3) in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2022 07:46:35

73 Views

In this problem, we are given two values n and a prime number p. Our task is to find Square Root under Modulo p (When p is in form of 4*i + 3). Here, p is of the form (4*i + 3) i.e. p % 4 = 3 for i ... Read More

Find the number of primitive roots modulo prime in C++.

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 13:34:13

518 Views

In this problem, we are given a prime number N. Our task is to find the number of primitive roots modulo prime.Primitive Root of a number − It is a number (r) smaller than N which has all values of r^x(mod N) different for all X in range [0, n-2].Let’s take ... Read More

Find the number of points that have atleast 1 point above, below, left or right of it in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 13:24:34

64 Views

In this problem, we are given N points that lie in a 2D plane. Our task is to find the number of points that have at least 1 point above, below, left or right of it.We need to count all the points that have at least 1 point which satisfies ... Read More

Find the number of operations required to make all array elements Equal in C++

sudhir sharma

sudhir sharma

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

286 Views

In this problem, we are given an array arr of size n. Our task is to Find the number of operations required to make all array elements EqualThe operation is defined as distribution of equal weights from the element with maximum weight to all the elements of the array.If it ... Read More

Find the n-th binary string in sorted order in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 13:09:51

89 Views

In this problem, we are given a positive number of 1. Our task is to find the Nth binary string in sorted order.We need to find the Nth string in an infinite list of strings created using only two symbols a and b sorted in lexicographical order.The list is −a, ... Read More

Find the maximum value permutation of a graph in C++

sudhir sharma

sudhir sharma

Updated on 24-Jan-2022 13:05:33

140 Views

In this problem, we are given a graph of N nodes. Our task is to Find the maximum possible value of the minimum value of the modified array.For the graph we have a permutation of nodes which is the number of induces with minimum 1 node on the left of ... Read More

Advertisements