Перейти к содержимому

Daily LeetCode Problem #1386 | Cinema Seat Allocation | Greedy + Hash Set | C++

izumicode

0:00 / 0:00

Daily LeetCode Problem #1386 | Cinema Seat Allocation | Greedy + Hash Set | C++

5 просмотров · 2 недели назад
izumicode
33 подписчика
5 просмотров · 2 недели назад
idea Used: We only need to focus on the reserved seats. Each row can normally fit two groups of four people. We divide the 10 seats of each row into possible groups: Seats 2 to 5 Seats 4 to 7 Seats 6 to 9 Using a Hash Set, we quickly check which seats are reserved and determine how many groups can fit in each row. #DailyLeetCode #LeetCode #LeetCode1386 #CinemaSeatAllocation #Greedy #HashSet #DSA #Cpp #CPlusPlus #Algorithms #Coding #Programming