Arnab Chakraborty has Published 4293 Articles

Strong Password Checker in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 10:53:31

5K+ Views

Suppose we have a string, password. We have to find out minimum changes required to make the password strong. So the password has some following criteria −It must be at least 6 character long and at most 20-character longIt must contain at least one lowercase letter, at least one uppercase ... Read More

Split Array Largest Sum in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 10:49:28

411 Views

Suppose we have an array of positive integers and one value m. We can divide this array into m number of contiguous subarrays. We have to devise an algorithm to minimize the largest sum among these m subarrays.So if the array is say [7, 2, 4, 10, 9], and m ... Read More

Frog Jump in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 10:47:29

2K+ Views

Suppose there is a frog that is crossing a river. The river is divided into x units and at each unit there may be a stone. The frog can jump on a stone, but not water. Here we have a list of stones' positions in sorted ascending order sequence, we ... Read More

Insert Delete GetRandom O(1) - Duplicates allowed in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 10:46:13

164 Views

Suppose, we want to make a data structure, that supports some operations, these operations must be preformed in O(1) amount of time. So let these operations are like −insert(x): insert x into the collectionremove(x): delete x from the collectiongetRandom(): This will find random element form that collection.To solve this, we ... Read More

Max Sum of Rectangle No Larger Than K in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 10:43:20

149 Views

Suppose we have a 2D matrix, and an integer k. We have to find the max sum of a rectangle in the matrix, such that its sum is not greater than k. So, if the input is like −1010-32And k = 3, then the output will be 3, as the ... Read More

Russian Doll Envelopes in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 10:40:55

537 Views

Suppose we have some envelops, these envelops has height and width values as pairs. We can put one envelop into another one if the height and width of second envelop both are smaller than the height and width of the first one. So, what will be the maximum number of ... Read More

Count of Range Sum in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 10:38:21

624 Views

Suppose we have an integer array nums, we have to find the number of range sums that lie in range [lower, upper] both inclusive. The range sum S(i, j) is defined as the sum of the elements in nums from index i to index j where i ≤ j.So if ... Read More

Create Maximum Number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Jun-2020 10:35:46

244 Views

Suppose we have two arrays of length m and n with digits 0-9 representing two numbers. We have to create the maximum number of length k that is less than m + n from digits of the two. We have to keep in mind that the relative order of the ... Read More

Data Stream as Disjoint Intervals in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 06:27:14

239 Views

Suppose we have a data stream input of integers, these are like a1, a2, ..., an, ..., we have to summarize the numbers seen so far as a list of disjoint intervals. For example, suppose the input integers are 1, 3, 8, 2, 7, ..., then the summary will be ... Read More

Self Crossing in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 06:14:58

290 Views

Suppose we have an array x of n numbers. We start at point (0, 0) and moves x[0] units to the north direction, then x[1] units to the west direction, x[2] units to the south direction , x[3] units to the east direction and so on. In other words, after ... Read More

Advertisements