Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Created January 14, 2019 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noitidart/71a20b8bb8032081497e1109d6e46fcd to your computer and use it in GitHub Desktop.
Save Noitidart/71a20b8bb8032081497e1109d6e46fcd to your computer and use it in GitHub Desktop.

Given a linked list and a target, partition the list so that the all integers less than the target is to the left of the target and all the integers equal or greater than the target is to the right of the target.

Target: 5

Input: 2 -> 5 -> 3 -> 9 -> 9 -> 1 -> null Output: 2 -> 3 -> 1 -> 5 -> 9 -> 9 -> null

Time: 1 > log(n) > n > nlog(n) > n^2 > n! > 2^n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment