×

Loading...

My two cents

kakashi (kakashi)
1. sort
2.a create an ArrayList<ArrayList<Integer>> listOfSeries
2.b set maxLen = 0
3. Loop through the number list
for each number
3.1 Loop through the listOfSeries
for each series in the listOfSeries
If we can add the current number to the current series, add it. Set maxLen = +1
3.2 Add a new arrayList to the listOfSeries, this arrayList contains only the current number


Take {3,8,4,5,6,2,2} as example, then the final listOfSeries consists of:

,2,2
,2,3,4,5,6
,3,4,5,6
,4,5,6
,5,6
,6,8
,8
(#9937402@0)
2016-2-10 -05:00
Reply
Page address has been copied.
To share, click to copy page address.
Share Online by QR Code

Back To Topic: 一道面试题,大家给出出主意哈,我一点头绪都没有

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习学科技术