Given a number X, and an array of length N containing the N numbers. Find the minimum number of operations required to make X non-positive. In one operation, you can select any Read more →
Greedy
5 postsImagine a rooted tree ( with root as node 1). Every node is given two values, init value and expected value. Our task is to flip the node value to make the Read more →
We have a set of numbers from 1 to N. In one operation we are allowed to replace A and B by rounded up value of (A+B)/2. We can perform this procedure Read more →
You are given two boxes. The first box is empty while in the second, there are 3 piles of coins. Whenever you choose a pile of X coins (x>=1) from the second Read more →
A string is called happy if it does not have any of the strings ‘aaa’, ‘bbb’ or ‘ccc’ as a substring. Given three integers a, b and c, return any string s, Read more →