Arnab Chakraborty has Published 4293 Articles

Program to check there is any common reachable node in a graph or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:44:54

346 Views

Suppose we have an edge list of a directed graph, there are n nodes and node names are 0 to n- 1. We also have two integer values a and b. We have to check whether there is any node c such that we can go from c to a ... Read More

Program to find maximum coins we can get from disappearing coins matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:41:14

206 Views

Suppose we have a 2D matrix where each cell matrix[r, c] represents the number of coins present in that cell. When we pick up coins from matrix[r, c], all the coins on row (r - 1) and (r + 1) will disappear, as well as the coins at the two ... Read More

Program to check all tasks can be executed using given server cores or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:36:57

161 Views

Suppose we have two lists, they are cores and tasks. The cores[i] indicates number of cores available in the ith server. And tasks[i] indicates the number of cores needed to execute that task. Each task must be run in only one server. And a server may have multiple tasks to ... Read More

Program to check there is any forward path in circular cyclic list or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:34:29

285 Views

Suppose we have a circular list called nums. So the first and the last elements are neighbors. So starting from any index say i, we can move nums[i] number of steps forward if nums[i] is a positive value, otherwise backwards if it's a negative value. We have to check whether ... Read More

Program to count number of characters in each bracket depth in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:28:57

545 Views

Suppose we have a string s which consists of only three characters "X", "(", and ")". The string has balanced brackets and in between some "X"s are there along with possibly nested brackets may also there recursively. We have to find the number of "X"s at each depth of brackets ... Read More

Program to get final string after shifting characters with given number of positions in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:21:11

668 Views

Suppose we have a lowercase string s and another list of integers called shifts whose length is same as the length of s. Here each element in shifts[i] indicates it to shift the first i + 1 letters of s by shifts[i] positions. If shifting crosses 'z' it will be ... Read More

Program to count number of horizontal brick pattern can be made from set of bricks in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:16:54

265 Views

Suppose we have a list of numbers called bricks and two other values width and height. Each element in bricks[i] represents a brick whose length is bricks[i] units and width is 1 unit. We have to find the number of ways to lay the bricks such that we get full ... Read More

Program to find number of pairs where elements square is within the given range in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:14:18

215 Views

Suppose we have two list of numbers nums1 and nums2. And also have two numbers lower and upper. We have to find the number of pairs (i, j) such that lower ≤ nums1[i]^2 + nums2[j]^2 ≤ upper.So, if the input is like nums1 = [5, 3, 2] nums2 = [8, ... Read More

Program to check whether robot is moving inside a bounded box or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:11:04

289 Views

Suppose we have a string s, that represents the moves of a robot. Robot is currently at (0, 0) position and it is facing north. The move string s may have these characters"F" to move forward direction, one unit"L" to rotate 90 degrees’ left"R" to rotate 90 degrees’ rightSo if ... Read More

Program to find bitwise AND of range of numbers in given range in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:07:42

290 Views

Suppose we have two values start and end, we have to find the bitwise AND of all numbers in the range [start, end] (both inclusive).So, if the input is like start = 8 end = 12, then the output will be 8 is 1000 in binary and 12 is 1100 ... Read More

Advertisements