[algogeeks] Additive sequence

2011-10-10 Thread anand karthik
Hi,

I dont remember the question text exactly but the following should
convey it well

The question:

A number is said to be an additive number if it has the following format:

3268126844 : 32 6812 6844 :  32 + 6812 = 6844
123581321 : 1 2 3 5 8 13 21 : 1+2  = 3 , 2+3 = 5 , 3+5=8, 5+8 = 13, 8+13 -21
347  : 3 4 7 : 3+4=7
122331234346746 : 122 3312 3434 6746 : 122 + 3312 = 3434 , 3312+3434  = 6746


If the number is broken down into non zero ( 303 : 3+0 = 3 is not
additive ) segments,and when these segments are taken in groups of
consecutive 3 ,(so two digit or single digit inputs wont qualify), the
first two should add up to the third number, such a number is called
as an additive number.

Given a range of numbers, print all the numbers  which are additive in
the sequence.

Give an approach other than brute force.

-- 
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.



Re: [algogeeks] Amazon Ques

2011-09-27 Thread anand karthik
Reverse it , print it and reverse it again. :-)

On Wed, Sep 28, 2011 at 3:28 AM, Ankur Garg ankurga...@gmail.com wrote:
 Print Reverse of linked list (dont reverse it) with only constant space.

 Recursion uses stack spaceO(n) ..so post some other solution ..


 --
 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.




-- 
Best,
T Anand Karthik,

Contact number: +91-9571552652

-- 
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.



Re: [algogeeks] A simple C question

2011-06-03 Thread anand karthik
(!printf(Hello))
On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote:
 Please help me in this question.

 What's the condition so that the following code prints both HelloWorld !

 if condition
 printf (Hello);
 else
 printf(World);




 --
 -Arpit Mittal
 6th Semester,
 Indian Institute of Information Technology,Allahabad
 Email : arpitmittal.ii...@gmail.com
 rit2008...@iiita.ac.in
 Contact : +91-8853049787

 Let every man be respected as an individual and no man idolized.

 --
 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.



Re: [algogeeks] Re: Intersection of 2 linked lists -

2011-06-02 Thread anand karthik
How can that be unless 3 has two next nodes?

-- 
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.



Re: [algogeeks] LINKERS AND LOADERS BOOK

2011-04-26 Thread anand karthik
Thanks a lot

On Sun, Apr 24, 2011 at 5:57 AM, Charles Turner chtu...@gmail.com wrote:
 This is a good book, now available to read online!

 http://www.iecc.com/linker/

 Charles

 On 24/04/2011 12:57, anand karthik wrote:

 I have been trying to find some good reding on the same... please
 share if anyone knows one...

 On Sat, Apr 23, 2011 at 9:41 PM, MANNUmanishkr2...@gmail.com  wrote:

 Can anyone please refer me a book or notes of linkers and loaders which
 must
 contain atleast these topics:
 1.ABSOLUTE LOADER
 2.BOOTSTRAP LOADER
 3.LINKING LOADER
 4.DYNAMIC LINKING


 THANKS AND REGARD
 MANISH KUMAR
 THIRD YEAR B.TECH(I.T.)
 N.I.T. DURGAPUR

 --
 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.





-- 
Best,
T Anand Karthik,

Contact number: +91-9571552652

-- 
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.



Re: [algogeeks] LINKERS AND LOADERS BOOK

2011-04-24 Thread anand karthik
I have been trying to find some good reding on the same... please
share if anyone knows one...

On Sat, Apr 23, 2011 at 9:41 PM, MANNU manishkr2...@gmail.com wrote:
 Can anyone please refer me a book or notes of linkers and loaders which must
 contain atleast these topics:
 1.ABSOLUTE LOADER
 2.BOOTSTRAP LOADER
 3.LINKING LOADER
 4.DYNAMIC LINKING


 THANKS AND REGARD
 MANISH KUMAR
 THIRD YEAR B.TECH(I.T.)
 N.I.T. DURGAPUR

 --
 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.




-- 
Best,
T Anand Karthik,

Contact number: +91-9571552652

-- 
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.



Re: [algogeeks] Facebook Interview Question....Heavy Number

2011-04-04 Thread anand karthik
I am not sure if I can explain the general approach as efficiently as
by explaining with an example:
for the example you have give , say to find for A= 1,000,000,000 -
2,000,000,000
first two billion is not heavy.

So finding from 1,000,000,000 - 1,999,999,999

It is:( 1 + sigma (x)  )  70 , where sigma( x ) is the sum of the
rest of the nine integers.

so, sigma(x)  69. so its now a problem of finding the sum of 9 digits
to exceed the sum 69.

If someone could work this permutation problem please put it up, I am
trying to come up with an accurate formula for this.

Generalizing, split the range into units that can be brought into this
workable form and apply the formula.



