HACKERRANK - Ones and Twos

algorithm complete, but timeout