摘要:
题目链接 394. 字符串解码 思路 建立一个数字栈 numStack 和一个字符串栈 stringBuilderStack。遍历字符串 s: 遇到数字和字符时按照相应规则分别累加进 k 和 result 中。 遇到 [ 时将 k 和 result 的值压入栈中并清空变量。 遇到 ] 时将两个栈的栈 阅读全文
posted @ 2023-02-13 19:17
Frodo1124
阅读(50)
评论(0)
推荐(0)
摘要:
题目链接 341. 扁平化嵌套列表迭代器 思路 遍历 nestedList,碰见子列表便将该子列表传入下一层递归中遍历,直到遍历完所有元素。 代码 class NestedIterator implements Iterator<Integer> { ArrayList<Integer> resul 阅读全文
posted @ 2023-02-13 10:53
Frodo1124
阅读(39)
评论(0)
推荐(0)

浙公网安备 33010602011771号