There will be n-1 numbers. x%i==1 means that i could be x-1. Therefore, there will be n-1 after first turn, n-2 after second turn, and so on. Eventually, all numbers from 2 to n are present on the board.
class Solution:
def distinctIntegers(self, n: int) -> int:
return n-1 if n > 1 else n
There will be n-1 numbers. x%i==1 means that i could be x-1. Therefore, there will be n-1 after first turn, n-2 after second turn, and so on. Eventually, all numbers from 2 to n are present on the board.