Arnab Chakraborty has Published 4293 Articles

Program to find minimum cost to connect each Cartesian coordinates in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 11:53:51

259 Views

Suppose we have a list of 2D Cartesian coordinate points (x, y). We can connect (x0, y0) and (x1, y1), whose cost is |x0 - x1| + |y0 - y1|. If we are allowed to connect any number of points, we have to find the minimum cost necessary such that ... Read More

Program to sort all elements in a given list and merge them into a string in Python

Arnab Chakraborty

Arnab Chakraborty

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

253 Views

Suppose we are given a list of positive integers. We have to sort the list in descending order and then have to join all the elements in it to form a string. We return the joined string.So, if the input is like input = [415, 78, 954, 123, 5], then ... Read More

Program to find a path a continuous path in a rectangular area without engaging a bomb in Python

Arnab Chakraborty

Arnab Chakraborty

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

319 Views

Suppose we are given an array mat where the elements are of this form [p, q, r] where p, q are geometric coordinates and r is a radius value. The items in the array are the locations of bombs in a rectangular area of a given width w. The rectangle ... Read More

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

351 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

264 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

604 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

326 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

259 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

322 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

418 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

Advertisements