aboutsummaryrefslogtreecommitdiff
path: root/challenge-212/eric-cheung/python/ch-2.py
blob: 8514d9b41523807a62cde09714142b90b35f0824 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Example 1:
## arrList = [1, 2, 3, 5, 1, 2, 7, 6, 3]
## nSizeSplit = 3

## Example 2:
## arrList = [1, 2, 3]
## nSizeSplit = 2

## Example 3:
## arrList = [1, 2, 4, 3, 5, 3]
## nSizeSplit = 3

## Example 4:
arrList = [1, 5, 2, 6, 4, 7]
nSizeSplit = 3

if len(arrList) % nSizeSplit == 0:
    arrList.sort()
    for nIndx in range(0, len(arrList), nSizeSplit):
        print (arrList[nIndx:nIndx + nSizeSplit])
else:
    print (-1)