Arnab Chakraborty has Published 4293 Articles

Longest Uncommon Subsequence I in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Jun-2020 13:04:06

212 Views

Suppose we have two strings; we have to find the longest uncommon subsequence of these two strings. The longest uncommon subsequence is actually the longest subsequence of one string and this subsequence should not come in the other string. So, we have to find the length of the longest uncommon ... Read More

Perfect Number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Jun-2020 13:02:54

2K+ Views

Suppose we have to check whether a given number is perfect number or not. A number is said to be a Perfect Number when that is equal to the sum of all its positive divisors except itself. The number n will be in range 1^8.So, if the input is like ... Read More

Relative Ranks in C++

Arnab Chakraborty

Arnab Chakraborty

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

211 Views

Suppose we have a list of scores of N athletes, we have to find their relative ranks and the people with the top three highest scores, who will be different medals: "Gold", "Silver" and "Bronze".So, if the input is like [2, 5, 3, 1, 0], then the output will be ... Read More

Keyboard Row in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Jun-2020 12:59:16

273 Views

Given a list of words, we have to find those words that can be typed using letters of the alphabet on only one row's of standard keyboard layout.So, if the input is like ["hello", "world", "mom", "dad", "try", "type", "tom"], then the output will be ["dad", "try", "type"]To solve this, ... Read More

Construct the Rectangle in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Jun-2020 12:56:33

339 Views

Suppose we have a specific rectangular web page area, our job is to design a rectangular web page, whose length L and width W that satisfies the following requirements −The area of the web page must equal to the given target area.The width W should not be larger than the ... Read More

Heaters in Python

Arnab Chakraborty

Arnab Chakraborty

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

306 Views

Suppose we have to design a standard heater with a fixed warm radius to warm all the houses. Now, we have given positions of houses and heaters on a horizontal line, we have to find the minimum radius of heaters so that all houses could be covered by those heaters. ... Read More

Minimum Moves to Equal Array Elements in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Jun-2020 12:52:24

2K+ Views

Suppose we have an array of size n, we have to find the minimum number of moves required to make all array elements the same, where a move means incrementing n - 1 elements by 1.So, if the input is like [3, 2, 3, 4], then the output will be ... Read More

Number of Boomerangs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Jun-2020 12:49:17

360 Views

Suppose we have n points in the plane that are all pairwise distinct. Now a "boomerang" is a tuple of points like (i, j, k) such that the distance between i and j is the same as the distance between i and k. We have to find the number of ... Read More

Number of Segments in a String in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Jun-2020 12:45:28

558 Views

Suppose we have a string s. We have to count the number of segments in a string, where a segment is defined to be a contiguous sequence of characters (no whitespace).So, if the input is like "Hello, I love programming", then the output will be 4, as there are 4 ... Read More

Third Maximum Number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Jun-2020 12:43:44

419 Views

Suppose we have a non-empty array of integers; we have to find the third maximum number in this array. If there is no 3rd max number, then return the maximum one. The challenge is, we have to solve this using linear time complexity.So, if the input is like [5, 3, ... Read More

Advertisements