Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Lintcode22 Flatten List solution problem solution

Shulou Source: shulou.com Published: 2022-06-03 02:36:31 10月04日 Update

[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/

Tags: Questions integers or elements solutions recursion answers links references solutions problem solutions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS OPPO Reno vpn Huawei