2022-05-30
Description
Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the linked list sorted as well.
Example 1:

Input: head = [1,2,3,3,4,4,5]
Output: [1,2,5]Example 2:

Input: head = [1,1,1,2,3]
Output: [2,3]Constraints:
The number of nodes in the list is in the range
[0, 300].-100 <= Node.val <= 100The list is guaranteed to be sorted in ascending order.
Solution
Approach #0
Approach #1
Description
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets.
Example 1:
Example 2:
Example 3:
Constraints:
0 <= nums.length <= 3000-10^5 <= nums[i] <= 10^5
Solution
Approach #0
Description
You are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit.
For example, if the path is
0 -> 1 -> 1 -> 0 -> 1, then this could represent01101in binary, which is13.
For all leaves in the tree, consider the numbers represented by the path from the root to that leaf. Return the sum of these numbers.
The test cases are generated so that the answer fits in a 32-bits integer.
Example 1:

Example 2:
Constraints:
The number of nodes in the tree is in the range
[1, 1000].Node.valis0or1.
Solution
Approach #0
Approach #1
Last updated