human
I found an interesting problem on https://leetcode.com/problems/airplane-seat-assignment-probability/:
n passengers board an airplane with exactly n seats. The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of passengers will:

Take their own seat if it is still available, 
Pick other seats randomly when they find their seat occupied 

What is the probability that the n-th person can get his own seat?
 
Example 1:
Input: n = 1
Output: 1.00000
Explanation: The first person can only get the first seat.
Example 2:
Input: n = 2
Output: 0.50000
Explanation: The second person has a probability of 0.5 to get the second seat (when first person gets the first seat).

 
Constraints:

1 <= n <= 10^5

I tried it in Python, but could not do it. Can you solve it?

 ... Can you provide a Python code to find their seat occupied ?
assistant
#Here is Python code to find their seat occupied 
.

class Solution:
    def nthPersonGetsNthSeat(self, n: int) -> float:
        if n == 1: return 1
        if n == 2: return 0.5
        result = 1.0
        curr = 1.0
        for i in range(2, n + 1):
            result = (1 / i) * curr
            curr += result
        return result