Arnab Chakraborty has Published 4293 Articles

Program to check some elements in matrix forms a cycle or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 06:04:32

216 Views

Suppose we have a 2d matrix. We have to check whether we can start from some cell then move adjacent cells (up, down, left, right) of the same value, and come back to the same starting point. We cannot revisit a cell that we have visited last.So, if the input ... Read More

Program to count how many ways we can cut the matrix into k pieces in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 06:01:58

219 Views

Suppose we have a binary matrix and another value k. You want to split the matrix into k pieces such that each piece contains at least one 1 in it. But there are some rules for cutting, we have to follow in order: 1. Select a direction: vertical or horizontal ... Read More

Program to check whether palindrome can be formed after deleting at most k characters or not in python

Arnab Chakraborty

Arnab Chakraborty

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

591 Views

Suppose we have a string s, we have to check whether we can make this string a palindrome after deleting at most k characters or not.So, if the input is like s = "lieuvrel", k = 4, then the output will be True, we can delete three characters to get ... Read More

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

330 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

682 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

490 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

152 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

866 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

180 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

211 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

Advertisements