bowang0911/leetcode huggingface dataset:
Verifying an Alien Dictionary

In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different `order`. The `order` of the alphabet is some permutation of lowercase letters.

Given a sequence of `words` written in the alien language, and the `order` of the alphabet, return `true` if and only if the given `words` are sorted lexicographically in this alien language.

**Example 1:**

**Input:** words = \[ "hello ", "leetcode "\], order =  "hlabcdefgijkmnopqrstuvwxyz "
**Output:** true
**Explanation:** As 'h' comes before 'l' in this language, then the sequence is sorted.

**Example 2:**

**Input:** words = \[ "word ", "world ", "row "\], order =  "worldabcefghijkmnpqstuvxyz "
**Output:** false
**Explanation:** As 'd' comes after 'l' in this language, then words\[0\] > words\[1\], hence the sequence is unsorted.

**Example 3:**

**Input:** words = \[ "apple ", "app "\], order =  "abcdefghijklmnopqrstuvwxyz "
**Output:** false
**Explanation:** The first three characters  "app " match, and the second string is shorter (in size.) According to lexicographical rules  "apple " >  "app ", because 'l' > '∅', where '∅' is defined as the blank character which is less than any other character ([More info](https://en.wikipedia.org/wiki/Lexicographical_order)).

**Constraints:**

*   `1 <= words.length <= 100`
*   `1 <= words[i].length <= 20`
*   `order.length == 26`
*   All characters in `words[i]` and `order` are English lowercase letters.
Array of Doubled Pairs

Given an integer array of even length `arr`, return `true` _if it is possible to reorder_ `arr` _such that_ `arr[2 * i + 1] = 2 * arr[2 * i]` _for every_ `0 <= i < len(arr) / 2`_, or_ `false` _otherwise_.

**Example 1:**

**Input:** arr = \[3,1,3,6\]
**Output:** false

**Example 2:**

**Input:** arr = \[2,1,2,6\]
**Output:** false

**Example 3:**

**Input:** arr = \[4,-2,2,-4\]
**Output:** true
**Explanation:** We can take two groups, \[-2,-4\] and \[2,4\] to form \[-2,-4,2,4\] or \[2,4,-2,-4\].

**Constraints:**

*   `2 <= arr.length <= 3 * 104`
*   `arr.length` is even.
*   `-105 <= arr[i] <= 105`
Delete Columns to Make Sorted II

You are given an array of `n` strings `strs`, all of the same length.

We may choose any deletion indices, and we delete all the characters in those indices for each string.

For example, if we have `strs = [ "abcdef ", "uvwxyz "]` and deletion indices `{0, 2, 3}`, then the final array after deletions is `[ "bef ", "vyz "]`.

Suppose we chose a set of deletion indices `answer` such that after deletions, the final array has its elements in **lexicographic** order (i.e., `strs[0] <= strs[1] <= strs[2] <= ... <= strs[n - 1]`). Return _the minimum possible value of_ `answer.length`.

**Example 1:**

**Input:** strs = \[ "ca ", "bb ", "ac "\]
**Output:** 1
**Explanation:** 
After deleting the first column, strs = \[ "a ",  "b ",  "c "\].
Now strs is in lexicographic order (ie. strs\[0\] <= strs\[1\] <= strs\[2\]).
We require at least 1 deletion since initially strs was not in lexicographic order, so the answer is 1.

**Example 2:**

**Input:** strs = \[ "xc ", "yb ", "za "\]
**Output:** 0
**Explanation:** 
strs is already in lexicographic order, so we do not need to delete anything.
Note that the rows of strs are not necessarily in lexicographic order:
i.e., it is NOT necessarily true that (strs\[0\]\[0\] <= strs\[0\]\[1\] <= ...)

**Example 3:**

**Input:** strs = \[ "zyx ", "wvu ", "tsr "\]
**Output:** 3
**Explanation:** We have to delete every column.

**Constraints:**

*   `n == strs.length`
*   `1 <= n <= 100`
*   `1 <= strs[i].length <= 100`
*   `strs[i]` consists of lowercase English letters.
Tallest Billboard

You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height.

You are given a collection of `rods` that can be welded together. For example, if you have rods of lengths `1`, `2`, and `3`, you can weld them together to make a support of length `6`.

Return _the largest possible height of your billboard installation_. If you cannot support the billboard, return `0`.

**Example 1:**

**Input:** rods = \[1,2,3,6\]
**Output:** 6
**Explanation:** We have two disjoint subsets {1,2,3} and {6}, which have the same sum = 6.

**Example 2:**

**Input:** rods = \[1,2,3,4,5,6\]
**Output:** 10
**Explanation:** We have two disjoint subsets {2,3,5} and {4,6}, which have the same sum = 10.

**Example 3:**

**Input:** rods = \[1,2\]
**Output:** 0
**Explanation:** The billboard cannot be supported, so we return 0.

**Constraints:**

*   `1 <= rods.length <= 20`
*   `1 <= rods[i] <= 1000`
*   `sum(rods[i]) <= 5000`
Prison Cells After N Days

There are `8` prison cells in a row and each cell is either occupied or vacant.

Each day, whether the cell is occupied or vacant changes according to the following rules:

*   If a cell has two adjacent neighbors that are both occupied or both vacant, then the cell becomes occupied.
*   Otherwise, it becomes vacant.

**Note** that because the prison is a row, the first and the last cells in the row can't have two adjacent neighbors.

You are given an integer array `cells` where `cells[i] == 1` if the `ith` cell is occupied and `cells[i] == 0` if the `ith` cell is vacant, and you are given an integer `n`.

Return the state of the prison after `n` days (i.e., `n` such changes described above).

**Example 1:**

**Input:** cells = \[0,1,0,1,1,0,0,1\], n = 7
**Output:** \[0,0,1,1,0,0,0,0\]
**Explanation:** The following table summarizes the state of the prison on each day:
Day 0: \[0, 1, 0, 1, 1, 0, 0, 1\]
Day 1: \[0, 1, 1, 0, 0, 0, 0, 0\]
Day 2: \[0, 0, 0, 0, 1, 1, 1, 0\]
Day 3: \[0, 1, 1, 0, 0, 1, 0, 0\]
Day 4: \[0, 0, 0, 0, 0, 1, 0, 0\]
Day 5: \[0, 1, 1, 1, 0, 1, 0, 0\]
Day 6: \[0, 0, 1, 0, 1, 1, 0, 0\]
Day 7: \[0, 0, 1, 1, 0, 0, 0, 0\]

**Example 2:**

**Input:** cells = \[1,0,0,1,0,0,1,0\], n = 1000000000
**Output:** \[0,0,1,1,1,1,1,0\]

**Constraints:**

*   `cells.length == 8`
*   `cells[i]` is either `0` or `1`.
*   `1 <= n <= 109`
Check Completeness of a Binary Tree

Given the `root` of a binary tree, determine if it is a _complete binary tree_.

In a **[complete binary tree](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between `1` and `2h` nodes inclusive at the last level `h`.

**Example 1:**

**Input:** root = \[1,2,3,4,5,6\]
**Output:** true
**Explanation:** Every level before the last is full (ie. levels with node-values {1} and {2, 3}), and all nodes in the last level ({4, 5, 6}) are as far left as possible.

**Example 2:**

**Input:** root = \[1,2,3,4,5,null,7\]
**Output:** false
**Explanation:** The node with value 7 isn't as far left as possible.

**Constraints:**

*   The number of nodes in the tree is in the range `[1, 100]`.
*   `1 <= Node.val <= 1000`
Regions Cut By Slashes

An `n x n` grid is composed of `1 x 1` squares where each `1 x 1` square consists of a `'/'`, `'\'`, or blank space `' '`. These characters divide the square into contiguous regions.

Given the grid `grid` represented as a string array, return _the number of regions_.

Note that backslash characters are escaped, so a `'\'` is represented as `'\\'`.

**Example 1:**

**Input:** grid = \[ " / ", "/  "\]
**Output:** 2

**Example 2:**

**Input:** grid = \[ " / ", "   "\]
**Output:** 1

**Example 3:**

**Input:** grid = \[ "/\\\\ ", "\\/ "\]
**Output:** 5
**Explanation:** Recall that because \\ characters are escaped,  "\\/ " refers to /, and  "/\\\\ " refers to /\\.

**Constraints:**

*   `n == grid.length == grid[i].length`
*   `1 <= n <= 30`
*   `grid[i][j]` is either `'/'`, `'\'`, or `' '`.
Delete Columns to Make Sorted III

You are given an array of `n` strings `strs`, all of the same length.

We may choose any deletion indices, and we delete all the characters in those indices for each string.

For example, if we have `strs = [ "abcdef ", "uvwxyz "]` and deletion indices `{0, 2, 3}`, then the final array after deletions is `[ "bef ", "vyz "]`.

Suppose we chose a set of deletion indices `answer` such that after deletions, the final array has **every string (row) in lexicographic** order. (i.e., `(strs[0][0] <= strs[0][1] <= ... <= strs[0][strs[0].length - 1])`, and `(strs[1][0] <= strs[1][1] <= ... <= strs[1][strs[1].length - 1])`, and so on). Return _the minimum possible value of_ `answer.length`.

**Example 1:**

**Input:** strs = \[ "babca ", "bbazb "\]
**Output:** 3
**Explanation:** After deleting columns 0, 1, and 4, the final array is strs = \[ "bc ",  "az "\].
Both these rows are individually in lexicographic order (ie. strs\[0\]\[0\] <= strs\[0\]\[1\] and strs\[1\]\[0\] <= strs\[1\]\[1\]).
Note that strs\[0\] > strs\[1\] - the array strs is not necessarily in lexicographic order.

**Example 2:**

**Input:** strs = \[ "edcba "\]
**Output:** 4
**Explanation:** If we delete less than 4 columns, the only row will not be lexicographically sorted.

**Example 3:**

**Input:** strs = \[ "ghi ", "def ", "abc "\]
**Output:** 0
**Explanation:** All rows are already lexicographically sorted.

**Constraints:**

*   `n == strs.length`
*   `1 <= n <= 100`
*   `1 <= strs[i].length <= 100`
*   `strs[i]` consists of lowercase English letters.
N-Repeated Element in Size 2N Array

You are given an integer array `nums` with the following properties:

*   `nums.length == 2 * n`.
*   `nums` contains `n + 1` **unique** elements.
*   Exactly one element of `nums` is repeated `n` times.

Return _the element that is repeated_ `n` _times_.

**Example 1:**

**Input:** nums = \[1,2,3,3\]
**Output:** 3

**Example 2:**

**Input:** nums = \[2,1,2,5,3,2\]
**Output:** 2

**Example 3:**

**Input:** nums = \[5,1,5,2,5,3,5,4\]
**Output:** 5

**Constraints:**

*   `2 <= n <= 5000`
*   `nums.length == 2 * n`
*   `0 <= nums[i] <= 104`
*   `nums` contains `n + 1` **unique** elements and one of them is repeated exactly `n` times.
Maximum Width Ramp

A **ramp** in an integer array `nums` is a pair `(i, j)` for which `i < j` and `nums[i] <= nums[j]`. The **width** of such a ramp is `j - i`.

Given an integer array `nums`, return _the maximum width of a **ramp** in_ `nums`. If there is no **ramp** in `nums`, return `0`.

**Example 1:**

**Input:** nums = \[6,0,8,2,1,5\]
**Output:** 4
**Explanation:** The maximum width ramp is achieved at (i, j) = (1, 5): nums\[1\] = 0 and nums\[5\] = 5.

**Example 2:**

**Input:** nums = \[9,8,1,0,1,9,4,0,4,1\]
**Output:** 7
**Explanation:** The maximum width ramp is achieved at (i, j) = (2, 9): nums\[2\] = 1 and nums\[9\] = 1.

**Constraints:**

*   `2 <= nums.length <= 5 * 104`
*   `0 <= nums[i] <= 5 * 104`
Minimum Area Rectangle II

You are given an array of points in the **X-Y** plane `points` where `points[i] = [xi, yi]`.

Return _the minimum area of any rectangle formed from these points, with sides **not necessarily parallel** to the X and Y axes_. If there is not any such rectangle, return `0`.

Answers within `10-5` of the actual answer will be accepted.

**Example 1:**

**Input:** points = \[\[1,2\],\[2,1\],\[1,0\],\[0,1\]\]
**Output:** 2.00000
**Explanation:** The minimum area rectangle occurs at \[1,2\],\[2,1\],\[1,0\],\[0,1\], with an area of 2.

**Example 2:**

**Input:** points = \[\[0,1\],\[2,1\],\[1,1\],\[1,0\],\[2,0\]\]
**Output:** 1.00000
**Explanation:** The minimum area rectangle occurs at \[1,0\],\[1,1\],\[2,1\],\[2,0\], with an area of 1.

**Example 3:**

**Input:** points = \[\[0,3\],\[1,2\],\[3,1\],\[1,3\],\[2,1\]\]
**Output:** 0
**Explanation:** There is no possible rectangle to form from these points.

**Constraints:**

*   `1 <= points.length <= 50`
*   `points[i].length == 2`
*   `0 <= xi, yi <= 4 * 104`
*   All the given points are **unique**.
Least Operators to Express Number

Given a single positive integer `x`, we will write an expression of the form `x (op1) x (op2) x (op3) x ...` where each operator `op1`, `op2`, etc. is either addition, subtraction, multiplication, or division (`+`, `-`, `*`, or `/)`. For example, with `x = 3`, we might write `3 * 3 / 3 + 3 - 3` which is a value of 3.

When writing such an expression, we adhere to the following conventions:

*   The division operator (`/`) returns rational numbers.
*   There are no parentheses placed anywhere.
*   We use the usual order of operations: multiplication and division happen before addition and subtraction.
*   It is not allowed to use the unary negation operator (`-`). For example, "`x - x` " is a valid expression as it only uses subtraction, but "`-x + x` " is not because it uses negation.

We would like to write an expression with the least number of operators such that the expression equals the given `target`. Return the least number of operators used.

**Example 1:**

**Input:** x = 3, target = 19
**Output:** 5
**Explanation:** 3 \* 3 + 3 \* 3 + 3 / 3.
The expression contains 5 operations.

**Example 2:**

**Input:** x = 5, target = 501
**Output:** 8
**Explanation:** 5 \* 5 \* 5 \* 5 - 5 \* 5 \* 5 + 5 / 5.
The expression contains 8 operations.

**Example 3:**

**Input:** x = 100, target = 100000000
**Output:** 3
**Explanation:** 100 \* 100 \* 100 \* 100.
The expression contains 3 operations.

**Constraints:**

*   `2 <= x <= 100`
*   `1 <= target <= 2 * 108`
Univalued Binary Tree

A binary tree is **uni-valued** if every node in the tree has the same value.

Given the `root` of a binary tree, return `true` _if the given tree is **uni-valued**, or_ `false` _otherwise._

**Example 1:**

**Input:** root = \[1,1,1,1,1,null,1\]
**Output:** true

**Example 2:**

**Input:** root = \[2,2,2,5,2\]
**Output:** false

**Constraints:**

*   The number of nodes in the tree is in the range `[1, 100]`.
*   `0 <= Node.val < 100`
Vowel Spellchecker

Given a `wordlist`, we want to implement a spellchecker that converts a query word into a correct word.

For a given `query` word, the spell checker handles two categories of spelling mistakes:

*   Capitalization: If the query matches a word in the wordlist (**case-insensitive**), then the query word is returned with the same case as the case in the wordlist.
    *   Example: `wordlist = [ "yellow "]`, `query = "YellOw "`: `correct = "yellow "`
    *   Example: `wordlist = [ "Yellow "]`, `query = "yellow "`: `correct = "Yellow "`
    *   Example: `wordlist = [ "yellow "]`, `query = "yellow "`: `correct = "yellow "`
*   Vowel Errors: If after replacing the vowels `('a', 'e', 'i', 'o', 'u')` of the query word with any vowel individually, it matches a word in the wordlist (**case-insensitive**), then the query word is returned with the same case as the match in the wordlist.
    *   Example: `wordlist = [ "YellOw "]`, `query = "yollow "`: `correct = "YellOw "`
    *   Example: `wordlist = [ "YellOw "]`, `query = "yeellow "`: `correct = " "` (no match)
    *   Example: `wordlist = [ "YellOw "]`, `query = "yllw "`: `correct = " "` (no match)

In addition, the spell checker operates under the following precedence rules:

*   When the query exactly matches a word in the wordlist (**case-sensitive**), you should return the same word back.
*   When the query matches a word up to capitlization, you should return the first such match in the wordlist.
*   When the query matches a word up to vowel errors, you should return the first such match in the wordlist.
*   If the query has no matches in the wordlist, you should return the empty string.

Given some `queries`, return a list of words `answer`, where `answer[i]` is the correct word for `query = queries[i]`.

**Example 1:**

**Input:** wordlist = \["KiTe","kite","hare","Hare"\], queries = \["kite","Kite","KiTe","Hare","HARE","Hear","hear","keti","keet","keto"\]
**Output:** \["kite","KiTe","KiTe","Hare","hare","","","KiTe","","KiTe"\]

**Example 2:**

**Input:** wordlist = \["yellow"\], queries = \["YellOw"\]
**Output:** \["yellow"\]

**Constraints:**

*   `1 <= wordlist.length, queries.length <= 5000`
*   `1 <= wordlist[i].length, queries[i].length <= 7`
*   `wordlist[i]` and `queries[i]` consist only of only English letters.
Numbers With Same Consecutive Differences

Given two integers n and k, return _an array of all the integers of length_ `n` _where the difference between every two consecutive digits is_ `k`. You may return the answer in **any order**.

Note that the integers should not have leading zeros. Integers as `02` and `043` are not allowed.

**Example 1:**

**Input:** n = 3, k = 7
**Output:** \[181,292,707,818,929\]
**Explanation:** Note that 070 is not a valid number, because it has leading zeroes.

**Example 2:**

**Input:** n = 2, k = 1
**Output:** \[10,12,21,23,32,34,43,45,54,56,65,67,76,78,87,89,98\]

**Constraints:**

*   `2 <= n <= 9`
*   `0 <= k <= 9`
Binary Tree Cameras

You are given the `root` of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children.

Return _the minimum number of cameras needed to monitor all nodes of the tree_.

**Example 1:**

**Input:** root = \[0,0,null,0,0\]
**Output:** 1
**Explanation:** One camera is enough to monitor all nodes if placed as shown.

**Example 2:**

**Input:** root = \[0,0,null,0,null,0,null,null,0\]
**Output:** 2
**Explanation:** At least two cameras are needed to monitor all nodes of the tree. The above image shows one of the valid configurations of camera placement.

**Constraints:**

*   The number of nodes in the tree is in the range `[1, 1000]`.
*   `Node.val == 0`
Pancake Sorting

Given an array of integers `arr`, sort the array by performing a series of **pancake flips**.

In one pancake flip we do the following steps:

*   Choose an integer `k` where `1 <= k <= arr.length`.
*   Reverse the sub-array `arr[0...k-1]` (**0-indexed**).

For example, if `arr = [3,2,1,4]` and we performed a pancake flip choosing `k = 3`, we reverse the sub-array `[3,2,1]`, so `arr = [1,2,3,4]` after the pancake flip at `k = 3`.

Return _an array of the_ `k`_\-values corresponding to a sequence of pancake flips that sort_ `arr`. Any valid answer that sorts the array within `10 * arr.length` flips will be judged as correct.

**Example 1:**

**Input:** arr = \[3,2,4,1\]
**Output:** \[4,2,4,3\]
**Explanation:** 
We perform 4 pancake flips, with k values 4, 2, 4, and 3.
Starting state: arr = \[3, 2, 4, 1\]
After 1st flip (k = 4): arr = \[1, 4, 2, 3\]
After 2nd flip (k = 2): arr = \[4, 1, 2, 3\]
After 3rd flip (k = 4): arr = \[3, 2, 1, 4\]
After 4th flip (k = 3): arr = \[1, 2, 3, 4\], which is sorted.

**Example 2:**

**Input:** arr = \[1,2,3\]
**Output:** \[\]
**Explanation:** The input is already sorted, so there is no need to flip anything.
Note that other answers, such as \[3, 3\], would also be accepted.

**Constraints:**

*   `1 <= arr.length <= 100`
*   `1 <= arr[i] <= arr.length`
*   All integers in `arr` are unique (i.e. `arr` is a permutation of the integers from `1` to `arr.length`).
Powerful Integers

Given three integers `x`, `y`, and `bound`, return _a list of all the **powerful integers** that have a value less than or equal to_ `bound`.

An integer is **powerful** if it can be represented as `xi + yj` for some integers `i >= 0` and `j >= 0`.

You may return the answer in **any order**. In your answer, each value should occur **at most once**.

**Example 1:**

**Input:** x = 2, y = 3, bound = 10
**Output:** \[2,3,4,5,7,9,10\]
**Explanation:**
2 = 20 + 30
3 = 21 + 30
4 = 20 + 31
5 = 21 + 31
7 = 22 + 31
9 = 23 + 30
10 = 20 + 32

**Example 2:**

**Input:** x = 3, y = 5, bound = 15
**Output:** \[2,4,6,8,10,14\]

**Constraints:**

*   `1 <= x, y <= 100`
*   `0 <= bound <= 106`
Flip Binary Tree To Match Preorder Traversal

You are given the `root` of a binary tree with `n` nodes, where each node is uniquely assigned a value from `1` to `n`. You are also given a sequence of `n` values `voyage`, which is the **desired** [**pre-order traversal**](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order) of the binary tree.

Any node in the binary tree can be **flipped** by swapping its left and right subtrees. For example, flipping node 1 will have the following effect:

Flip the **smallest** number of nodes so that the **pre-order traversal** of the tree **matches** `voyage`.

Return _a list of the values of all **flipped** nodes. You may return the answer in **any order**. If it is **impossible** to flip the nodes in the tree to make the pre-order traversal match_ `voyage`_, return the list_ `[-1]`.

**Example 1:**

**Input:** root = \[1,2\], voyage = \[2,1\]
**Output:** \[-1\]
**Explanation:** It is impossible to flip the nodes such that the pre-order traversal matches voyage.

**Example 2:**

**Input:** root = \[1,2,3\], voyage = \[1,3,2\]
**Output:** \[1\]
**Explanation:** Flipping node 1 swaps nodes 2 and 3, so the pre-order traversal matches voyage.

**Example 3:**

**Input:** root = \[1,2,3\], voyage = \[1,2,3\]
**Output:** \[\]
**Explanation:** The tree's pre-order traversal already matches voyage, so no nodes need to be flipped.

**Constraints:**

*   The number of nodes in the tree is `n`.
*   `n == voyage.length`
*   `1 <= n <= 100`
*   `1 <= Node.val, voyage[i] <= n`
*   All the values in the tree are **unique**.
*   All the values in `voyage` are **unique**.
Equal Rational Numbers

Given two strings `s` and `t`, each of which represents a non-negative rational number, return `true` if and only if they represent the same number. The strings may use parentheses to denote the repeating part of the rational number.

A **rational number** can be represented using up to three parts: , , and a . The number will be represented in one of the following three ways:

*   *   For example, `12`, `0`, and `123`.
*   `**<.>**`
    *   For example, `0.5`, `1.`, `2.12`, and `123.0001`.
*   `**<.>****<(>****<)>**`
    *   For example, `0.1(6)`, `1.(9)`, `123.00(1212)`.

The repeating portion of a decimal expansion is conventionally denoted within a pair of round brackets. For example:

*   `1/6 = 0.16666666... = 0.1(6) = 0.1666(6) = 0.166(66)`.

**Example 1:**

**Input:** s =  "0.(52) ", t =  "0.5(25) "
**Output:** true
**Explanation:** Because  "0.(52) " represents 0.52525252..., and  "0.5(25) " represents 0.52525252525..... , the strings represent the same number.

**Example 2:**

**Input:** s =  "0.1666(6) ", t =  "0.166(66) "
**Output:** true

**Example 3:**

**Input:** s =  "0.9(9) ", t =  "1. "
**Output:** true
**Explanation:**  "0.9(9) " represents 0.999999999... repeated forever, which equals 1.  \[[See this link for an explanation.](https://en.wikipedia.org/wiki/0.999...)\]
 "1. " represents the number 1, which is formed correctly: (IntegerPart) =  "1 " and (NonRepeatingPart) =  " ".

**Constraints:**

*   Each part consists only of digits.
*   The does not have leading zeros (except for the zero itself).
*   `1 <= .length <= 4`
*   `0 <= .length <= 4`
*   `1 <= .length <= 4`
K Closest Points to Origin

Given an array of `points` where `points[i] = [xi, yi]` represents a point on the **X-Y** plane and an integer `k`, return the `k` closest points to the origin `(0, 0)`.

The distance between two points on the **X-Y** plane is the Euclidean distance (i.e., `√(x1 - x2)2 + (y1 - y2)2`).

You may return the answer in **any order**. The answer is **guaranteed** to be **unique** (except for the order that it is in).

**Example 1:**

**Input:** points = \[\[1,3\],\[-2,2\]\], k = 1
**Output:** \[\[-2,2\]\]
**Explanation:**
The distance between (1, 3) and the origin is sqrt(10).
The distance between (-2, 2) and the origin is sqrt(8).
Since sqrt(8) < sqrt(10), (-2, 2) is closer to the origin.
We only want the closest k = 1 points from the origin, so the answer is just \[\[-2,2\]\].

**Example 2:**

**Input:** points = \[\[3,3\],\[5,-1\],\[-2,4\]\], k = 2
**Output:** \[\[3,3\],\[-2,4\]\]
**Explanation:** The answer \[\[-2,4\],\[3,3\]\] would also be accepted.

**Constraints:**

*   `1 <= k <= points.length <= 104`
*   `-104 < xi, yi < 104`