Arnab Chakraborty has Published 4293 Articles

Patching Array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 06:12:24

375 Views

Suppose we have an array nums and one number. We can add elements in the array, such that any number in range [1, n] (both are inclusive) can be formed by the sum of some elements in the array. We have to find the minimum number of required patches. So ... Read More

Remove Duplicate Letters in C++

Arnab Chakraborty

Arnab Chakraborty

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

193 Views

Suppose we have a string consisting of only lowercase letters. We have to remove all duplicate letters such that all letters only occur once. And we have to display the result in the smallest lexicographic sequence. So if the input is like “abccb”, then the result will be “abc”To solve ... Read More

Count of Smaller Numbers After Self in C++

Arnab Chakraborty

Arnab Chakraborty

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

388 Views

Suppose we have an array nums, we have to find another array called count, in this count array, the count[i] stores the number of smaller elements to the right of nums[i].So if the input is like: [5, 2, 7, 1], then the result will be [2, 1, 1, 0].To solve ... Read More

Burst Balloons in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 06:00:28

456 Views

Suppose we have n balloons, these are indexed from 0 to n-1. Here each balloon is painted with a number on it represented by one array called nums. we have to burst all the balloons. If we burst balloon i we will get nums[i – 1] * nums[i] * nums[i ... Read More

Remove Invalid Parentheses in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 05:56:46

363 Views

Suppose we have a string of parentheses. We have to remove minimum number of invalid parentheses and return the well formed parentheses strings, So if the input is like “()(()()”, so the result will be [“()()()”, “()(())”]To solve this, we will follow these steps −Define a method called solve(), this ... Read More

Find Median from Data Stream in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 05:49:50

458 Views

Suppose we have a data stream, in that stream some data element may come and join, we have to make one system, that will help to find the median from the data. As we know that the median is the middle data of a sorted list, if it list length ... Read More

Expression Add Operators in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 05:46:17

311 Views

Suppose we have a string that holds only digits from 0 to 9. And one target value is given. We have to return all possibilities to add binary operators +, - and * into the digits to get the target values. So if the input is like “232” and the ... Read More

Sliding Window Maximum in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 05:36:18

805 Views

Suppose we have an array called nums, there is a sliding window of size k which is moving from the left of the array to the right. We can only see the k numbers in the window. Each time the sliding window moves to the right side by one position. ... Read More

Number of Digit One in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-May-2020 05:32:06

424 Views

Suppose we have a number n, We have to count the total number of digit 1 appearing in all non-negative numbers less than or equal to n. So if the input is 15, then the output will be 8, because the numbers containing 1 is [1, 10, 11, 12, 13, ... Read More

Shortest Palindrome in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-May-2020 14:06:52

756 Views

Suppose we have a string s. We can convert it to palindrome by adding characters in front of it. We have to find the shortest palindrome, that we can find performing this information. So if the string is like “abcc”, then the result will be − "ccbabcc".To solve this, we ... Read More

Advertisements