【文件属性】:
文件名称:最大公共字符串leetcode-leetcode:坚持每周刷一道LeetCode题
文件大小:12KB
文件格式:ZIP
更新时间:2021-07-01 01:20:49
系统开源
最大公共字符串leetcode
leetcode刷题打卡
接下来,坚持每周至少刷一道LeetCode题,刷题顺利按照牛客网LeetCode经典题目顺序进行,记录解题思路,与大家共享,同时也做个自我监督
第一周
1、树
题目:
Given
a
binary
tree,
find
its
minimum
depth.The
minimum
depth
is
the
number
of
nodes
along
the
shortest
path
from
the
root
node
down
to
the
nearest
leaf
node.
解题思路:
思路一:深度优先遍历,递归遍历左右子树,遇到叶子节点时返回
1,返回过程中,比较左右子树,较小深度逐层加1。
思路二:广度优先遍历,逐层遍历节点,遇到第一个叶子节点返回其深度;
代码:
2、栈
题目:
Evaluate
the
value
of
an
arithmetic
expression
in
Reverse
Polish
Notation.
Valid
operators
are+,-,*,/.
Each
operand
may
b
【文件预览】:
leetcode-master
----src()
--------solution()
----README.md(13KB)