Meta interview question

Medium LC String and Array