geke is valid. BTW if you change "   if(i>=len) " to "   if(i>0)" my code
outputs geke is invalid.( what you desired)
if geke is invalid regarding to the question, then you can achieve the
answer in nLogn by sorting strings :s[0..n-1], s[1..n-1],....s[n-1..n-1]
and comparing adjacent members.
Regards


On Wed, Jun 6, 2012 at 11:52 AM, atul anand <atul.87fri...@gmail.com> wrote:

> nope geke is valid string..
>
> here is the link from where question was taken
>
>
> http://geeksforgeeks.org/forum/topic/amazon-interview-question-password-checker
>
>
> On Wed, Jun 6, 2012 at 11:44 AM, Ashish Goel <ashg...@gmail.com> wrote:
>
>> Hassan geke should not be a valid string. The question states " which
>> have the same substring following it " so here e follows e. There is no
>> precondition that it has to follow immediate.
>>
>> Utsav: can you clarify?
>>
>>
>> Best Regards
>> Ashish Goel
>> "Think positive and find fuel in failure"
>> +919985813081
>> +919966006652
>>
>>
>> On Tue, Jun 5, 2012 at 11:32 PM, Hassan Monfared <hmonfa...@gmail.com>wrote:
>>
>>> yes It's valid, cuz  it doesn't have any repeated substring next together
>>>
>>>
>>> On Tue, Jun 5, 2012 at 7:08 PM, Lomash Goyal <lomesh.go...@gmail.com>wrote:
>>>
>>>> is geke is a invalid strng?
>>>>
>>>>
>>>> On Tue, Jun 5, 2012 at 12:17 PM, Hassan Monfared 
>>>> <hmonfa...@gmail.com>wrote:
>>>>
>>>>> Ashish:
>>>>>
>>>>> the algorithm passes over string and check if there is any substring
>>>>> with len=1 is repeated or not. if not, tries for substring with len 2,...
>>>>> and so on.
>>>>> max length of substring which can be repeated can be at most  N/2.
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>>
>>>>> On Tue, Jun 5, 2012 at 10:48 AM, Ashish Goel <ashg...@gmail.com>wrote:
>>>>>
>>>>>> The problem suggests that a character can't be more than once present
>>>>>> and thereby it can be done by just having s bitmap and if a char repeats,
>>>>>> any longer repeating substring will have those char repeated atleast 
>>>>>> twice,
>>>>>> hence O(n) solution.
>>>>>>
>>>>>>
>>>>>> Also, Hasaan: how is your algo O(n2) for for->while->for chain?
>>>>>>
>>>>>> Best Regards
>>>>>> Ashish Goel
>>>>>> "Think positive and find fuel in failure"
>>>>>> +919985813081
>>>>>> +919966006652
>>>>>>
>>>>>>
>>>>>> On Tue, Jun 5, 2012 at 11:42 AM, Ashish Goel <ashg...@gmail.com>wrote:
>>>>>>
>>>>>>> Hassan, can you explain your algo?
>>>>>>>
>>>>>>> Best Regards
>>>>>>> Ashish Goel
>>>>>>> "Think positive and find fuel in failure"
>>>>>>> +919985813081
>>>>>>> +919966006652
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Jun 4, 2012 at 11:20 AM, Hassan Monfared <
>>>>>>> hmonfa...@gmail.com> wrote:
>>>>>>>
>>>>>>>> for
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>  --
>>>>>> 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.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards
>>>>
>>>> Lomash Goyal
>>>>
>>>> *
>>>> *
>>>>
>>>>
>>>>  --
>>>> 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.
>>
>
>  --
> 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.

Reply via email to