Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您能否建议我在 O(n) 时间内从给定数组中删除所有零且无需外部存储器的最佳算法。例如,1 2 0 0 3 2 0 2 变为 1 2 3 2 2
使用两个指针 - 一个用于读取,一个用于写入。