Re: [algogeeks] FIBONACCI problem.

2011-06-16 Thread • » νιρυℓ « •
My AC solution is O(1). On Thu, Jun 16, 2011 at 2:29 PM, PRAMENDRA RATHi rathi prathi...@gmail.comwrote: without DP it will be TLE.. - PRAMENDRA RATHI NIT ALLAHABAD On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.comwrote:

Re: [algogeeks] FIBONACCI problem.

2011-06-16 Thread • » νιρυℓ « •
Binet's Formula. ( keep shortening :P ) On Thu, Jun 16, 2011 at 5:57 PM, kartik sachan kartik.sac...@gmail.comwrote: @vipul what algo u have applied for o(1)?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Re: is it correct??

2011-06-15 Thread • » νιρυℓ « •
Its from stack. Using int a[n] the amount of memory that can be allocated is very small as compared to that in case of using malloc( heap allocation ). On Wed, Jun 15, 2011 at 2:45 PM, sunny agrawal sunny816.i...@gmail.comwrote: @kartik sachan This function is *not* defined in ANSI-C and is

Re: [algogeeks] Re: is it correct??

2011-06-14 Thread • » νιρυℓ « •
Its not a standard, it is one of the gcc extension i.e variable length arrays. Memory allocation is done dynamically from stack in such case. On Tue, Jun 14, 2011 at 8:27 PM, kartik sachan kartik.sac...@gmail.comwrote: it is correct ...in c++ 4.3.2 compiler -- You received this message

Re: [algogeeks] [brain teaser ] Find next number in series 10 june

2011-06-10 Thread • » νιρυℓ « •
42, 47 just guessing according to the pattern. On Fri, Jun 10, 2011 at 1:37 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Find next number in series * * * ** *What are the next two numbers in this sequence? 7, 14, 17, 21, 27, 28, 35, 37, ?, ? * * * *Update Your Answers at* : Click

Re: [algogeeks] [brain teaser ] Secret Code puzzle 9 june

2011-06-09 Thread • » νιρυℓ « •
74658 On Thu, Jun 9, 2011 at 1:36 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: *Secret Code puzzle * * * ** *A man wanted to get into his work building, but he had forgotten his code. However, he did remember five clues. These are what those clues were: The fifth number plus the third

Re: [algogeeks] MS Interview

2011-06-09 Thread • » νιρυℓ « •
For 1. sum the numbers in the file, subtract it from sum of first 4 billion numbers. On Thu, Jun 9, 2011 at 3:44 PM, Navneet Gupta navneetn...@gmail.com wrote: The answer to second question is simple. XORing all the elements should do it for you. On Thu, Jun 9, 2011 at 3:15 PM, Dumanshu

Re: [algogeeks] MS Interview

2011-06-09 Thread • » νιρυℓ « •
Sum wont overflow, ULL range will include sum. On Thu, Jun 9, 2011 at 3:52 PM, sunny agrawal sunny816.i...@gmail.comwrote: sum can overflow Xor method can also be applied to Q1. no need of numbers to be sorted. 2011/6/9 • » νιρυℓ « • vipulmehta.1...@gmail.com For 1. sum the numbers

Re: [algogeeks] output

2011-05-27 Thread • » νιρυℓ « •
Newline Character '\n' = ascii 10 On Fri, May 27, 2011 at 2:36 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote: #include stdio.h /* copy input to output; 2nd version */ main() { int c; while ((c = getchar()) != EOF printf(%d\n,c)) {putchar(c); printf(\n);} } it's output is like a

Re: [algogeeks] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
Take input as vector of string or array of string sort the vector print from end to beginning On Fri, May 27, 2011 at 7:51 PM, Logic King crazy.logic.k...@gmail.comwrote: i agree with piyush...can't find the countercase...satisfied with the algo. On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha

Re: [algogeeks] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
@Piyush Sinha, what about 9, 801 2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com Take input as vector of string or array of string sort the vector print from end to beginning On Fri, May 27, 2011 at 7:51 PM, Logic King crazy.logic.k...@gmail.comwrote: i agree with piyush...can't find

Re: [algogeeks] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
=100... correct me if i am wrong? On Fri, May 27, 2011 at 7:39 AM, Aakash Johari aakashj@gmail.comwrote: @vipul: try for 100 and 10 2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com @Piyush Sinha, what about 9, 801 2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com Take input

Re: [algogeeks] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
Kadane's algorithm is considers subarray sum, we are considering concatenation here. On Fri, May 27, 2011 at 9:45 PM, Supraja Jayakumar suprajasank...@gmail.com wrote: Hi Isnt this the Kadane's (largest subarray) problem ? Rgds Supraja J On Fri, May 27, 2011 at 9:41 AM, anshu mishra

Re: [algogeeks] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
@shubham, 10 101 ?? On Fri, May 27, 2011 at 11:41 PM, shubham shubh2...@gmail.com wrote: check whether these steps work: step 1: sort the given numbers in the decreasing order based on their first digit. step 2: if two numbers come out to be equal in the above case both