×

 1 Can anyone tell me where I went wrong in the Marbles problem? I dont see any fault in my Solution. asked 04 Feb '14, 19:55 16●3 accept rate: 0%

 1 Your solution is correct but the only problem is that value of comb() and the factorial() function which have defined are exceeding the range of long integers for larger values. The solution is always within the range of long64 so if you try to do the divide and multiply efficiently without going out of the range you would get the solution excepted. So efficient way of doing it linearly would be somewhat like this : n C r can be found out by from n C 1 by multiplying (n-i) and dividing by (i+1) and going iteratively till i = r-1 starting from i = 1; answered 05 Feb '14, 19:51 1.5k●1●10●25 accept rate: 23%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×2,287
×1,887
×1,466
×533
×244
×8

question asked: 04 Feb '14, 19:55

question was seen: 1,162 times

last updated: 05 Feb '14, 19:51