ByteDance interview question

Stack, modified binary search, ...