particularraj
BAN USERthanks anil for clearing this up.
- particularraj November 12, 2009suffix trees.
- particularraj November 11, 2009hhhmmm...I got you Tejas. Basically we have NO idea if it is rotating above N times. If there is any possible solution to fig out this, then I want to know :)
- particularraj November 10, 2009Your solution will not provide a correct answer if I did 8 rotations. In 8 rotations you will be getting the same output: 5,6,1,2,3,4. But according to your solution it is 2. How you are going to fig out that?
- particularraj November 10, 2009Nice comment KB. Then I guess I have no choice but to iterate it 'N' times and update a static variable, so that we access and get the longest palindrome.
What do you think?
My views:
1. Start with the middle element in the String (len/2).
2. Have two pointers (i and j): i goes back till 0, j goes forward till n.
3. whenever this fails : you have your longest palindrome.
This can be done other way too:
1. Have two pointers i and j at the beginning and at the end.
Like wise. Any takers?
how can you reverse a number? You have to change it to a string?
- particularraj November 09, 2009You got it. Seems like everyone is putting their JUNK code here and does not know how to solve the problem. Thanks !
- particularraj November 09, 2009array should be sorted, if not then this code will not run !
- particularraj November 07, 2009man you are such a douche. I CANT figure out the a single line out of it. Do you see any naming conventions? ...
- particularraj November 03, 2009very good solution Daniel.
- particularraj November 02, 20091. Do a merge sort O(nlogn)
2. Apply the code of removal of duplicates in L.List O(n).
Total complexity: O(nlogn).
Can anyone put their comments?
I could not understand. Can anyone explain step by step? Erik?
- particularraj November 02, 2009nice code, but you are loosing previous pointer. Suppose this is the eg: 1>2>2>2>2>3. When going to 2, you are loosing the pointer when you are doing this:
node_t *tmp = curr;
curr = curr->next;
delete tmp;
As in this eg. you are not connecting 1 to 3. Can you pls explain?
It seems all are writing the same code again and again. The ques said: REMOVE THE DUPLICATES!!!!
So 1>2>2>2>3 should give : 1>3 output. NOT 1>2>3.
We have to completely remove them. Somebody give a better solution to this !!!!
If we are taking any recursive function then we are calling a 'Stack'. To be clear we are not supposed to use 'Stack' over here !!!
- particularraj November 01, 2009we can also use AVL trees too, just becoz they are good in retrieval rather than inserting or deleting.
- particularraj October 30, 2009
My cents:
- particularraj November 12, 2009Building suffix trees is not a bad idea. We can get that in O(nlogn) time.