[algogeeks] Re: Rotating 1D array clockwise

2011-08-27 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 srn...@gmail.com wrote: u have mentioned clockwise, but o/p u r giving is anti-clock wise. solution for clockwise : See Reverse last k

[algogeeks] Re: array problem

2011-08-21 Thread DheerajSharma
It would work i guess On Aug 21, 1:49 pm, Sanjay Rajpal srn...@gmail.com 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;jn;j++)         {             if(a[j] i)          

[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 gpt.pa...@gmail.com 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

[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 dheerajsharma1...@gmail.com wrote: it would take c days to take off all the hats On Aug 18, 3:51 pm, pg@manit gpt.pa...@gmail.com wrote: A bunch of men are on an island. A genie comes down and gathers

[algogeeks] Re: MS BRAINTEASR

2011-08-18 Thread DheerajSharma
ur welcume :) On Aug 18, 4:12 pm, payal gupta gpt.pa...@gmail.com wrote: hmm...suitable rply i suppose thanx...:):) REGARDS, PAYAL GUPTA On Thu, Aug 18, 2011 at 4:36 PM, DheerajSharma dheerajsharma1...@gmail.comwrote: it would take c days to take off all the hats

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

[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 macatad...@gmail.com wrote: A string can have many

[algogeeks] Re: Amazon Question

2011-08-18 Thread DheerajSharma
bitset would work i guess On Aug 18, 7:10 pm, hary rathor harry.rat...@gmail.com 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

[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 dheerajsharma1...@gmail.com 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

[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 aditya.kumar130...@gmail.com 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,