Implement stack variants and path-sum check | TikTok Interview Question