On Mon, Apr 4, 2011 at 8:52 AM, bittu shashank7andr...@gmail.com wrote:
 Hi Geeks, One of The My Friend had This Question in His Technical
 Round of Facebook, I m going to share with you.lest see how geek
 approach this...Plz don't make this post spam..by discussing whats ur
 friend name, wich colge, etc etc..just share your approach, think 
 solve the question, even  Google search wont give you correct 
 efficient approach ,answer for this question..so think your self..

 O(n^2) Solution is Obvious ..but .it wont work for 10 million  as a
 limit so not a good solution

 we have to solve it using best approach  algo..as we have

 so here is the question...From Facebook...

 /*
 A non-negative integer is called heavy if the average value of its
 digits in decimal representation exceeds 7. Assume that 0 has average
 value of its digits equal to 0.

 For example the number 8698 is heavy, because the average value of its
 digits equal to (8+6+9+8)/4 = 7.75. The number 53141 has the average
 value of its digits equal to (5+3+1+4+1)/5 = 2.6, so it is not heavy.

 Write a function

 int heavy_decimal_count(int a,int b);

 that given two non-negative integers A and B returns the number of
 heavy integers in the interval [A..B] (both ends included). Assume
 that 0 =A = B = 200,000,000 Range Given ..It Really Matters Your
 Program should not give time out  memory error

 For example, given A=8,675 and B=8,689 the function should return 5,
 because there are 5 heavy integers in range [8,675..8,689]:

 8675   avg=6.5
 8676   avg=6.75
 8677   avg=7
 8678   avg=7.25    HEAVY
 8679   avg=7.5     HEAVY
 8680   avg=5.5
 8681   avg=5.75
 8682   avg=6
 8683   avg=6.25
 8684   avg=6.5
 8685   avg=6.75
 8686   avg=7
 8687   avg=7.25    HEAVY
 8688   avg=7.5     HEAVY
 8689   avg=7.75    HEAVY

 you have to keep in mind for given range  e.g given  B=2 Billion Its
 Man Thing  so what happen when
 A=1 Billion  B=2 Billion

 */

 Go Ahead

 Thanks  Regards
 Shashank Mani
 Cell 9740852296

 --
 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.





-- 
Best,
T Anand Karthik,

Contact number: +91-9571552652

-- 
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.



Re: [algogeeks] [brain teaser ] 2april

2011-04-04 Thread anand karthik
E
On Apr 4, 2011 1:14 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote:
 *WHAT AM I Problem Solution*
 *
 *The beginning of eternity. The end of time and space. The beginning of
 every end and the end of every place. What am I?

 *Update Your Answers at *: Click
 Here
http://dailybrainteaser.blogspot.com/2011/04/2april.html?lavesh=lavesh

 Solution:
 Will be updated after 1 day

 --

 Never explain yourself. Your friends don’t need it and
 your enemies won’t believe it .

 --
 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.



Re: [algogeeks] [brain teaser ] 28march

2011-03-28 Thread anand karthik
Evertime you conduct a race, you eliminate 2 horses. So, 11.
On Mar 28, 2011 1:24 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote:
 *Horse Race Problem Solution*
 *
 *Ok, so there are 25 horses and the race track only allows 5 horses to
race
 at a given time. Given that there is no stop watch available your task is
to
 determine the fastest 3 horses. Assume that each horses speed is constant
in
 different races, what is the minimum number of races to determine the
 fastest 3?

 Update Your Answers at : Click
 Here
http://dailybrainteaser.blogspot.com/2011/03/28march.html?lavesh=lavesh

 Solution:
 Will be updated after 1 day



 --

 Never explain yourself. Your friends don’t need it and
 your enemies won’t believe it .

 --
 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.



Re: [algogeeks] [brain teaser ] 22march

2011-03-24 Thread anand karthik
First start 7  4. Turn 4 as soon as it is over. Then turn 7 as soon as it
is over. By this time 7 minutes are gone and there is one minute left in 4.
So by the time 4 is over, 7 has 6 mintes left. Then immediately invert 7,
which will count the last one Minute.

7,4 - 3,0 - 3,4 - 0,1 - 7,1 - 6,0 - (invert) - 1,0 - 0,0 .
 On Mar 22, 2011 1:05 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote:

-- 
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.



Re: [algogeeks] Re: 10 digit problem

2011-03-16 Thread anand karthik
Can anyone suggest an algorithmic approach?
On Mar 16, 2011 9:08 PM, annarao naidu kataru kataruanna...@gmail.com
wrote:
 i tried so many but the possible answer is 50 as u said
 thank u

 On Wed, Mar 16, 2011 at 8:08 PM, Gunjan Sharma gunjan.khan...@gmail.com
wrote:

 10 what about this??

 --
 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.


-- 
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.



Re: [algogeeks] amazon c questn

2011-01-11 Thread anand karthik
technically, malloc(25*sizeof(char)) or so would have been right ... here
malloc(25) assigns just 25 bytes as against the requirement...

On Tue, Jan 11, 2011 at 11:10 PM, UTKARSH SRIVASTAV usrivastav...@gmail.com
 wrote:

 no nothing is wrong i have run it on my computer



 On Tue, Jan 11, 2011 at 9:09 AM, snehal jain learner@gmail.comwrote:

 sorry that was typing error.. anything else wrong except that? as it seems
 correct to me...


 On Tue, Jan 11, 2011 at 10:31 PM, Arpit Sood soodfi...@gmail.com wrote:

 its correct, only a comma is missing in printf line:
 printf(%s,p);


 On Tue, Jan 11, 2011 at 10:14 PM, snehal jain learner@gmail.comwrote:

 what is the wrong in the program?

 main()
 {
 char *p,*q;
 p=(char *)malloc(25);
 q=(char *)malloc(25);
 strcpy(p,amazon);
 strcpy(q,hyd);
 strcat(p,q);
 printf(%sp);
 }

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




 --
 Arpit Sood
 Some day you will see things my way.
 http://arpit-sood.blogspot.com

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 UTKARSH SRIVATAV
 CSE-3
 B-TECH 2nd YEAR

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




-- 
Best,
T Anand Karthik,

Contact number: +91-9571552652

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.