Meta interview question

2 medium leetcodew were asked