Permutation game Discussions | | HackerRank

Permutation game

  • + 0 comments

    Example

    5 3 2 1 4 (after i get to 4 then below are all a) -> b Bob wins (let's skip those branches)
      3 2 1 4 (if below is b then a, else i ++) (last case b) - > a       
        2 1 4 : a -> 3 1 4: a -> 3 2 4: a -> 3 2 1: b (below all a then this is b)
          1 4 : b      1 4: b      2 4: b      2 1: a -> 3 1: a -> 3 2: a
                                                 1: b      1: b      2: b
            */
            //We can see that alot of branches are dupplicated
            //hence the use of MEMORY map, 
            //allowing us to skip their isIncreasing checks