It is just impossible.Computer needs to look at each index atleast once (otherwise how would it know the number) and so min time required is O(n)....Therefore cant do without a loop
On Wednesday, December 21, 2011, Nikhil wrote: > ok > using loop but without using any predifine functioin. What would be > the best answer of the problem??? > > On Dec 19, 7:00 am, Vikram Gaur <[email protected] <javascript:;>> > wrote: > > hmm... by using lambda functions and map() in python, we can find the > > sum without actually using a loop. > > > > Here's my code: > > > > #!/usr/bin/python > > def f(item): return int(item); > > > > print sum(map(f,list(raw_input().strip()))) > > > > On 12/19/11, Bruno Oliveira <[email protected] <javascript:;>> wrote: > > > > > I think it can be done via functional programming and by using lambda > > > functions and lists by comprehension > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Google Code Jam" group. > > > To post to this group, send email to > > > [email protected]<javascript:;> > . > > > To unsubscribe from this group, send email to > > > [email protected] <javascript:;>. > > > For more options, visit this group at > > >http://groups.google.com/group/google-code?hl=en. > > > > -- > > Thanks and Regards > > Vikram Gaur > > Software Engineer > > Samsung Engineering Labs, Noida > > +91-9818540102 > > > > "Since human beings themselves are not fully debugged yet, there will be > > bugs in your code no matter what you do." - Chris Mason > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To post to this group, send email to > [email protected]<javascript:;> > . > To unsubscribe from this group, send email to > [email protected] <javascript:;>. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
