Solve two grid problems (islands + min-cost path) | TikTok Interview Question