Welcome back to the weekly programming contests! If you are new to the contest or need a refresher don’t forget to read up on the rules and information Posted Here
This week’s challenge is to write a method that takes in an array of integers and returns a two dimensional array containing all possible Combinations of the given array with all possible sizes.
Examples (order doesn’t matter):
c([]) -> [[]]
c([3]) -> [[], [3]]
c([2, 7]) -> [[], [2], [7], [2, 7]]
c([7, 7, 7]) -> [[], [7], [7, 7], [7, 7, 7]]
c([0, 3, 3] -> [[], [0], [3], [0, 3], [3, 3], [0, 3, 3]]
c([1, 2, 3] -> [[], [1], [2], [3], [1, 2], [2, 3], [1, 3], [1, 2, 3]]
c([3, 1, 2] -> [[], [1], [2], [3], [1, 2], [2, 3], [1, 3], [1, 2, 3]]
Also, if you like these weekly programming problems, please make some suggestions for the contest or specific challenges (in the main thread)! This takes time out of my Sunday and its not always fun! Using suggested challenges makes it a lot faster and easier for me.
Imports are allowed for this challenge!
Challenge Closes: Sunday 2/28/16
Good luck!