We dont need to worry if its repeated three times or hundred times.....We stop bothering once we are confirmed its repeated twice I have posted my working code in a previous post on the same question.Please read my code and let me know wats the problem,
On Tue, Aug 2, 2011 at 10:58 PM, muthu raj <[email protected]> wrote: > @saurabh : i got the complete idea. Can u explain how will bit > represenation be if a character is repeated 3 times? its set as 1 ryt? > *Muthuraj > > IV th Year , ISE > PESIT , Bangalore > * > > > > > On Tue, Aug 2, 2011 at 10:27 PM, saurabh singh <[email protected]>wrote: > >> my hash table was my bits....read again....I have posted this soln. >> earlier post too,,,posting again.. >> 1.scan string. >> let the ascii value of each char visited be i >> if ith bit set >> then check visited region(last 4 ints) for ith bit >> if ith bit set do nothing >> else set it >> 2.if not set set the ith bit in the count region(first four ints) set it. >> 3.Now you done with scanning scan again checking the visited region for >> the ith bit.If set continue. >> else return the char, >> 4.If out of loop return -1 >> >> Hope I am clear now????If I am still not clear sorry I can't be more clear >> than this...... >> On Tue, Aug 2, 2011 at 7:31 PM, muthu raj <[email protected]> wrote: >> >>> 1) subjective question: >>> >>> To find the first repetitive character how can you use bits because you >>> cannot keep track of first repeated character and also if a character is >>> present more than twice for ex thrice its mask shows 1 indicating it has >>> occured once. So please tell how to implement in O(1) space. If we use Hash >>> table we can do it in O(n) space and time. >>> >>> >>> >>> *Muthuraj R >>> IV th Year , ISE >>> PESIT , Bangalore* >>> >>> >>> >>> On Tue, Aug 2, 2011 at 7:24 PM, saurabh singh <[email protected]>wrote: >>> >>>> and optimize as much as you can...even if the interviewer says that he >>>> is satisfied.... >>>> I was asked Q.1 mentioned above.I first used bitset.He asked me if I >>>> could do in pure c without using *any other function.*While I was >>>> working on my code he said he will be ok if I use an int array of 256.I >>>> kept telling him I could do better,he need not worry.I ended up with just 8 >>>> int variables(and an internship with MS) :)* * >>>> >>>> >>>> On Tue, Aug 2, 2011 at 6:55 PM, sourabh jakhar <[email protected] >>>> > wrote: >>>> >>>>> abe dce se kitne leke gaye ms final year se aur package kya offer kiya >>>>> >>>>> >>>>> On Tue, Aug 2, 2011 at 6:21 PM, Anurag atri >>>>> <[email protected]>wrote: >>>>> >>>>>> you have to be in formals for sure ! >>>>>> yes , people who clear the written will have 3 interviews . >>>>>> >>>>>> >>>>>> On Tue, Aug 2, 2011 at 2:15 PM, saurabh modi < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> hey man,could you tell something abt the attire and all.? >>>>>>> we dont need to go in formals,right? >>>>>>> plus,koi interview and all hoga? >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Algorithm Geeks" 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/algogeeks?hl=en. >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Regards >>>>>> Anurag Atri >>>>>> III year >>>>>> Computer Engineering >>>>>> Delhi College Of Engineering >>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Algorithm Geeks" 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/algogeeks?hl=en. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> SOURABH JAKHAR,(CSE)(Final year) >>>>> ROOM NO 167 , >>>>> TILAK,HOSTEL >>>>> 'MNNIT ALLAHABAD >>>>> >>>>> The Law of Win says, "Let's not do it your way or my way; let's do it >>>>> the best way." >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" 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/algogeeks?hl=en. >>>>> >>>> >>>> >>>> >>>> -- >>>> Saurabh Singh >>>> B.Tech (Computer Science) >>>> MNNIT ALLAHABAD >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" 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/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 [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> Saurabh Singh >> B.Tech (Computer Science) >> MNNIT ALLAHABAD >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" 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/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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" 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/algogeeks?hl=en.
