Find first and last index of target | ByteDance