Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: Generalized find the odd value

  • Given a list of values, we know that every value comes in groups of N except one group that has less than N element. Given the list and the number N find where it starts:

  • f(["a", "a", "a", "b", "b", "b", "x", "d", "d", "d"], 3) would return 6

  • f(["a", "a", "a", "b", "b", "b", "x", "y", "d", "d", "d"], 3) would return 6