-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
【专题】 反向思考 #572
Comments
不要思考往前舍去 多少,而是思考往后加上多少 class Solution:
def numberOfSubstrings(self, s: str) -> int:
i = ans = 0
w = collections.Counter()
for j in range(len(s)):
w[s[j]] += 1
while i < j and len(w) == 3:
ans += len(s) - j
w[s[i]] -= 1
if w[s[i]] == 0: del w[s[i]]
i += 1
return ans |
Repository owner
deleted a comment from
cherie-wuyajun
Nov 15, 2022
Repository owner
deleted a comment from
lording
Nov 15, 2022
Repository owner
deleted a comment from
xiaosisong
Nov 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
记录反向思考的题目。比如: 991. 坏了的计算器
The text was updated successfully, but these errors were encountered: