Frage im Vorstellungsgespräch bei Microsoft

Nothing really difficult.

Antwort im Vorstellungsgespräch

Anonym

20. Feb. 2013

int counter = 0; for (int i = a.length-1; i >= 0; i--) { if (a[i] != 0){ a[a.length-1-counter] = a[i]; a[i] = 0; counter++; } } O(n). One pass.