C++ Solution to Coding Challenge 1710. Maximum Units on a Truck
An example of the greedy algorithm
Problem statement
You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes
, where boxTypes[i] = [numberOfBoxes_i, numberOfUnitsPerBox_i]
:
numberOfBoxes_i
is the number of boxes of typei
.