Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Lintcode22 Flatten List solution problem solution

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

[topic description]

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.

Given a list, each element in the list is either a list or an integer. Turn it into a simple list that contains only integers.

Note: if the element in a given list is itself a list, it can also contain a list.

[topic link]

Http://www.lintcode.com/en/problem/flatten-list/

[topic Analysis]

Given [1Jing 2, [1JI 2]], return [1BZ 2pm 1P 2].

Given [4, [3, [2, [1], return [4jue 3pm 2pm 1].

Recursive solution and non-recursive solution. It's easy to ask.

[reference answer]

Http://www.jiuzhang.com/solutions/flatten-list/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report