Pergunta de entrevista da empresa athenahealth

Some random questions about juggling balls. Simple algorithm but hard to implement when someone is sitting there and when u don't have enough time.