my attempt on hackerrank problems