- 7-8 PM
SCI H305
Coding Club
- 6:30-7:30 PM
SCI L043
About
0
to n - 1
and all the rooms are locked except for room 0
. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.rooms
where rooms[i]
is the set of keys that you can obtain if you visited room i
, return true
if you can visit all the rooms, or false
otherwise.
Python Sample
class Solution: def maxScore(self, cardPoints: List[int], k: int) -> int: n = len(cardPoints) total = sum(cardPoints) remaining_length = n - k subarray_sum = sum(cardPoints[:remaining_length]) min_sum = subarray_sum for i in range(remaining_length, n): subarray_sum += cardPoints[i] subarray_sum -= cardPoints[i - remaining_length] min_sum = min(min_sum, subarray_sum) return total - min_sum
Enrich Wellesley community's Computer Science experience beyond the CS curriculum.
For more information, please follow Wellesley CS Club on Facebook.