Done algorithm 6 with timeout.. Need to improve
Working but fail timing