Can u please explain ur code..!!!
--
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
The complexity of above code is exponential.
Here is the simple recurrence for the given problem
F(n) = 2*F(n-1) + F(n-2) + F(n-3) for n = 4
where F(1) = 2
F(2) = 5
F(3) = 13
precompute the values and each query will then be O(1)
On Thu, Aug 23, 2012 at 8:22
For N=1000, the above code fails, how is the mod 17 included??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/OkWbb2TmvGEJ.
To post to this
if sum is 4 output will be 33
On Mon, Aug 13, 2012 at 10:29 AM, SHOBHIT GUPTA
shobhitgupta1...@gmail.comwrote:
what will be the output if the sum is 4 ?
On Sun, Aug 12, 2012 at 11:22 PM, harsha harshacoo...@gmail.com wrote:
A smart 3 year old Sandeep knows counting. But he doesn't know how
shouldn't be the sum i.e. 4 taken as 1 ?
On Mon, Aug 13, 2012 at 11:06 AM, vivek rungta vivekrungt...@gmail.comwrote:
if sum is 4 output will be 33
On Mon, Aug 13, 2012 at 10:29 AM, SHOBHIT GUPTA
shobhitgupta1...@gmail.com wrote:
what will be the output if the sum is 4 ?
On Sun, Aug
@shobhit No, in question already mention that He knows how to count up
beyond five, just not how to write it.
On Mon, Aug 13, 2012 at 1:39 PM, SHOBHIT GUPTA
shobhitgupta1...@gmail.comwrote:
shouldn't be the sum i.e. 4 taken as 1 ?
On Mon, Aug 13, 2012 at 11:06 AM, vivek rungta
A smart 3 year old Sandeep knows counting. But he doesn't know how to read
and write properly. He has learnt 1, 2 and 3 but thinks that 4 is another
way to write 1.
So when given any number with 1, 2, 3 4, he tries to sum up their digits
as follows :
213 = 2 + 1 + 3 = 6
33 = 3 + 3 = 6
use simple recursive function to solve -
int countfun(int sum ){
int i;
int count;
int total=0;
if (sum==0)
return 1;
for(i=1;i=3;i++){
if (sum-i0)
break;
count=countfun(sum-i);
if(i==1)
count*=2;
total+=count;
}
return total;
}
On Sun, Aug 12, 2012 at 11:22 PM, harsha harshacoo...@gmail.com
what will be the output if the sum is 4 ?
On Sun, Aug 12, 2012 at 11:22 PM, harsha harshacoo...@gmail.com wrote:
A smart 3 year old Sandeep knows counting. But he doesn't know how to read
and write properly. He has learnt 1, 2 and 3 but thinks that 4 is another
way to write 1.
So when given