[algogeeks] Re: Rotating 1D array clockwise

2011-08-26 Thread DheerajSharma
actually i was so involved in the question..that i forgot to see..wether its clockwise or not ;) thanks for the solution On Aug 27, 10:56 am, Sanjay Rajpal wrote: > u have mentioned clockwise, but o/p u r giving is anti-clock wise. > > solution for clockwise : > > See Reverse last k and first n-k

[algogeeks] Re: array problem

2011-08-21 Thread DheerajSharma
It would work i guess On Aug 21, 1:49 pm, Sanjay Rajpal wrote: > let n be the no.of integers in the array : > > int i=1,a; >     int zero,one; >     for(int a=1;a<=32;a++) >     { >         zero=0; >         one=0; >         for(int j=0;j         { >             if(a[j] & i) >             { >    

[algogeeks] Re: calculate a/b without using ‘*’, ‘/’’ and ‘%’

2011-08-18 Thread DheerajSharma
wat about shifting 'a' right by floar(log2(b)) and adding 1 to it.. On Aug 18, 8:48 pm, aditya kumar wrote: > how abt subtracting . like a=a-b till a becomes zero . no of times > subtraction is done is the answer . > correct me if i am wrong ! > > > > > > > > On Thu, Aug 18, 2011 at 8:59 PM, Dave

[algogeeks] Re: longest repeated substring

2011-08-18 Thread DheerajSharma
suffix tree is obvsly best..but hard to code at interview!! On Aug 18, 7:20 pm, DheerajSharma wrote: > O(n^2) i guess.. > We can save all possible substrings..(in two loops it can be done) in > a hash map..as key..and the value as COUNT..then we can..search for > the most occurri

[algogeeks] Re: Amazon Question

2011-08-18 Thread DheerajSharma
bitset would work i guess On Aug 18, 7:10 pm, hary rathor wrote: > bitset is best . require only 32 time less then require in hash table . -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@google

[algogeeks] Re: longest repeated substring

2011-08-18 Thread DheerajSharma
O(n^2) i guess.. We can save all possible substrings..(in two loops it can be done) in a hash map..as key..and the value as COUNT..then we can..search for the most occurring substring!! u said for non - efficient ;) On Aug 18, 6:07 pm, MAC wrote: > A string can have many sub-strings inside it .

[algogeeks] Re: Any body have idea about samsung india recruitment...

2011-08-18 Thread DheerajSharma
samsung SISO would be coming day after tomm. in our collg..would tell u the details..howevel..samsung SEL visited..our collg few dayz..back..there was first an aptitude paper..having logical reasoning and pie chart type questions..that were very very easy..and the question booklet they provided.. a

[algogeeks] Re: MS BRAINTEASR

2011-08-18 Thread DheerajSharma
ur welcume :) On Aug 18, 4:12 pm, payal gupta wrote: > hmm...suitable rply i suppose > thanx...:):) > > REGARDS, > PAYAL GUPTA > > On Thu, Aug 18, 2011 at 4:36 PM, DheerajSharma > wrote: > > > > > > > > > it would take c days to take o

[algogeeks] Re: MS BRAINTEASR

2011-08-18 Thread DheerajSharma
on day 3. so on.. so on.. For C hats...C dayz... On Aug 18, 4:06 pm, DheerajSharma wrote: > it would take c days to take off all the hats > > On Aug 18, 3:51 pm, "pg@manit" wrote: > > > > > > > > > A bunch of men are on an island. A genie comes down

[algogeeks] Re: MS BRAINTEASR

2011-08-18 Thread DheerajSharma
it would take c days to take off all the hats On Aug 18, 3:51 pm, "pg@manit" wrote: > A bunch of men are on an island. A genie comes down and gathers > everyone together and places a magical hat on some people’s heads > (i.e., at least one person has a hat). The hat is magical: it can be > seen b