Its a subset Manipulation Problem.. Very simple logic.. Can Use
Recursion for even more simplicity..
Call Recursion one with that element and once wdout..

On 10/25/11, Meng Yan <mengyan.fu...@gmail.com> wrote:
> Hi, my question is
>
> given sum=N and combination constraint=M (the number of elements), how to
> find all possible combinations of integers?
>
> For example, given sum=6, combination=3; how to get the result as following:
> 1+1+4;
> 1+2+3;
> 2+2+2;
>
> We don't care about order of the elements, which means 1+1+4 and 1+4+1 are
> considered as same combination.
>
> Thanks a lot!
>
> Meng
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to