ByteDance interview question

A coding problem and basic ML knowledge