ByteDance interview question

CS basics and algo