R&D software engineer interview questions shared by candidates
Given a linked list, write a function that will print the list in reverse.
Do this in linear O(n) time without recursion and without creating a copy of the list. [Hint] You can modify the list, as long as you put it back the way it started.
Traverse the list from start to end updating the link addresses such that the second node points to first, third node points to second and so on. when we reach the last node we will have reverse list. Now repeat the whole process but this time printing the elements of the nodes. We will get the original list back and items printed are in reverse order as well. I am proud of myself !! :)
Q: How do you reaarange array elements in such a way that all even numbers come first followed by all odd numbers. Q: Hashmap, List , set,binary trees questions.