1. function reverse(d, l, r) {
    2. while (l <= r) {
    3. swap(d, l++, r--);
    4. }
    5. }