Arnab Chakraborty has Published 4452 Articles

Program to find out is a point is reachable from the current position through given points in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 11:15:48

203 Views

Suppose in a 2D space a pointer is located at a point p that has coordinates (px, py). Now the pointer has to move to another point q having coordinates (qx, qy). The pointer just cannot move freely, it can travel to q if there are some points located in ... Read More

Program to find out the maximum points collectable in a game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 11:11:56

184 Views

Suppose we are playing a game of cards. We are given several cards arranged linearly with a number on each of them. The numbers on the cards are randomly distributed; and at the beginning and the end of the cards, two cards are inserted with the number 1 on them. ... Read More

Program to find out if we win in a game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 11:09:01

447 Views

Suppose we are playing a two-player game where there are n number of marbles and in each round, a player has to take a positive square number of marbles. If a player can't take that square number of marbles, he/she loses. So, given a number n, we have to find ... Read More

Program to find out the minimum number of intercountry travels in a road trip in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 11:06:24

239 Views

Suppose we have to plan a road trip that involves visiting various cities from different countries. We have a list of roads 'R', where each element is described as (x, y, cost). x signifies the starting city of the road, y signifies the destination city of the road, and cost ... Read More

Program to find out the conversion rate of two currencies in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 11:01:39

185 Views

Suppose we are given three arrays; curr_a, curr_b, and conv_rate. The first array contains some currency names and so does the second one, and the array conv_rate contains the rates of conversion within an item curr_a[i] to cuur_b[i]. The item of conv_rate[i] is the conversion rate between curr_a[i] and curr_b[i]. ... Read More

Program to group the 1s with minimum number of swaps in a given string in Python

Arnab Chakraborty

Arnab Chakraborty

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

238 Views

Suppose we are given a binary string input_str that contains 0s and 1s. Our task is to group the 0s and 1 by swapping the 1s in the given string. We have to perform a minimum number of swap operations, and we have to return that value. One thing to ... Read More

Program to find dot product of run length encoded vectors in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:48:22

233 Views

Suppose we have two lists nums1 and nums2. Each of these two list are representing a vector in run-length encoded form. So as an example, a vector [1, 1, 1, 2, 2, 2, 2] is represented as [3, 1, 4, 2]. (because there are 3 ones and 4 twos). So ... Read More

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

271 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

132 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

96 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

Advertisements