Skip to content

Latest commit

 

History

History

threeSticks

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Tree sticks

7 kyu link to kata
my solution

Imagine that you are given two sticks. You want to end up with three sticks of equal length. You are allowed to cut either or both of the sticks to accomplish this, and can throw away leftover pieces.

Write a function, maxlen, that takes the lengths of the two sticks (L1 and L2, both positive values), that will return the maximum length you can make the three sticks.