Arnab Chakraborty has Published 4293 Articles

Confusing Number II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:07:05

878 Views

Suppose we have a digit, now if we rotate that digit by 180 degrees to form new digits. When 0, 1, 6, 8, 9 are rotated 180 degrees, they become 0, 1, 9, 8, 6 respectively. But when 2, 3, 4, 5 and 7 are rotated 180 degrees, they become ... Read More

Digit Count in Range

Arnab Chakraborty

Arnab Chakraborty

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

1K+ Views

Suppose we have an integer d between 0 and 9, we also have two positive integers low and high as lower and upper bounds, respectively. We have to find the number of times that d occurs as a digit in all integers between low and high, including the bounds low ... Read More

Number of Valid Subarrays in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 12:00:02

464 Views

Suppose we have an array A of integers, we have to find the number of non-empty continuous subarrays that satisfy this condition: The leftmost element of the subarray is not larger than other elements in the subarray.So, if the input is like [1, 4, 2, 5, 3], then the output ... Read More

Minimize Max Distance to Gas Station in C++

Arnab Chakraborty

Arnab Chakraborty

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

1K+ Views

Suppose we have one horizontal number line. On that number line, we have gas stations at positions stations[0], stations[1], ..., stations[N-1], where N = size of the stations array. Now, we add K more gas stations so that D, the maximum distance between adjacent gas stations, is minimized. We have ... Read More

Basic Calculator III in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 11:55:18

835 Views

Suppose we have a simple expression string and we have to Implement a basic calculator to evaluate that expression. The expression string may contain opening and closing parentheses, the plus + or minus sign -, non-negative integers and empty spaces. The expression string contains only non-negative integers, +, -, *, ... Read More

Employee Free Time in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 11:52:29

546 Views

Suppose we have given a list of schedules of employees; this represents the working time for each employee. Now suppose each employee has a list of non-overlapping Intervals, these intervals are sorted. We have to find the list of finite intervals representing the common, positive-length free time for all employees, ... Read More

Minimum Window Subsequence in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 11:49:46

1K+ Views

Suppose we have two strings S and T, we have to find the minimum substring W of S, so that T is a subsequence of W. If there is no such window in S that covers all characters in T, then return empty string. If there are multiple such windows, ... Read More

Number of Distinct Islands II in C++

Arnab Chakraborty

Arnab Chakraborty

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

468 Views

Suppose we have a non-empty 2D binary array called grid, here an island is a group of 1's (representing land) connected 4-directionally. We can also assume all four edges of the grid are surrounded by water.We have to count the number of distinct islands. An island is considered to be ... Read More

K Empty Slots in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 11:44:22

388 Views

Suppose we have N bulbs in a row and they are numbered from 1 to N. At first, all the bulbs are off. We can turn on exactly one bulb everyday until all bulbs are on after N days. If we have an array bulbs of length N where bulbs[i] ... Read More

Remove 9 in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Jul-2020 11:42:01

243 Views

Suppose we have an integer n, we have to return nth integer after following this operation: Start from integer 1, remove any integer that contains 9 such as 9, 19, 29... So now, we will have a new integer sequence like 1, 2, 3, 4, 5, 6, 7, 8, 10, ... Read More

Advertisements