LeetCode341
迭代器特点:惰性,如果你要一个结果,我就算一个(或是一小部分)结果出来,而不是一次把所有结果都算出来。
故解法如下:
/**
* // This is the interface that allows for creating nested lists.
* // You should not implement it, or speculate about its implementation
* public interface NestedInteger {
*
* /...
原创
2021-10-29 16:07:17 ·
131 阅读 ·
0 评论