Skip to content

feat: add cs solution to lc problem: No.1845 #1934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update README_EN.md
  • Loading branch information
yanglbme authored Nov 6, 2023
commit d6f33e61b6a56787538fa0e930b574469850672a
17 changes: 12 additions & 5 deletions solution/1800-1899/1845.Seat Reservation Manager/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,27 +178,34 @@ func (h *hp) Pop() interface{} {

### **C#**

```C#
```cs
public class SeatManager {
private SortedSet<int> availableSeats;

public SeatManager(int n) {
availableSeats = new SortedSet<int>();
for (int i = 1; i <= n; i++)
{
for (int i = 1; i <= n; i++) {
availableSeats.Add(i);
}
}

public int Reserve() {
int reservedSeat = availableSeats.Min;
availableSeats.Remove(reservedSeat);
return reservedSeat;
}

public void Unreserve(int seatNumber) {
availableSeats.Add(seatNumber);
}
}

/**
* Your SeatManager object will be instantiated and called as such:
* SeatManager obj = new SeatManager(n);
* int param_1 = obj.Reserve();
* obj.Unreserve(seatNumber);
*/
```

### **...**
Expand Down