Arnab Chakraborty has Published 4452 Articles

Program to create largest lexicographic number from a list of numbers in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:57:20

253 Views

Suppose we have a list of numbers called nums, we have to rearrange its order to form the largest possible number and return that as a string.So, if the input is like nums = [20, 8, 85, 316], then the output will be "88531620".To solve this, we will follow these ... Read More

Program to find maximum possible population of all the cities in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:54:46

500 Views

Consider a country that is represented as a tree with N nodes and N-1 edges. Now each node represents a town, and each edge represents a road. We have two lists of numbers source and dest of size N-1. According to them the i-th road connects source[i] to dest[i]. And ... Read More

Program to count subsets that sum up to k in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:53:12

358 Views

Suppose we have a list of numbers called nums and another value k, we have to find the number of subsets in the list that sum up to k. If the answer is very large then mod this with 10^9 + 7So, if the input is like nums = [2, ... Read More

Program to count number of operations to convert binary matrix to zero matrix in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:52:05

81 Views

Suppose we have a binary matrix. Now consider an operation where we take one cell and flip it and all its neighboring cells (up, down, left, right). We have to find the minimum number of operations required such that matrix contains only 0s. If there is no solution, then return ... Read More

Program to check given point in inside or boundary of given polygon or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:49:15

739 Views

Suppose we have a list of cartesian points [(x1, y1), (x2, y2), ..., (xn, yn)], that is representing a polygon, and also have two values x and y, we have to check whether (x, y) lies inside this polygon or on the boundary.So, if the input is like points = ... Read More

Program to find length of longest circular increasing subsequence in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:44:58

122 Views

Suppose we have a list of numbers called nums, we have to find the length of the longest increasing subsequence and we are assuming the subsequence can wrap around to the beginning of the list.So, if the input is like nums = [6, 5, 8, 2, 3, 4], then the ... Read More

Program to check how many ways we can choose empty cells of a matrix in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:43:06

135 Views

Suppose we have a N x N binary matrix where 0 is for empty cells and 1 is a blocked cells, we have to find the number of ways to choose N empty cells such that every row and every column has at least one chosen cells. If the answer ... Read More

Program to find minimum number of roads we have to make to reach any city from first one in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:41:15

613 Views

Suppose we have two lists costs_from and costs_to of same size where each index i represents a city. It is making a one-way road from city i to j and their costs are costs_from[i] + costs_to[j]. We also have a list of edges where each edge contains [x, y] indicates ... Read More

Program to find minimum number of buses required to reach final target in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:38:42

218 Views

Suppose we have a n x 3 matrix where each row contains three fields [src, dest, id] this means the bus has route from src to dest. It takes one unit of money to get on a new bus, but if we stay on the same bus we have to ... Read More

Program to evaluate one mathematical expression without built-in functions in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:37:08

2K+ Views

Suppose we have a string that represents a mathematical expression with (+, -, *, /) Here / is representing integer division, we have to evaluate and return the result without using any built-in function.So, if the input is like s = "2+3*5/7", then the output will be 4, as 2 ... Read More

Advertisements