Determine whether squares can fit | Bytedance Interview Question