aboutsummaryrefslogtreecommitdiff
path: root/challenge-212/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-212/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-212/eric-cheung/python/ch-2.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-212/eric-cheung/python/ch-2.py b/challenge-212/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..8514d9b415
--- /dev/null
+++ b/challenge-212/eric-cheung/python/ch-2.py
@@ -0,0 +1,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)