Tag: greedy algorithm
Given two sequences pushed and popped with distinct values, return true if and only if this could have been the result of a sequence of push and pop operations …
Given the following details of a matrix with n columns and 2 rows : The matrix is a binary matrix, which means each element in the matrix can be …
There are n people whose IDs go from 0 to n – 1 and each person belongs exactly to one group. Given the array groupSizes of length n telling …
You have some apples, where arr is the weight of the i-th apple. You also have a basket that can carry up to 5000 units of weight. Return the …
On a broken calculator that has a number showing on its display, we can perform two operations: Double: Multiply the number on the display by 2, or; Decrement: Subtract …