Lintcode22 Flatten List solution 题解
来源:互联网 发布:手机在linux查arp 编辑:程序博客网 时间:2024/06/16 07:19
【题目描述】
Given a list, each element in the list can be a list or integer. flatten it into a simply list with integers.
Notice:If the element in the given list is a list, it can contain list too.
给定一个列表,该列表中的每个要素要么是个列表,要么是整数。将其变成一个只包含整数的简单列表。
注意:如果给定的列表中的要素本身也是一个列表,那么它也可以包含列表。
【题目链接】
http://www.lintcode.com/en/problem/flatten-list/
【题目解析】
给定 [1,2,[1,2]],返回 [1,2,1,2]。
给定 [4,[3,[2,[1]]]],返回 [4,3,2,1]。
递归解法和非递归解法解答。容易题。
【参考答案】
http://www.jiuzhang.com/solutions/flatten-list/
0 0
- Lintcode22 Flatten List solution 题解
- Lintcode96 Partition List solution题解
- Lintcode98 Sort List solution 题解
- Lintcode170 Rotate List solution 题解
- 341. Flatten Nested List Iterator 题解
- Lintcode35 Reverse Linked List solution 题解
- Lintcode36 Reverse Linked List II solution 题解
- Lintcode35 Reverse Linked List solution 题解
- Lintcode102 Linked List Cycle solution 题解
- Lintcode103 Linked List Cycle || solution 题解
- Lintcode173 Insertion Sort List solution 题解
- LeetCode题解: Flatten Binary Tree to Linked List
- LeetCode 题解(51): Flatten Binary Tree to Linked List
- LeetCode题解:Flatten Binary Tree to Linked List
- LeetCode题解——Flatten Binary Tree to Linked List
- 【M】【83】【leetcode题解】Flatten Binary Tree to Linked List
- LeetCode题解-114-Flatten Binary Tree to Linked List
- leetcode Flatten Binary Tree to Linked List C++题解
- 8. String to Integer (atoi)
- eclipse中maven项目jar包下载失败解决办法
- [转]ubuntu 14.04 安装 Quartus II 13.1 过程
- Activity之使用技巧
- java设计模式之单例模式
- Lintcode22 Flatten List solution 题解
- LeetCode
- Struts2 spring整合 Action 出现java.lang.NoSuchMethodException异常
- VAO, VBO, PBO, FBO
- 2017.4.14 随机发牌
- 设计模式原则—迪米特原则
- Swift 3.0 学习笔记-3-集合类型
- 云掌通使用过程中的一个小问题
- mongodb,mongovue与pycharm之大总结!!!