Arnab Chakraborty has Published 4293 Articles

Find the largest area rectangular sub-matrix whose sum is equal to k in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 07:25:23

290 Views

Suppose we have a 2D matrix mat and a value K, we have to find the longest rectangular submatrix whose sum is same as K.So, if the input is like28-56-778-311-1443-43110And K = 9then the output will be Top-Left point is (1, 0) and Bottom-Right point is (3, 2).-77811-144-431To solve this, ... Read More

Find the index which is the last to be reduced to zero after performing a given operation in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:52:28

160 Views

Suppose we have an array A with n numbers and another input K, we have to find the index which will be the last to be reduced to zero after performing a given operation. The operation is explained as follows −Starting from A[0] to A[N – 1], update each element ... Read More

Find the element that appears once in an array where every other element appears twice in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:49:35

388 Views

Suppose we have an array A. In this array there are different numbers that occurs twice. But there is only one number that occurs once. We have to find that element from that array.Suppose A = [1, 1, 5, 3, 2, 5, 2], then the output will be 3. As ... Read More

Find the element having different frequency than other array elements in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:48:28

183 Views

Suppose we have an array of N numbers, where each element in the array appears same number of times (m times, this is also given) except one element, We have to find this element.So, if the input is like A = [6, 2, 7, 2, 2, 6, 6], m = ... Read More

Find the element before which all the elements are smaller than it, and after which all are greater in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:47:51

492 Views

Suppose we have an array, we have to find an element before which all elements are less than it, and after which all are greater than it. Finally, return the index of the element, if there is no such element, then return -1.So, if the input is like A - ... Read More

Find the distance covered to collect items at equal distances in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:45:08

112 Views

Suppose one race is going to be organized. Where different stones are placed on a road. One bucket is present at the starting point of the race, this is 6 units away from the first stone. The other stones are 4 units apart from each other and lie straight in ... Read More

Find the direction from given string in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:43:42

702 Views

Suppose we have a string which contains only L and R, this denotes left rotation and right rotation respectively, we have to find the final direction of pivot. Here directions are north(N), east(E), south(S) and west(W). We are assuming that the pivot is pointed towards north(N) in a compass.So, if ... Read More

Find the count of sub-strings whose characters can be rearranged to form the given word in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:41:47

270 Views

Suppose we have a string S (all letters are in lowercase), we have to find the count of all of the sub-strings of length four whose characters can be rearranged to form this word "bird".So, if the input is like "birdb", then the output will be 2.To solve this, we ... Read More

Find the count of palindromic sub-string of a string in its sorted form in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:39:50

207 Views

Suppose we have a string of lowercase characters (all are ASCII characters), we have to find all distinct continuous palindromic sub-strings of the given string.So, if the input is like "level", then the output will be 7 as there are seven substrings ['level', 'eve', 'l', 'e', 'v', 'e', 'l'].To solve ... Read More

Find the cordinates of the fourth vertex of a rectangle with given 3 vertices in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:38:04

749 Views

Suppose we have a grid of size Q * P, this grid contains exactly three asterisk '*' and every other cell there is dot '.', where '*' is for a vertex of a rectangle. We have to find the coordinates of the missing vertex. Here we will consider 1-based indexing.So, ... Read More

Advertisements