Arnab Chakraborty has Published 4293 Articles

Number of Squareful Arrays in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:48:04

307 Views

Suppose we have an array A of positive integers, we can say that array is squareful if for every pair of adjacent elements, their sum is a perfect square. We have to find the number of permutations of A that are squareful. Two permutations A1 and A2 will not be ... Read More

Minimum Number of K Consecutive Bit Flips in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:46:08

247 Views

Suppose we have an array A. This is containing only 0s and 1s, here a K-bit flip consists of choosing a (contiguous) subarray of length K and simultaneously inverting the bits n the subarray. We have to find the minimum number of K-bit flips required so that there is no ... Read More

Subarrays with K Different Integers in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:44:29

255 Views

Suppose we have an array A of positive integers, we can call a good subarray (contiguous) of A, if the number of different integers in that subarray is exactly K. So, if the array is like [1, 2, 3, 1, 2] has 3 different integers: 1, 2, and 3. We ... Read More

Triples with Bitwise AND Equal To Zero in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:42:28

187 Views

Suppose we have an array of integers A. We have to find the number of triples of indices (i, j, k) such that −0

Equal Rational Numbers in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:41:00

213 Views

Suppose we have two strings, these are S and T, each of which represents a positive rational number, We have to check whether they represent the same number or now. The strings may use parentheses to denote the repeating part of the rational number.As we know that rational numbers can ... Read More

Least Operators to Express Number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:39:20

329 Views

Suppose we have a positive integer x, we will write an expression of the form x (op1) x (op2) x (op3) x ... where op1, op2, etc. are the operators. And these operators can be either addition, subtraction, multiplication, or division. For example, with x = 3, we might write ... Read More

Delete Columns to Make Sorted III in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:35:03

240 Views

Suppose we have an array A of N strings. Each string is consists of lowercase letters, all are of same length. Now, we can choose any set of deletion indices, and for each string, we will delete all the characters in those indices.Now consider we have taken a set of ... Read More

Tallest Billboard in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:31:45

154 Views

Suppose we are installing a billboard and we want it to have the largest height. The billboard will have two steel supports on both sides. Each support must be of equal height. We also have a collection of rods which can be welded together. So, if we have rods of ... Read More

Largest Component Size by Common Factor in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:29:07

177 Views

Suppose we have an array A of unique positive integers, now consider the following graph −There are length of A number of nodes, these are labelled A[0] to A[size of A - 1]; There is an edge between A[i] and A[j] when A[i] and A[j] share a common factor greater ... Read More

Find the Shortest Superstring in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jun-2020 09:21:39

389 Views

Suppose we have an array A of strings, we have to find any smallest string that contains each string in A as a substring. We can also assume that no string in A is substring of another string in A.So, if the input is like ["dbsh", "dsbbhs", "hdsb", "ssdb", "bshdbsd"], ... Read More

Advertisements