hackerrank algorithm