Arnab Chakraborty has Published 4293 Articles

Smallest Sufficient Team in Pyhton

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 11:20:34

334 Views

Suppose for a project we have a list of required skills called req_skills, and a list of people. Here i-th people people[i] contains a list of skills that person has.Now suppose a sufficient team is defined as a set of people such that for every required skill in req_skills, there ... Read More

Parsing A Boolean Expression in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 11:18:09

1K+ Views

Suppose we have a boolean expression, we have to find the result after evaluating that expression.An expression can either be −"t", evaluating to True;"f", evaluating to False;"!(expression)", evaluating to the logical NOT of the inner expression;"&(expr1, expr2, ...)", evaluating to the logical AND of 2 or more inner expressions;"|(expr1, expr2, ... Read More

Shortest Common Supersequence in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 11:14:39

206 Views

Suppose we have two strings str1 and str2, we have to find the shortest string that has both str1 and str2 as subsequences. There may be more than one results, so we will return only one of them.As you know a string S is called a subsequence of string T ... Read More

Number of Submatrices That Sum to Target in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 11:09:58

230 Views

Suppose we have a matrix, and a target value, we have to find the number of non-empty submatrices that sum is same as target. Here a submatrix [(x1, y1), (x2, y2)] is the set of all cells matrix[x][y] with x in range x1 and x2 and y in range y1 ... Read More

Longest Duplicate Substring in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 11:06:27

658 Views

Suppose we have a string S, consider all duplicated contiguous substrings that occur 2 or more times. (The occurrences may overlap.), We have to find the duplicated substring that has the longest possible length. If there is no such substrings, then return a blank string. As the answer may very ... Read More

Escape a Large Maze Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 11:00:48

430 Views

Suppose we have a grid, there are 1 million rows and 1 million columns, we also have one list of blocked cells. Now we will start at the source square and want to reach the target square. In each move, we can walk to a up, down, left, right adjacent ... Read More

Stream of Characters in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 10:58:38

604 Views

Suppose we want to implement the StreamChecker class as follows −StreamChecker(words) − This is the constructor, this initializes the data structure with the given words.query(letter) − This returns true when for some k >= 1, the last k characters queried (in order from oldest to newest, including this letter just ... Read More

Numbers With Repeated Digits in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 10:53:46

683 Views

Suppose we have a positive integer N, we have to find the number of positive integers less than or equal to N that have at least 1 repeated digit .So, if the input is like 99, then the output will be 9, as we have numbers like 11, 22, 33, ... Read More

Grid Illumination in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 10:49:36

456 Views

Suppose we have a N x N grid of cells, in each cell (x, y) there is a lamp. Initially, some of the lamps are on. The lamps[i] is the location of the i-th lamp that is on. Each lamp that is on glows every square on its x-axis, y-axis, ... Read More

Minimum Cost to Merge Stones in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:52:30

633 Views

Suppose we have N piles of stones arranged in a row. Here the i-th pile has stones[i] number of stones. A move consists of merging K consecutive piles into one pile, now the cost of this move is equal to the total number of stones in these K number of ... Read More

Advertisements