Find first and last index of target | TikTok Interview Question