Arnab Chakraborty has Published 4293 Articles

Binary Tree Postorder Traversal in Python Programming

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:35:29

239 Views

Suppose we have a binary tree. We have to find the post order traversal of this tree using iterative approach. So if the tree is like −Then the output will be: [9, 15, 7, 10, -10]To solve this, we will follow these steps −if root is null, then return empty ... Read More

Distinct Subsequences in C++ Programming

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:30:43

318 Views

Suppose we have strings S and T. We have to count number of distinct sequences of S which is equal to T.We know that a subsequence of a string is a new string which is formed from the original string by removing some (can be none) of the characters without ... Read More

Find the Kth Smallest Sum of a Matrix With Sorted Rows in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:27:51

320 Views

Suppose we have one m * n matrix called mat, and an integer k, mat has its rows sorted in nondecreasing order. We can choose exactly one element from each row to form an array. We have to find the Kth smallest array sum among all possible arrays.So, if the ... Read More

Number of Ways to Wear Different Hats to Each Other in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:24:09

196 Views

Suppose there are n people and 40 different types of hats those are labeled from 1 to 40. Now a 2D list is given called hats, where hats[i] is a list of all hats preferred by the i-th person. We have to find the number of ways that the n ... Read More

Constrained Subsequence Sum in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:22:55

173 Views

Suppose we have an array called nums and an integer k, we have to find the maximum sum of a non-empty subsequence of that array such that for every two consecutive numbers in the subsequence, nums[i] and nums[j], where i < j, the condition j - i k and ... Read More

Restore The Array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:21:32

363 Views

Suppose there is a program that is used to print the array elements of an array A, but there was a little mistake in the program. In that program there was no white space after each element, so if we have one printed string, can we regenerate the array again? ... Read More

Number of Ways to Paint N × 3 Grid in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:19:15

296 Views

Suppose we have grid of size n x 3 and we want to paint each cell of the grid with exactly one of the three colors. The colors are Red, Yellow or Green. Now there is a constraint that is no two adjacent cells have the same color. We have ... Read More

Stone Game III in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:16:49

234 Views

Suppose Amal and Bimal are playing with piles of stones. There are several stones arranged in a row, and each stone has an associated value which is a number given in the array called stoneValue.Amal and Bimal take turns, with Amal starting first. On each player's turn, he/she can take ... Read More

Reducing Dishes in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:14:31

554 Views

Suppose there is a chef. And he has collected data on the satisfaction level of his n dishes. The Chef can cook any dish in 1 unit of time. Like-time coefficient of a dish is actually the time takento cook that dish including previous dishes multiplied by its satisfaction level ... Read More

Find All Good Strings in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:11:58

449 Views

Suppose we have two strings s1 and s2. The size of these strings is n, and we also have another string called evil. We have to find the number of good strings.A string is called good when its size is n, it is alphabetically greater than or equal to s1, ... Read More

Advertisements