Skip to content

Instantly share code, notes, and snippets.

@cngondo
Created July 29, 2020 23:21
Show Gist options
  • Save cngondo/25d2712105583f15726dddbca8276949 to your computer and use it in GitHub Desktop.
Save cngondo/25d2712105583f15726dddbca8276949 to your computer and use it in GitHub Desktop.
A farmer has asked you to develop a program for a robot that fills empty trays of eggs. How would you do that? A tray has 30 eggs.
Define a tray as a collection with length of 30
Define the eggs
Iterate over the tray
Check if there's any empty space
If spaces exist
Fill up the empty tray spaces with an egg
If full
Inform farmer that tray is full
Create another tray
Call iteration to begin filling the new tray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment