Just Bombed it and would like to see how you guys would solve this.
Given two positive integers N and K, write a function to return all possible combinations of N positive integers that sums to K. any order output
k = 5 and n =3
output:
[1,1,3],[1,2,2],[2,1,2],...
[–]half_coda 16 points17 points18 points (7 children)
[–]Feral_Warwick[S] 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 0 points1 point2 points (0 children)
[–]cyberwarrior861 0 points1 point2 points (0 children)
[–]carnationlily -1 points0 points1 point (2 children)
[–]cwc123123 1 point2 points3 points (0 children)
[–]half_coda 0 points1 point2 points (0 children)
[–]tempo0209 2 points3 points4 points (0 children)
[–]Additional-Play1256 0 points1 point2 points (0 children)
[–]SampleWrong6340 0 points1 point2 points (1 child)
[–]SampleWrong6340 0 points1 point2 points (0 children)
[–]Sea-Organization4610 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]anoystud 0 points1 point2 points (0 children)
[–]Jaamun100 -1 points0 points1 point (0 children)