JS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {number} n\n * @param {number} firstPlayer\n * @param {number} secondPlayer\n * @return {number[]}\n */\n\n\nvar earliestAndLatest = function (n, firstPlayer, secondPlayer) {\n  let earliest = n;\n  let latest = 0;\n\n  const visited = new Set();\n\n  const findEarliestAndLatest = (remain, players, current, round) => {\n    if (visited.has(remain)) return;\n    \n    const player = players[current];\n    const opponent = players[players.length - current]; // since we\'re 1-indexed\n\n    if (player === firstPlayer && opponent === secondPlayer) {\n      earliest = Math.min(earliest, round);\n      latest = Math.max(latest, round);\n      return;\n    }\n\n    if (opponent <= player) {\n\t  // we\'ve gone halfway through the list, so everyone has been matched up\n\t  // go to the next round\n      const nextPlayers = players.filter((p) => remain & (1 << p));\n      findEarliestAndLatest(remain, nextPlayers, 1, round + 1);\n      return;\n    }\n\n    const remainIfPlayerWins = remain ^ (1 << opponent);\n    const remainIfOpponentWins = remain ^ (1 << player);\n    const next = current + 1;\n\n\t// it\'s possible both firstPlayer and secondPlayer are in the first half of the list\n    if (player === firstPlayer || player === secondPlayer) {\n      findEarliestAndLatest(remainIfPlayerWins, players, next, round);\n      return;\n    }\n    \n\t// it\'s possible both firstPlayer and secondPlayer are in the second half of the list\n    if (opponent === firstPlayer || opponent === secondPlayer) {\n      findEarliestAndLatest(remainIfOpponentWins, players, next, round);\n      return;\n    }\n\n    // neither player nor opponent are firstPlayer or secondPlayer\n    findEarliestAndLatest(remainIfPlayerWins, players, next, round);\n    findEarliestAndLatest(remainIfOpponentWins, players, next, round);\n    visited.add(remain);\n  }\n\n  const players = new Array(n + 1).fill(0).map((_, i) => i);\n  const ALL_PLAYERS_REMAIN = 2 ** (n + 1) - 1;\n  findEarliestAndLatest(ALL_PLAYERS_REMAIN, players, 1, 1);\n\n  return [earliest, latest]\n};\n```
['JavaScript']