Arnab Chakraborty has Published 4293 Articles

Before and After Puzzle in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 16:18:40

160 Views

Suppose we have a list of phrases, generate a list of Before and After puzzles. Here a phrase is a string that consists of lowercase letters and spaces only. No space will be there at the starting and ending positions. There are no consecutive spaces in a phrase.The before and ... Read More

Convex Polygon in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 16:12:32

2K+ Views

Suppose we have a list of points that form a polygon when joined sequentially, we have to find if this polygon is convex (Convex polygon definition). We have to keep in mind that there are at least 3 and at most 10, 000 points. And the coordinates are in the ... Read More

Validate IP Address in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 16:08:17

2K+ Views

Suppose we have a string; we have to check whether the given input is a valid IPv4 address or IPv6 address or neither.The IPv4 addresses are canonically represented in dotted-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots ("."), For example, 192.168.254.1; ... Read More

Unique Substrings in Wraparound String in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 16:04:17

259 Views

Suppose we have the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so the value s will look like this − "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".Now we have another string p. Our job is to find out how many unique non-empty substrings of p are present in s. In particular, our input ... Read More

Can I Win in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 16:01:45

269 Views

Suppose in a game called "100 games, " two players take turns adding, to a running total, any integer from 1 through 10. The player who first causes the running total to reach or exceed 100, he/she wins. So what if we change the game so that players cannot re-use ... Read More

Ternary Expression Parser in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 15:19:24

603 Views

Suppose we have a string representing arbitrarily nested ternary expressions, we have to calculate the result of the expression. we can always assume that the given expression is valid and only consists of digits 0-9, ?, :, T and F these few characters. (Here T and F represent True and ... Read More

Find Right Interval in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 15:13:23

416 Views

Suppose we have a of intervals, for each of the interval i, check whether there exists an interval j whose start point is bigger than or equal to the endpoint of the interval i, which can be called that j is on the "right" of i. For any interval i, ... Read More

Sentence Screen Fitting in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 15:09:43

206 Views

Suppose we have a rows x cols screen and a sentence represented by a list of non-empty words, so we have to find how many times the given sentence can be fitted on the screen. There are certain properties −A word will not be split into two lines.The order of ... Read More

Remove K Digits in C++ program

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 15:03:15

308 Views

Suppose we have a sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. So for example, these are arithmetic sequence: [1, 3, 5, 7, 9], [7, 7, 7, 7], [3, -1, -5, -9], ... Read More

Nth Digit in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Apr-2020 14:55:52

1K+ Views

Suppose we have one infinite integer sequence, we have to find the nth digit of this sequence. So if the input is 11, then the output will be 0 as if we place the numbers like 123456789101112, so the 11th digit is 0.To solve this, we will follow these steps ... Read More

Advertisements