Question
Given the head
of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well.
https://leetcode.com/problems/remove-duplicates-from-sorted-list/
- Solution1
1 | class Solution { |
Complexity:
Time complexity: O(n)
Space complexity: O(1)