Solve three algorithm tasks | TikTok Interview Question