Arnab Chakraborty has Published 3734 Articles

The k-th Lexicographical String of All Happy Strings of Length n in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:56:29

264 Views

Suppose we have a string. We will call that a happy string when it consists of only ['a', 'b', 'c'] letters, and s[i] != s[i + 1] for all values of i from 1 to length of s - 1 (here the string is 1-indexed).So, if we have two integers ... Read More

Find the Minimum Number of Fibonacci Numbers Whose Sum Is K in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:54:40

509 Views

Suppose we have a number k, we have to find the minimum number of Fibonacci numbers whose sum is equal to the k, whether a Fibonacci number could be used multiple times.So, if the input is like k = 7, then the output will be 2, as the Fibonacci numbers ... Read More

HTML Entity Parser in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:53:33

807 Views

Suppose we have a string; we have to design one HTML parser that will replace the special character of HTML syntax into normal character. The HTML entity parser is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself. ... Read More

Queries on a Permutation With Key in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:48:54

220 Views

Suppose we have an array queries of positive integers between 1 and m, we have to process all queries, queries[i] (from i=0 to n, n is the size of queries - 1) according to the following rules −At the beginning, we have the permutation P=[1, 2, 3, ..., m].For the ... Read More

Longest Happy String in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:46:48

761 Views

Suppose there is a string. That string is called happy if it does not have any of the strings like 'aaa', 'bbb' or 'ccc' as a substring. If we have three integers like a, b and c, then return any string s, which satisfies the following conditions −s is happy ... Read More

Number of Steps to Reduce a Number in Binary Representation to One in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:42:40

287 Views

Suppose we have a number s in binary form. We have to find the number of steps to reduce it to 1 under these rules −If the current number is even, we have to divide it by 2.If the current number is odd, you have to add 1 to it.So, ... Read More

Circle and Rectangle Overlapping in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:38:38

508 Views

Suppose we have a circle represented as (radius, xc, yc), here (xc, yc) is the center coordinate of the circle. We also have an axis-aligned rectangle represented as (x1, y1, x2, y2), where (x1, y1) are the coordinates of the bottom-left corner, and (x2, y2) are the coordinates of the ... Read More

Count Number of Teams in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:36:52

376 Views

Suppose there are n soldiers standing in a line. Here each soldier is assigned a unique rating value. We have to make a team of 3 soldiers amongst them using the following rules −Choose 3 soldiers with index (i, j, k) such that the rating (rating[i], rating[j], rating[k]).A team will ... Read More

Construct K Palindrome Strings in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:33:09

258 Views

Suppose we have a string s and a number k. We have to construct k non-empty palindrome strings using all the characters in s. So here we have to check whether we can use all the characters in s to construct k palindrome strings or not.So, if the input is ... Read More

01 Matrix in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:28:52

311 Views

Suppose we have a matrix consists of 0 and 1, we have to find the distance of the nearest 0 for each cell. Here the distance between two adjacent cells is 1.So, if the input is like000010111then the output will be000010121To solve this, we will follow these steps −Define an ... Read More

Advertisements