3280. Convert Date to Binary
转int再转binary 懒人写法
```python
class Solution:
def convertDateToBinary(self, date: str) -> str:
def convert(s):
return bin(int(s))[2:]
return '-'.join(map(convert, date.split('-')))
```
3281. Maximize Score of Numbers in Ranges
排序后 对answer做Binary Search
check function
检查curr + diff 是否在start[i] + d范围内
```python
class Solution:
def maxPossibleScore(self, start: List[int], d: int) -> int:
start.sort()
n = len(start)
def check(diff):
curr = start[0]
for i in range(1, n):
if curr + diff > start[i] + d:
return False
curr = max(start[i], curr + diff)
return True
res = 0
left, right = 0, 2_000_000_001
while left <= right:
mid = (left + right) // 2
if check(mid):
res = mid
left = mid + 1
else:
right = mid - 1
return res
```
3282. Reach End of Array With Max Score
每次都往下一个 >= 的值跳
之前在讨论区看过差不多的题目= =
差别只是他是(j-i) * nums[j]
https://leetcode.com/discuss/interview-question/5633414/
```python
class Solution:
def findMaximumScore(self, nums: List[int]) -> int:
# jump to next greater/equal num
n = len(nums)
res = 0
i = 0
for j in range(n-1):
if nums[j] >= nums[i]:
res += (j-i) * nums[i]
i = j
res += (n-1-i) * nums[i]
return res
```
第四题 懒了