DEV Community

Discussion on: Solution: Partition List

aarone4 profile image
Aaron Reese

In js at least I would use array.filter into two new arrays and then use the spread operator to merge the arrays. 4 lines of clean code, or 1 line of horrible code if you are a smart-arse Dev 😁

seanpgallivan profile image
seanpgallivan Author

Unfortunately, the input is a linked list, not an array. It's shown as an array in the example just to make it easier to read.