ByteDance interview question

Basic test on the understanding of algorithms