Category: greedy algorithm
Given a positive integer n, return whether n can be written as the sum of distinct positive factorial numbers. Example 1 Input n = 31 Output true Explanation Since …
You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes = : numberOfBoxesi is the number of boxes …
Teaching Kids Programming: Videos on Data Structures and Algorithms Given a list of integers prices representing prices of cars for sale, and a budget k, return the maximum number …
Slow Sums Algorithms Suppose we have a list of N numbers, and repeat the following operation until we’re left with only a single number: Choose any two numbers and …
Given a sequence of n integers arr, determine the lexicographically smallest sequence which may be obtained from it after performing at most k element swaps, each involving a pair …