Problem Submissions Solution

Categorize even and odd nodes in a Linked List

Difficulty: Medium

Acceptance: %

Points: 30.00

Given a link list, modify the list such that all the even numbers appear before all the odd numbers in the modified list. The order of appearance of numbers within each segregation should be the same as that in the original list.

NOTE: Don't create a new linked list, instead rearrange the provided one.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n)

Expected Space Complexity: O(1)

Constraints:
  • 1 <= size of linked list <= 10^5
  • 1 <= Each element of the list <= 10^5
Companies:
Amazon Visa Oracle Goldman Sachs Paypal
Topics:
Linked List
Locked Content
Access Restricted: Please Login to access the code editor and test cases.