diff --git a/src/main/java/g0001_0100/s0017_letter_combinations_of_a_phone_number/readme.md b/src/main/java/g0001_0100/s0017_letter_combinations_of_a_phone_number/readme.md new file mode 100644 index 000000000..64d940e40 --- /dev/null +++ b/src/main/java/g0001_0100/s0017_letter_combinations_of_a_phone_number/readme.md @@ -0,0 +1,32 @@ +17\. Letter Combinations of a Phone Number + +Medium + +Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**. + +A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. + +![](https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Telephone-keypad2.svg/200px-Telephone-keypad2.svg.png) + +**Example 1:** + +**Input:** digits = "23" + +**Output:** \["ad","ae","af","bd","be","bf","cd","ce","cf"\] + +**Example 2:** + +**Input:** digits = "" + +**Output:** \[\] + +**Example 3:** + +**Input:** digits = "2" + +**Output:** \["a","b","c"\] + +**Constraints:** + +* `0 <= digits.length <= 4` +* `digits[i]` is a digit in the range `['2', '9']`. \ No newline at end of file diff --git a/src/main/java/g0001_0100/s0018_four_sum/readme.md b/src/main/java/g0001_0100/s0018_four_sum/readme.md new file mode 100644 index 000000000..737a3e59a --- /dev/null +++ b/src/main/java/g0001_0100/s0018_four_sum/readme.md @@ -0,0 +1,29 @@ +18\. 4Sum + +Medium + +Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that: + +* `0 <= a, b, c, d < n` +* `a`, `b`, `c`, and `d` are **distinct**. +* `nums[a] + nums[b] + nums[c] + nums[d] == target` + +You may return the answer in **any order**. + +**Example 1:** + +**Input:** nums = \[1,0,-1,0,-2,2\], target = 0 + +**Output:** \[\[-2,-1,1,2\],\[-2,0,0,2\],\[-1,0,0,1\]\] + +**Example 2:** + +**Input:** nums = \[2,2,2,2,2\], target = 8 + +**Output:** \[\[2,2,2,2\]\] + +**Constraints:** + +* `1 <= nums.length <= 200` +* `-109 <= nums[i] <= 109` +* `-109 <= target <= 109` \ No newline at end of file diff --git a/src/main/java/g0001_0100/s0019_remove_nth_node_from_end_of_list/readme.md b/src/main/java/g0001_0100/s0019_remove_nth_node_from_end_of_list/readme.md new file mode 100644 index 000000000..a8197ef96 --- /dev/null +++ b/src/main/java/g0001_0100/s0019_remove_nth_node_from_end_of_list/readme.md @@ -0,0 +1,34 @@ +19\. Remove Nth Node From End of List + +Medium + +Given the `head` of a linked list, remove the `nth` node from the end of the list and return its head. + +**Example 1:** + +![](https://assets.leetcode.com/uploads/2020/10/03/remove_ex1.jpg) + +**Input:** head = \[1,2,3,4,5\], n = 2 + +**Output:** \[1,2,3,5\] + +**Example 2:** + +**Input:** head = \[1\], n = 1 + +**Output:** \[\] + +**Example 3:** + +**Input:** head = \[1,2\], n = 1 + +**Output:** \[1\] + +**Constraints:** + +* The number of nodes in the list is `sz`. +* `1 <= sz <= 30` +* `0 <= Node.val <= 100` +* `1 <= n <= sz` + +**Follow up:** Could you do this in one pass? \ No newline at end of file