Ad
  • Custom User Avatar

    You're right. Thanks!

  • Default User Avatar

    Shouldn't that be a x instead of a y in the 2nd line?

  • Default User Avatar

    similar to what floydchen said, the ENTIRE PAIR 3 and 7 comes before the second value of 5,5 so it's counted as earlier

  • Default User Avatar

    You should look at the second index that completes the pair. Whichever pair has "earlier" closing index should be the answer.

    In this case, the second index of (3, 7) is 4, which comes before 5, the second index of (5, 5).

  • Custom User Avatar

    Because you can redo all undo actions:

    unRe.set('x', 10);
    unRe.set('x', 100);
    unRe.set('x', 150);
    unRe.set('x', 50);
    unRe.undo(); //undo the last action. Now x = 150
    unRe.undo(); //undo the action before the last action. Now x = 100
    unRe.redo(); //redo the last undo action. Now x = 150
    unRe.redo(); //redo the undo action before the last undo action. Now x = 100