SenseTime Interview Question

an LC hard-level coding problem