A lease lock grants exclusive ownership for a bounded time. A fencing token distinguishes the newest owner from delayed work issued by an older owner.
Design a LeaseLock class:
LeaseLock() creates an unlocked lease with no previously issued tokens.int acquire(string owner, int now, int ttl) acquires the lock and returns a new fencing token, or returns -1 when the lock is still active.bool renew(string owner, int token, int now, int ttl) renews the matching active lease and returns whether it succeeded.bool release(string owner, int token, int now) releases the matching active lease and returns whether it succeeded.A lease acquired or renewed at now expires at now + ttl. It is active only while now < expiresAt, so another owner may acquire it exactly at expiresAt. A repeated acquire by the current owner is also rejected while the lease remains active.
Every successful acquisition returns the next positive fencing token. Tokens are never reused, including after release or expiration. Renewal and release succeed only when the lease is active and both owner and token match its current holder. A rejected operation must not change any state.
Input:
Output:
Explanation: Alice owns the lease through time 9. Bob is rejected at time 5, then acquires with token 2 exactly at time 10.
Input:
Output:
Explanation: Alice renews through time 8, releases before expiration at time 8, and Bob receives the next token.
1 <= owner.length <= 50owner contains lowercase English letters.0 <= now <= 10^9LeaseLock are nondecreasing.1 <= ttl <= 10^9now + ttl fits in a signed 32-bit integer.10^5 method calls are made per lock.| Call | Returns |
|---|---|
| new LeaseLock() | null |
| acquire("alice", 0, 10) | 1 |
| acquire("bob", 5, 10) | -1 |
| acquire("bob", 10, 10) | 2 |
Bob is rejected before Alice's expiration, then receives a newer fencing token exactly at expiration.
Run checks these cases. Submit also runs a larger hidden set.

