Arnab Chakraborty has Published 4293 Articles

Handshakes That Don't Cross in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:48:50

326 Views

Suppose we have an even number of people n that stand around a circle and each person shakes hands with someone else, so that there will be n / 2 handshakes total. We have to find the number of ways these handshakes could occur such that none of the handshakes ... Read More

Palindrome Removal on C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:46:04

340 Views

Suppose we have an integer array called arr, now in one move we can select a palindromic subarray from index i to j where i

Divide Chocolate in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:43:46

384 Views

Suppose we have one chocolate bar that consists of some chunks. In each chunk it has its own sweetness given by a list called sweetness. If we want to share the chocolate among K friends so we start cutting the chocolate bar into K+1 piece using K cuts, now each ... Read More

Valid Palindrome III in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:40:52

479 Views

Suppose we have a string s and another number k; we have to check whether the given string is a K-Palindrome or not.A string is said to be K-Palindrome if it can be transformed into a palindrome by removing at most k characters from it.So, if the input is like ... Read More

Minimum Time to Build Blocks in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:38:21

194 Views

Suppose we have a list of blocks, if we have blocks[i] = t, this means that the i-th block needs t units of time to be built. A block can only be built by exactly one worker. Single worker can either split into two workers or build a block then ... Read More

Maximum Number of Ones in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:36:39

145 Views

Suppose we have a matrix M with dimensions w x h, such that every cell has value 0 or 1, and any square sub-matrix of M of size l x l has at most maxOnes number of ones. We have to find the maximum possible number of ones that the ... Read More

Optimize Water Distribution in a Village in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:34:17

712 Views

Suppose there are n houses in a village. We have to supply water for all the houses by building wells and laying pipes. For each house i, we can either build a well inside it, the building cost will be wells[i], or pipe in water from another well to it. ... Read More

String Transforms Into Another String in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:27:51

1K+ Views

Suppose we have two strings str1 and str2. And their lengths are same, we have to check whether we can transform str1 into str2 by doing zero or more conversions.In one conversion we can convert all occurrences of one character in str1 to any other lowercase English character. We have ... Read More

Parallel Courses in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:21:33

251 Views

Suppose there are N courses, and these are labelled from 1 to N. We also gave a relation array, where relations[i] = [X, Y], is representing a prerequisite relationship between course X and course Y. So, this means course X has to be studied before course Y.In one semester we ... Read More

Divide Array Into Increasing Sequences in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:12:47

241 Views

Suppose we have a non-decreasing array of positive integers called nums and an integer K, we have to find out if this array can be divided into one or more number of disjoint increasing subsequences of length at least K.So, if the input is like nums = [1, 2, 2, ... Read More

Advertisements