Passed on hackerrank