[Python] Same idea here, maybe a little bit easier to digest
This is essentially the same idea as other top-voted posts. Not as concise but I think the thought process might be easier to come up with during interview.\n\n
This is essentially the same idea as other top-voted posts. Not as concise but I think the thought process might be easier to come up with during interview.\n\n```\nclass Solution:\n    def earliestAndLatest(self, n: int, firstPlayer: int, secondPlayer: int) -> List[int]:\n        \n        @lru_cache(None)\n        def dp(n, first, second):\n            """\n            recursion with memorization to calculate [earliest, latest] \n            """\n            \n            # base case: if first and second players have to compete in current round\n            if first == n-second+1:\n                return (1, 1)\n            \n            # the number of players going into next round\n            nxt_n = (n+1)//2\n            \n            # preset ealiest and latest\n            earliest = float(\'inf\')\n            latest = 0\n            \n            # the positions of first and second players, and their mirrors in the array, in sorted order\n            # if first player is right in the middle l2 == r1, but it is trivally covered so no need to treat specially.\n            l1, l2, r1, r2 = sorted([first, second, n-first+1, n-second+1])\n            \n            # essentially, the above 4 positions chop the arr into 5 parts like this: *** l1 *** l2 ****** r1 *** r2 ***\n            # name the length of first 3 parts below. The last two parts are the same as part2 and part1 \n            part1, part2, part3 = l1-1, l2-l1-1, r1-l2-1\n            \n            # now lets consider all possible next-round positions of first and second players as nxt_f and nxt_s\n            \n            # for the middle part (part3), after this round, it will become half and stay in the same position relative to first and second player.\n            # so it is simple to calculate the number of players entering next round in this part\n            p3 = (part3+1)//2\n            \n            # for part1 and part2, let\'s name p1 as the number of players win (and stay) in part1, and p2 for part2.\n            for p1 in range(part1+1):\n                for p2 in range(part2+1):\n                    \n                    # now here comes the fun part (or actually not fun at all?) to calculate nxt_f and nxt_s using p1, p2 and p3.\n                    # total 4 scenarios depending on where first and second players are located in current round\n                    \n                    # case1: *** l1 *** l2 ****** first *** second ***\n                    if first == r1:\n                        nxt_f = p1 + p2 + p3 + 1\n                        nxt_s = nxt_f + part2-p2 + 1\n                        \n                    # case2: *** l1 *** first ****** r1 *** second ***\n                    elif first == l2:\n                        nxt_f = p1 + p2 + 1\n                        nxt_s = nxt_f + p3 + part2-p2 + 1\n                    \n                    # case3: *** first *** l2 ****** second *** r2 ***\n                    elif first == l1 and second == r1:\n                        nxt_f = p1+1\n                        nxt_s = nxt_f + p2 + p3 + 1\n                    \n                    # case4: *** first *** second ****** r1 *** r2 ***\n                    else:\n                        nxt_f = p1+1\n                        nxt_s = nxt_f + p2+1\n                        \n                    # update earliest and latest based on the answers from next round\n                    nxt = dp(nxt_n, nxt_f, nxt_s)\n                    earliest = min(earliest, nxt[0])\n                    latest = max(latest, nxt[1])\n                    \n            return (earliest+1, latest+1)\n        \n        return dp(n, firstPlayer, secondPlayer)\n```
[]