We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Reverse a linked list
- Discussions
Reverse a linked list
Reverse a linked list
Sort by
recency
|
32 Discussions
|
Please Login in order to post a comment
js
Things that I like about this: 'while llist' is quite a nice and expressive way of continuing until you hit the terminal None. Returning 'previous_node', defaulted to None, handles the case of an empty llist (single value: None) 'correctly' for the definition.
Things I'm not convinced about: Python should let you swap three variables inline without needing a temporary variable (a, b, c = c, a, b) but expressing things like this feels harder to read (and order is important) versus having a temporary variable and doing things on separate lines.
For the Haskell version:
Who in their damn mind had the great idea of causing a name clash with the reverse function at Data.List and making it impossible to fix the template code?? It does not even compile because of a mistake in the grayed out code.
Java 15
Kotlin version has a bug. It will not add a space between testcases. So it will fail because of that. Also Java 8 version won't compile beacause of static declaration. Waste of time.