Created
June 22, 2021 16:15
-
-
Save spiritinlife/8c19b5fe9a57390804394e824ddf6b7e to your computer and use it in GitHub Desktop.
random
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requestedProducts = […..]; # input array of products we have to make | |
For next shift: | |
nextShiftProducts = []; # keeps track of current shift products | |
# as long as the sum of this shift products are less than 8 we can try to add another product | |
while sum(nextShiftProducts hours) < 8: | |
for every requestedProducts: | |
if product.hours + sum(nextShiftProducts hours) < 8: # if we can add this product | |
add product to nextShiftProducts | |
remove product from requestedProducts | |
continue; # try to fill again remaining hours with another product | |
break; # if we are here then none of the products could be used for this shift | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment