You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# only '(' and ')'defmatch(s):
l_size=0foriins:
ifi=='(': l_size+=1else: l_size-=1ifl_size<0:
returnFalsereturnl_size==0# ordefmatch(s):
stack= []
foriins:
ifi=='(':
stack.append(i)
elifstack:
stack.pop()
else:
returnFalsereturnnotstack
# when many kinds of brackets, stack is the only good waydefmatch(s):
mapping= {'(': ')', '[': ']', '{': '}'}
stack= []
foriins:
ifiinmapping:
stack.append(i)
elifstack:
ifmapping[stack.pop()] !=i:
returnFalseelse:
returnFalsereturnnotstack
DSA 困境分析:底子薄,训练量不达标,平时工作与算法毫不沾边
DSA 破局之道:盯基础,抓训练量,工作之余,周期性重复练习
DSA 锦上添花:借机略通 C++、Java
DSA 刷题指北:
绪论
算法
ADT
复杂度度量与分析
递归
向量
二分查找的三个版本
起泡排序与归并排序
列表
插入、选择、归并排序
栈与队列
栈与递归
逆序输出、递归嵌套、延迟缓冲、逆波兰表达式
循环分配器、银行服务
二叉树
四种遍历
图
遍历
搜索
拓扑排序
搜索树
二叉搜索树
平衡二叉搜索树
AVL 树
高级搜索树
伸展树
B-树
红黑树
kd-树
词典
跳转表
散列表
散列应用
优先级队列
完全二叉堆
串
串匹配蛮力算法
KMP 算法
BM 算法
Karp-Rabin 算法
排序
快速排序
选取中位数
希尔排序
算法类别
分而治之
减而治之
貌似简明的递归
至拙至巧的迭代
二分
滑动窗口
动态规划
贪婪
回溯
位运算
The text was updated successfully, but these errors were encountered: