1180. Count Substrings with Only One Distinct Letter

```python class Solution: def countLetters(self, s: str) -> int: “”” tc O(N) sc O(N) main idea: sliding window. number of substring can be caculated by accumutive sum of count at each iteration “”” d = {} l = 0 res = 0 for r in range(len(s)): if s[r] not in... [Read More]
Tags: String Math

45. Jump Game II

""" main idea: use right_most to record longest distance within current choice range. since our start point is confirmed, we need to create a end point to mark that the moment is time to move to next step end at furtherest distance. Note here we do not need to go... [Read More]