solves hashmat the brave warrior problem