LeetCode559. Maximum Depth of N-ary Tree 第一次写出了具有迭代和递归的函数,还是有点收获的,虽然题目比较简答 当要对某些对象重复使用时,考虑循环,也就是迭代 当函数可以简化一个重复的操作时,考虑递归,而且就当下一次使用这和函数的结果已经有啦,就不会考虑的太复杂 自己写的答案: 反思学习: 1.对list不知...
Combinationshttps://leetcode.com/problems/powx-n/description/https://codeforces.com/problemset/problem/476/Bhttps://leetcode.com/problems/k-th-symbol-in-grammar/description/https://cses.fi/problemset/task/1623https://cses.fi/problemset/task/1624https://leetcode.com/problems/different-ways-to-...
leetcode-20-Dynamic Programming 303. Range Sum Query - Immutable 解题思路: Note里说sumRange会被调用很多次。。所以简直强烈暗示要做cache啊。。。所以刚开始,虽然用每次都去遍历数组求和的方式可以 AC,但是真的耗时太长了。因此,考虑不存储数组nums,而是在array[i+1]处存前i项的和。这样的话,求i和j之间...
LeetCode Question 247: Find all the central symmetry numbers of n ExampleInput: n = 2Output: ["11","69","88","96"] Ideas for Solving Problems of Central Symmetric Numbers When n=0 , it should output an empty string: “” . When n=1 time, i.e. the length of 1 center of symm...
I am taking one of the top Leetcode interview question i.e.Decode Ways Dear reader, Please fully engage (clap(50) 👏🏽, highlight 📝 & comment 💬) and spend at least 30" so that your visit rewards me. Thank you kindly 🙏🏽 ...