Wix interview question

hard questions from codingame and one easy from leetcode