Arnab Chakraborty has Published 4293 Articles

Kth Smallest Number in Multiplication Table in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:58:51

358 Views

Suppose we know about one Multiplication Table. But could we find out the k-th smallest number quickly from the multiplication table? So if we have to height m and the length n of a m * n Multiplication Table, and one positive integer k, we have need to find the ... Read More

Strange Printer in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:56:58

273 Views

Suppose there is a strange printer It has some requirements −The printer can print only a sequence of the same character each time.In each turn, the printer can print new characters starting from and ending at any places, and will cover the original existing characters.So if we have a string ... Read More

Decode Ways II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:53:28

278 Views

Suppose there is a message, that is containing letters from A-Z is being encoded to numbers using the following mapping way −'A' -> 1, 'B' -> 2, ... , 'Z' -> 26Now, the encoded string can also contain the character '*', which can be treated as one of the numbers ... Read More

Smallest Range Covering Elements from K Lists in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:49:49

287 Views

Suppose we have k lists of sorted integers. We have to search the smallest range that includes at least one number from each of the k lists. Here the range [a, b] is smaller than range [c, d] when b-a < d-c or a < c if b-a == d-c.So ... Read More

K Inverse Pairs Array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:47:00

288 Views

Suppose we have two integers n and k, we have to find how many different arrays consist of numbers from 1 to n such that there are exactly k inverse pairs. The inverse pair is for ith and jth element in the array, if i < j and a[i] > ... Read More

Non-negative Integers without Consecutive Ones in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:42:46

361 Views

Suppose we have a positive integer n. We have to find the non-negative integers less than or equal to n. The constraint is that the binary representation will not contain consecutive ones. So if the input is 7, then the answer will be 5, as binary representation of 5 is ... Read More

Find the Closest Palindrome in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:40:05

248 Views

Suppose we have a number n, we have to get the closest number that is palindrome. So the palindrome could be less than or greater than the number whose absolute difference is smaller. So if the number is like 145, then the result will be 141.To solve this, we will ... Read More

Student Attendance Record II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:37:19

549 Views

Suppose we have a positive integer n, we have to find the number of all possible attendance records with length n, which will be regarded as rewardable. As the answer may be very large, we will return it using mod 109 + 7.In the student attendance record the string can ... Read More

Remove Boxes in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:35:07

203 Views

Suppose we have several boxes with different colors These colors are represented by different positive numbers. We can experience several rounds to remove boxes until there is no box left. In each round we can choose some continuous boxes with the same color (composed of k boxes, k >= 1), ... Read More

Super Washing Machines in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 11:31:06

605 Views

Suppose we have n super washing machines on a row. Initially, each washing machine has some dresses or empty. Now, for each move, we can choose any m (1 ≤ m ≤ n) washing machines, and pass one dress of each washing machine to one of its adjacent washing machines ... Read More

Advertisements