Arnab Chakraborty has Published 4452 Articles

Check if it is possible to return to the starting position after moving in the given directions in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:33:52

123 Views

Suppose we are at position (0, 0) We have a string represents consecutive directions using four letters. We have to check whether we can return at (0, 0) position after considering all of the given directions. The symbols areE for eastW for westN for northS for south.So, if the input ... Read More

Check if it is possible to rearrange rectangles in a non-ascending order of breadths in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:31:43

72 Views

Suppose we have a list of rectangles represented using its length and breadth. We can rotate any rectangle by 90 degrees so after rotating, the breadth will become length and vice-versa. We have to check whether we can sort the rectangles in non-increasing order of breadth.So, if the input is ... Read More

Check if it is possible to rearrange a binary string with alternate 0s and 1s in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:28:09

285 Views

Suppose we have a binary string s whose length is 2 or more. We have to check whether we can rearrange s such that there are alternate 0s and 1s.So, if the input is like s = "1000111", then the output will be True as we can form "1010101" from ... Read More

Check if it is possible to reach vector B by rotating vector A and adding vector C to its in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:26:15

41 Views

Suppose we have three vectors x, y and z in 2D plane. We have to check whether we can get vector y from vector x by rotating it 90 degrees(clockwise) or adding z with it any number of times as required.So, if the input is like x = (-4, -2) ... Read More

Check if it is possible to reach a number by making jumps of two given length in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:20:25

52 Views

Suppose we are at starting position p, we can jump at any direction (left or right) d1 and d2 units. We have to find minimum number of steps required to reach at position q by jumping from p.So, if the input is like p = 5, q = 10, d1 ... Read More

Check if it is possible to move from (0, 0) to (x, y) in N steps in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:18:19

192 Views

Suppose we have a coordinate point (x, y) and another value n. We have to check whether we can move from (0, 0) to (x, y) using n steps or not. We can move any of the four directions left, right, up and down.So, if the input is like p ... Read More

Check if it is possible to make two matrices strictly increasing by swapping corresponding values only in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:17:14

71 Views

Suppose we have two matrices of size n x m named mat1 and mat2. We have to check where these two matrices are strictly increasing or not by swapping only two elements in different matrices only when they are at position (i, j) in both matrices.So, if the input is ... Read More

Check if it is possible to get back to 12 O-clock only by adding or subtracting given seconds in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:12:17

57 Views

Suppose we have an array of n different second values. We have to check whether it is possible to start from 12'O clock and go back to 12 by only adding or subtracting the given seconds or not. We can use all given seconds exactly once, we can either add ... Read More

Check if it is possible to form string B from A under the given constraint in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:10:50

68 Views

Suppose we have two strings s and t, and two values p and q. We have to check whether it is possible to get t from s such that s is separated into groups of p number of characters except the last group which will have characters ≤ p and ... Read More

Check if it is possible to draw a straight line with the given direction cosines in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:08:58

159 Views

Suppose we have three direction cosines l, m and n in 3-D space, we have to check whether it is possible to draw a straight line with these direction cosines or not.So, if the input is like l = 0.42426 m = 0.56568 n = 0.7071, then the output will ... Read More

Advertisements