Arnab Chakraborty has Published 4293 Articles

Walking Robot Simulation in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:19:23

1K+ Views

Suppose there is a robot on an infinite grid that starts at point (0, 0). It is facing towards north direction. Now the robot can receive one of three possible types of commands −-2 to turn left 90 degrees-1 to turn right 90 degreesany value from 1 to 9 to ... Read More

Binary Gap in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:17:08

2K+ Views

Suppose we have a positive integer N, we have to find the longest distance between two consecutive 1's in the binary representation of N. If there are no two-consecutive 1's, then return 0.So, if the input is like 22, then the output will be 2, as 22 in binary is ... Read More

Lemonade Change in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:16:30

777 Views

Suppose there is a lemonade stand, each lemonade costs $5. Now customers are standing in a queue to buy from the store, and order one at a time.Each customer can buy only one lemonade and pay with either a $5, $10, or $20 bill. We have to must provide the ... Read More

Buddy Strings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:13:42

681 Views

Suppose we have two strings A and B of lowercase letters; we have to check whether we can swap two letters in A so that the result equals to B or not.So, if the input is like A = "ba", B = "ab", then the output will be True.To solve ... Read More

Magic Squares In Grid in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:12:01

395 Views

Suppose we have a grid we have to find the number of magic square sub-grid into that grid. A magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diagonals all have the same sum.So, if the ... Read More

Rectangle Overlap in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:10:13

5K+ Views

Suppose there is a rectangle that is represented as a list [x1, y1, x2, y2], where (x1, y1) is the coordinates of its bottom-left corner, and (x2, y2) is the coordinates of its top-right corner. Now two rectangles overlap if the area of their intersection is positive. So, we can ... Read More

Flipping an Image in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:08:07

579 Views

Suppose we have a binary matrix A, this is the representation of an image, we want to flip the image horizontally, after that invert it, and finally return the resulting image. To flip the image horizontally each row of the image will be reversed. And to invert the image each ... Read More

Positions of Large Groups in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:07:04

232 Views

Suppose there is a string S of lowercase letters, these letters form consecutive groups of the same character. So, when a string like S is like "abbxxxxzyy" has the groups "a", "bb", "xxxx", "z" and "yy". A group will be a large group when it has 3 or more characters. ... Read More

Largest Triangle Area in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:05:57

698 Views

Suppose we have a list of points on a plane. We have to find the area of the largest triangle that can be formed by any 3 of the points.So, if the input is like [[0, 0], [0, 1], [1, 0], [0, 2], [2, 0]], then the output will be ... Read More

Number of Lines To Write String in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:04:30

488 Views

Suppose we have a string S and we have to write the letters of that given string, from left to right into lines. Here each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, that will be ... Read More

Advertisements