Rust/Python. Linear. Track people who have been selected
Intuition\nStore all positions of people who has already been selected. Then iterate over all jumps (there will be at most n of them) until you will see a selec
# Intuition\nStore all positions of people who has already been selected. Then iterate over all jumps (there will be at most n of them) until you will see a selected person. \n\nThen return all people who has not been selected.\n\n\n# Complexity\n- Time complexity: $O(n)$\n- Space complexity: $O(n)$\n\n# Code\n\n\n\n```Python []\nclass Solution:\n  def circularGameLosers(self, n: int, k: int) -> List[int]:\n    seen = [0] * n\n    seen[0] = 1\n    \n    pos, jump = 0, k\n    while True:\n      pos = (pos + jump) % n\n      if seen[pos]:\n        break\n      \n      seen[pos] = 1\n      jump += k\n    \n    return [i + 1 for i in range(n) if seen[i] == 0]\n```\n```Rust []\nimpl Solution {\n  pub fn circular_game_losers(n: i32, k: i32) -> Vec<i32> {\n    let mut seen = vec![false; n as usize];\n    seen[0] = true;\n\n    let (mut pos, mut jump) = (0, k);\n    loop {\n      pos = (pos + jump) % n;\n      if seen[pos as usize] {\n        break;\n      }\n      \n      seen[pos as usize] = true;\n      jump += k;\n    }\n    \n    let mut res = vec![];\n    for i in 0 .. n {\n      if !seen[i as usize] {\n        res.push(i + 1);\n      }\n    }\n    \n    return res;\n  }\n}\n```\n
['Python', 'Rust']