easy problem, speed up
almost right, but time complexity is too big, some samples not passed, TODO