diff --git a/.github/images/composer_fly_150.gif b/.github/images/composer_fly_150.gif deleted file mode 100644 index 3f39657..0000000 Binary files a/.github/images/composer_fly_150.gif and /dev/null differ diff --git a/.github/images/composer_fly_first.png b/.github/images/composer_fly_first.png deleted file mode 100644 index feab698..0000000 Binary files a/.github/images/composer_fly_first.png and /dev/null differ diff --git a/.gitignore b/.gitignore index 5381672..b7dab5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,34 +1,2 @@ -# Logs -logs -*.log - -package-lock.json -# Runtime data -pids -*.pid -*.seed -*.eot -*.svg -*.woff* -*.eot -*.ttf -*.html -app.js - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -build - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git node_modules +build \ No newline at end of file diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/1-two-sum/2022-04-24 20.32.16 - Accepted - runtime 7220ms - memory 14.9MB.py b/1-two-sum/2022-04-24 20.32.16 - Accepted - runtime 7220ms - memory 14.9MB.py deleted file mode 100644 index 64c5a38..0000000 --- a/1-two-sum/2022-04-24 20.32.16 - Accepted - runtime 7220ms - memory 14.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - _len = len(nums) - for i in range(_len): - for j in range(i + 1, _len): - if nums[i] + nums[j] == target: return [i, j] \ No newline at end of file diff --git a/1-two-sum/2022-04-24 20.33.20 - Accepted - runtime 86ms - memory 15.3MB.py b/1-two-sum/2022-04-24 20.33.20 - Accepted - runtime 86ms - memory 15.3MB.py deleted file mode 100644 index 305606a..0000000 --- a/1-two-sum/2022-04-24 20.33.20 - Accepted - runtime 86ms - memory 15.3MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - hashmap = {} - for i in range(len(nums)): - hashmap[nums[i]] = i - for i in range(len(nums)): - complement = target - nums[i] - if complement in hashmap and hashmap[complement] != i: - return [i, hashmap[complement]] \ No newline at end of file diff --git a/1-two-sum/2022-04-24 20.33.33 - Accepted - runtime 69ms - memory 15.2MB.py b/1-two-sum/2022-04-24 20.33.33 - Accepted - runtime 69ms - memory 15.2MB.py deleted file mode 100644 index 3564ec7..0000000 --- a/1-two-sum/2022-04-24 20.33.33 - Accepted - runtime 69ms - memory 15.2MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - hashmap = {} - for i in range(len(nums)): - complement = target - nums[i] - if complement in hashmap: - return [i, hashmap[complement]] - hashmap[nums[i]] = i \ No newline at end of file diff --git a/1-two-sum/2022-04-24 20.33.39 - Accepted - runtime 66ms - memory 15.1MB.py b/1-two-sum/2022-04-24 20.33.39 - Accepted - runtime 66ms - memory 15.1MB.py deleted file mode 100644 index 3564ec7..0000000 --- a/1-two-sum/2022-04-24 20.33.39 - Accepted - runtime 66ms - memory 15.1MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - hashmap = {} - for i in range(len(nums)): - complement = target - nums[i] - if complement in hashmap: - return [i, hashmap[complement]] - hashmap[nums[i]] = i \ No newline at end of file diff --git a/1-two-sum/2022-04-24 20.59.59 - Accepted - runtime 107ms - memory 15.4MB.py b/1-two-sum/2022-04-24 20.59.59 - Accepted - runtime 107ms - memory 15.4MB.py deleted file mode 100644 index e8df39d..0000000 --- a/1-two-sum/2022-04-24 20.59.59 - Accepted - runtime 107ms - memory 15.4MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - remainders = {} - for i in range(len(nums)): - remainder = target - nums[i] - if remainder in remainders: - return [remainders[remainder], i] - remainders[target - remainder] = i \ No newline at end of file diff --git a/1-two-sum/2022-04-24 21.00.39 - Accepted - runtime 69ms - memory 15.3MB.py b/1-two-sum/2022-04-24 21.00.39 - Accepted - runtime 69ms - memory 15.3MB.py deleted file mode 100644 index 6de7b75..0000000 --- a/1-two-sum/2022-04-24 21.00.39 - Accepted - runtime 69ms - memory 15.3MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - remainders = {} - for i in range(len(nums)): - remainder = target - nums[i] - if remainder in remainders: - return [remainders[remainder], i] - remainders[nums[i]] = i \ No newline at end of file diff --git a/1-two-sum/2022-06-14 17.49.42 - Accepted - runtime 109ms - memory 15.4MB.py b/1-two-sum/2022-06-14 17.49.42 - Accepted - runtime 109ms - memory 15.4MB.py deleted file mode 100644 index 9b29719..0000000 --- a/1-two-sum/2022-06-14 17.49.42 - Accepted - runtime 109ms - memory 15.4MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - d = {} - for ind, i in enumerate(nums): - rem = target - i - if i in d: - return [ind, d[i]] - d[rem] = ind \ No newline at end of file diff --git a/1-two-sum/2022-06-14 17.49.56 - Accepted - runtime 132ms - memory 15.4MB.py b/1-two-sum/2022-06-14 17.49.56 - Accepted - runtime 132ms - memory 15.4MB.py deleted file mode 100644 index 9b29719..0000000 --- a/1-two-sum/2022-06-14 17.49.56 - Accepted - runtime 132ms - memory 15.4MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - d = {} - for ind, i in enumerate(nums): - rem = target - i - if i in d: - return [ind, d[i]] - d[rem] = ind \ No newline at end of file diff --git a/1-two-sum/2022-12-30 22.14.34 - Accepted - runtime 56ms - memory 15.4MB.py b/1-two-sum/2022-12-30 22.14.34 - Accepted - runtime 56ms - memory 15.4MB.py deleted file mode 100644 index a007806..0000000 --- a/1-two-sum/2022-12-30 22.14.34 - Accepted - runtime 56ms - memory 15.4MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - D = {} - for ind, i in enumerate(nums): - if i in D: - return [D[i], ind] - D[target - i] = ind - - return [-1] \ No newline at end of file diff --git a/1-two-sum/2024-02-16 13.41.13 - Accepted - runtime 8ms - memory 14.1MB.cpp b/1-two-sum/2024-02-16 13.41.13 - Accepted - runtime 8ms - memory 14.1MB.cpp deleted file mode 100644 index e304391..0000000 --- a/1-two-sum/2024-02-16 13.41.13 - Accepted - runtime 8ms - memory 14.1MB.cpp +++ /dev/null @@ -1,14 +0,0 @@ -class Solution { -public: - vector twoSum(vector& nums, int target) { - std::unordered_map indices; - for (int ind = 0; ind < nums.size(); ++ind) { - int t = target - nums[ind]; - if (indices.find(t) != indices.end()) { - return {indices[t], ind}; - } - indices[nums[ind]] = ind; - } - return {}; - } -}; \ No newline at end of file diff --git a/1-two-sum/2024-03-08 19.17.13 - Accepted - runtime 51ms - memory 17.9MB.py b/1-two-sum/2024-03-08 19.17.13 - Accepted - runtime 51ms - memory 17.9MB.py deleted file mode 100644 index 2b671ce..0000000 --- a/1-two-sum/2024-03-08 19.17.13 - Accepted - runtime 51ms - memory 17.9MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - d = {} - for ind, i in enumerate(nums): - if i in d: - return [d[i], ind] - - d[target - i] = ind - - return 1 diff --git a/10-regular-expression-matching/2024-03-10 18.10.28 - Accepted - runtime 82ms - memory 16.6MB.py b/10-regular-expression-matching/2024-03-10 18.10.28 - Accepted - runtime 82ms - memory 16.6MB.py deleted file mode 100644 index 4974887..0000000 --- a/10-regular-expression-matching/2024-03-10 18.10.28 - Accepted - runtime 82ms - memory 16.6MB.py +++ /dev/null @@ -1,9 +0,0 @@ -from re import match, sub -class Solution: - def isMatch(self, s: str, p: str) -> bool: - p = sub(r'\*+', '*', p) - m = match(p, s) - if not m: - return m - - return m.group(0) == s \ No newline at end of file diff --git a/100-same-tree/2022-06-24 17.00.11 - Accepted - runtime 62ms - memory 13.8MB.py b/100-same-tree/2022-06-24 17.00.11 - Accepted - runtime 62ms - memory 13.8MB.py deleted file mode 100644 index 87bee70..0000000 --- a/100-same-tree/2022-06-24 17.00.11 - Accepted - runtime 62ms - memory 13.8MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def check(self, node1: Optional[TreeNode], node2: Optional[TreeNode]) -> bool: - if not node1: - return not node2 - if not node2: - return False - if node1.val != node2.val: - return False - return self.check(node1.left, node2.left) and self.check(node1.right, node2.right) - - - def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: - return self.check(p, q) \ No newline at end of file diff --git a/100-same-tree/2023-01-10 19.53.33 - Accepted - runtime 32ms - memory 14MB.py b/100-same-tree/2023-01-10 19.53.33 - Accepted - runtime 32ms - memory 14MB.py deleted file mode 100644 index 2b422e6..0000000 --- a/100-same-tree/2023-01-10 19.53.33 - Accepted - runtime 32ms - memory 14MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: - if not p or not q: - return p == q - - p_stack = [p] - q_stack = [q] - - while p_stack or q_stack: - p = p_stack.pop() - q = q_stack.pop() - if p and q: - if p.val != q.val: - return False - p_stack.extend([p.left, p.right]) - q_stack.extend([q.left, q.right]) - - else: - if p != q:return False - - return True \ No newline at end of file diff --git a/100-same-tree/2024-02-18 16.55.55 - Accepted - runtime 0ms - memory 11.5MB.cpp b/100-same-tree/2024-02-18 16.55.55 - Accepted - runtime 0ms - memory 11.5MB.cpp deleted file mode 100644 index bf429fb..0000000 --- a/100-same-tree/2024-02-18 16.55.55 - Accepted - runtime 0ms - memory 11.5MB.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - bool isSameTree(TreeNode* p, TreeNode* q) { - if (!p || !q) return p == q; - return p -> val == q -> val && - isSameTree(p -> left, q -> left) && isSameTree(p -> right, q -> right); - } -}; \ No newline at end of file diff --git a/100-same-tree/2024-02-26 15.58.30 - Accepted - runtime 5ms - memory 11.5MB.cpp b/100-same-tree/2024-02-26 15.58.30 - Accepted - runtime 5ms - memory 11.5MB.cpp deleted file mode 100644 index 3c5ec0e..0000000 --- a/100-same-tree/2024-02-26 15.58.30 - Accepted - runtime 5ms - memory 11.5MB.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - bool isSameTree(TreeNode* p, TreeNode* q) { - if (!p || !q) return p == q; - return p->val == q->val && isSameTree(p->left, q->left) && isSameTree(p->right, q->right); - } -}; \ No newline at end of file diff --git a/1005-univalued-binary-tree/2024-01-27 19.51.54 - Accepted - runtime 37ms - memory 16.7MB.py b/1005-univalued-binary-tree/2024-01-27 19.51.54 - Accepted - runtime 37ms - memory 16.7MB.py deleted file mode 100644 index 8e09400..0000000 --- a/1005-univalued-binary-tree/2024-01-27 19.51.54 - Accepted - runtime 37ms - memory 16.7MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def isUnivalTree(self, root: Optional[TreeNode]) -> bool: - k = set() - s = [root] - while s: - n = s.pop() - k.add(n.val) - for c in (n.left, n.right): - if c: - s.append(c) - - return len(k) < 2 \ No newline at end of file diff --git a/1005-univalued-binary-tree/2024-02-20 13.15.32 - Accepted - runtime 5ms - memory 11.7MB.cpp b/1005-univalued-binary-tree/2024-02-20 13.15.32 - Accepted - runtime 5ms - memory 11.7MB.cpp deleted file mode 100644 index d848809..0000000 --- a/1005-univalued-binary-tree/2024-02-20 13.15.32 - Accepted - runtime 5ms - memory 11.7MB.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - bool isUnivalTree(TreeNode* root) { - stack st; st.push(root); - int v = root -> val; - while (!st.empty()){ - TreeNode* n = st.top(); st.pop(); - if (n -> val != v) return false; - if (n -> left) st.push(n -> left); - if (n -> right) st.push(n -> right); - } - return true; - } -}; \ No newline at end of file diff --git a/1005-univalued-binary-tree/2024-02-20 13.16.00 - Accepted - runtime 3ms - memory 11.8MB.cpp b/1005-univalued-binary-tree/2024-02-20 13.16.00 - Accepted - runtime 3ms - memory 11.8MB.cpp deleted file mode 100644 index e8efbd9..0000000 --- a/1005-univalued-binary-tree/2024-02-20 13.16.00 - Accepted - runtime 3ms - memory 11.8MB.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - bool isUnivalTree(TreeNode* root) { - stack st; st.push(root); - int& v = root -> val; - while (!st.empty()){ - TreeNode* n = st.top(); st.pop(); - if (n -> val != v) return false; - if (n -> left) st.push(n -> left); - if (n -> right) st.push(n -> right); - } - return true; - } -}; \ No newline at end of file diff --git a/101-symmetric-tree/2022-06-24 19.53.57 - Accepted - runtime 73ms - memory 13.7MB.py b/101-symmetric-tree/2022-06-24 19.53.57 - Accepted - runtime 73ms - memory 13.7MB.py deleted file mode 100644 index 389a28a..0000000 --- a/101-symmetric-tree/2022-06-24 19.53.57 - Accepted - runtime 73ms - memory 13.7MB.py +++ /dev/null @@ -1,25 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def check(self, left: Optional[TreeNode], right: Optional[TreeNode]) -> bool: - if not left: - return not right - if not right: - return False - return left.val == right.val - - def traverse(self, left: Optional[TreeNode], right: Optional[TreeNode]) -> bool: - if not self.check(left, right): - return False - - if left and right: - return self.traverse(left.left, right.right) and self.traverse(left.right, right.left) - - return True - - def isSymmetric(self, root: Optional[TreeNode]) -> bool: - return self.traverse(root.left, root.right) \ No newline at end of file diff --git a/101-symmetric-tree/2023-03-13 14.00.04 - Accepted - runtime 31ms - memory 14MB.py b/101-symmetric-tree/2023-03-13 14.00.04 - Accepted - runtime 31ms - memory 14MB.py deleted file mode 100644 index 92238d6..0000000 --- a/101-symmetric-tree/2023-03-13 14.00.04 - Accepted - runtime 31ms - memory 14MB.py +++ /dev/null @@ -1,16 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def check_nodes(self, left: Optional[TreeNode], right: Optional[TreeNode]) -> bool: - if left is None or right is None: - return left == right - if left.val != right.val: - return False - return self.check_nodes(left.left, right.right) and self.check_nodes(left.right, right.left) - - def isSymmetric(self, root: Optional[TreeNode]) -> bool: - return root is None or self.check_nodes(root.left, root.right) \ No newline at end of file diff --git a/101-symmetric-tree/2023-03-13 14.11.32 - Accepted - runtime 35ms - memory 13.8MB.py b/101-symmetric-tree/2023-03-13 14.11.32 - Accepted - runtime 35ms - memory 13.8MB.py deleted file mode 100644 index 8b31c1e..0000000 --- a/101-symmetric-tree/2023-03-13 14.11.32 - Accepted - runtime 35ms - memory 13.8MB.py +++ /dev/null @@ -1,25 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def isSymmetric(self, root: Optional[TreeNode]) -> bool: - if root is None: - return True - - left, right = [root.left], [root.right] - while left and right: - l, r = left.pop(), right.pop() - if l is None or r is None: - if l != r: - return False - else: - if l.val != r.val: - return False - - left.extend([l.left, l.right]) - right.extend([r.right, r.left]) - - return left == right \ No newline at end of file diff --git a/101-symmetric-tree/2024-02-18 17.33.01 - Accepted - runtime 5ms - memory 17.7MB.cpp b/101-symmetric-tree/2024-02-18 17.33.01 - Accepted - runtime 5ms - memory 17.7MB.cpp deleted file mode 100644 index ec705e1..0000000 --- a/101-symmetric-tree/2024-02-18 17.33.01 - Accepted - runtime 5ms - memory 17.7MB.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - bool isSymmetric(TreeNode* root) { - if (!root) return true; - stack left, right; - left.push(root -> left); right.push(root -> right); - while (!left.empty() && !right.empty()){ - TreeNode* l = left.top(); left.pop(); - TreeNode* r = right.top(); right.pop(); - if (!l || !r){ - if (l != r) return false; - } - else { - if (l -> val != r -> val) return false; - left.push(l -> left); left.push(l -> right); - right.push(r -> right); right.push(r -> left); - } - } - return left.empty() && right.empty(); - } -}; \ No newline at end of file diff --git a/101-symmetric-tree/2024-02-18 17.44.52 - Accepted - runtime 5ms - memory 17.3MB.cpp b/101-symmetric-tree/2024-02-18 17.44.52 - Accepted - runtime 5ms - memory 17.3MB.cpp deleted file mode 100644 index b49b3fd..0000000 --- a/101-symmetric-tree/2024-02-18 17.44.52 - Accepted - runtime 5ms - memory 17.3MB.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - bool check(TreeNode* left, TreeNode* right){ - if (!left || !right) return left == right; - return left -> val == right -> val && - check(left -> left, right -> right) && - check(left -> right, right -> left); - - } - bool isSymmetric(TreeNode* root) { - return check(root -> left, root -> right); - } -}; \ No newline at end of file diff --git a/1013-fibonacci-number/2022-07-06 13.09.08 - Accepted - runtime 1330ms - memory 13.8MB.py b/1013-fibonacci-number/2022-07-06 13.09.08 - Accepted - runtime 1330ms - memory 13.8MB.py deleted file mode 100644 index 2295a53..0000000 --- a/1013-fibonacci-number/2022-07-06 13.09.08 - Accepted - runtime 1330ms - memory 13.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def fib(self, n: int) -> int: - if not n: - return 0 - elif n == 1: - return 1 - return self.fib(n - 1) + self.fib(n - 2) \ No newline at end of file diff --git a/1013-fibonacci-number/2022-07-06 13.09.40 - Accepted - runtime 48ms - memory 13.9MB.py b/1013-fibonacci-number/2022-07-06 13.09.40 - Accepted - runtime 48ms - memory 13.9MB.py deleted file mode 100644 index 206f74e..0000000 --- a/1013-fibonacci-number/2022-07-06 13.09.40 - Accepted - runtime 48ms - memory 13.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def fib(self, n: int) -> int: - a,b = 0, 1 - for i in range(n): - a, b = b, a + b - return a \ No newline at end of file diff --git a/1013-fibonacci-number/2022-07-06 13.09.52 - Accepted - runtime 59ms - memory 13.9MB.py b/1013-fibonacci-number/2022-07-06 13.09.52 - Accepted - runtime 59ms - memory 13.9MB.py deleted file mode 100644 index 206f74e..0000000 --- a/1013-fibonacci-number/2022-07-06 13.09.52 - Accepted - runtime 59ms - memory 13.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def fib(self, n: int) -> int: - a,b = 0, 1 - for i in range(n): - a, b = b, a + b - return a \ No newline at end of file diff --git a/1013-fibonacci-number/2022-07-06 13.11.54 - Accepted - runtime 56ms - memory 14MB.py b/1013-fibonacci-number/2022-07-06 13.11.54 - Accepted - runtime 56ms - memory 14MB.py deleted file mode 100644 index 5cb2c42..0000000 --- a/1013-fibonacci-number/2022-07-06 13.11.54 - Accepted - runtime 56ms - memory 14MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - import functools - - @functools.cache - def fib(self, n: int) -> int: - if n in (0,1):return n - return self.fib(n - 1) + self.fib(n - 2) \ No newline at end of file diff --git a/1019-squares-of-a-sorted-array/2022-09-26 15.20.03 - Accepted - runtime 478ms - memory 16.2MB.py b/1019-squares-of-a-sorted-array/2022-09-26 15.20.03 - Accepted - runtime 478ms - memory 16.2MB.py deleted file mode 100644 index a5cff90..0000000 --- a/1019-squares-of-a-sorted-array/2022-09-26 15.20.03 - Accepted - runtime 478ms - memory 16.2MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sortedSquares(self, nums: List[int]) -> List[int]: - return sorted(f ** 2 for f in nums) \ No newline at end of file diff --git a/1019-squares-of-a-sorted-array/2024-03-26 00.09.06 - Accepted - runtime 160ms - memory 18.7MB.py b/1019-squares-of-a-sorted-array/2024-03-26 00.09.06 - Accepted - runtime 160ms - memory 18.7MB.py deleted file mode 100644 index 07305cb..0000000 --- a/1019-squares-of-a-sorted-array/2024-03-26 00.09.06 - Accepted - runtime 160ms - memory 18.7MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def sortedSquares(self, nums: List[int]) -> List[int]: - return sorted(f ** 2 for f in nums) - \ No newline at end of file diff --git a/102-binary-tree-level-order-traversal/2023-03-01 20.47.47 - Accepted - runtime 39ms - memory 14.8MB.py b/102-binary-tree-level-order-traversal/2023-03-01 20.47.47 - Accepted - runtime 39ms - memory 14.8MB.py deleted file mode 100644 index 83ed6de..0000000 --- a/102-binary-tree-level-order-traversal/2023-03-01 20.47.47 - Accepted - runtime 39ms - memory 14.8MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def traverse(self, node: Optional[TreeNode], level: int, d: dict[int, list[int]]) -> None: - if node: - d[level] = d.get(level, []) + [node.val] - self.traverse(node.left, level + 1, d) - self.traverse(node.right, level + 1, d) - - def levelOrder(self, root: Optional[TreeNode]) -> list[list[int]]: - if not root: - return [] - - d = {} - self.traverse(root, 0, d) - return d.values() - \ No newline at end of file diff --git a/102-binary-tree-level-order-traversal/2023-03-01 20.57.47 - Accepted - runtime 34ms - memory 14.2MB.py b/102-binary-tree-level-order-traversal/2023-03-01 20.57.47 - Accepted - runtime 34ms - memory 14.2MB.py deleted file mode 100644 index 0e71340..0000000 --- a/102-binary-tree-level-order-traversal/2023-03-01 20.57.47 - Accepted - runtime 34ms - memory 14.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def levelOrder(self, root: Optional[TreeNode]) -> list[list[int]]: - res, l = [], [root] - while root and l: - res.append([f.val for f in l]) - pairs = [(f.left, f.right) for f in l] - l = [node for pair in pairs for node in pair if node] - - return res \ No newline at end of file diff --git a/102-binary-tree-level-order-traversal/2023-03-01 20.58.21 - Accepted - runtime 36ms - memory 14.2MB.py b/102-binary-tree-level-order-traversal/2023-03-01 20.58.21 - Accepted - runtime 36ms - memory 14.2MB.py deleted file mode 100644 index b4886fa..0000000 --- a/102-binary-tree-level-order-traversal/2023-03-01 20.58.21 - Accepted - runtime 36ms - memory 14.2MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def levelOrder(self, root: Optional[TreeNode]) -> list[list[int]]: - if not root: - return [] - res, l = [], [root] - while l: - res.append([f.val for f in l]) - pairs = [(f.left, f.right) for f in l] - l = [node for pair in pairs for node in pair if node] - - return res \ No newline at end of file diff --git a/1025-minimum-cost-for-tickets/2023-03-29 11.30.05 - Accepted - runtime 47ms - memory 13.8MB.py b/1025-minimum-cost-for-tickets/2023-03-29 11.30.05 - Accepted - runtime 47ms - memory 13.8MB.py deleted file mode 100644 index e77bc8d..0000000 --- a/1025-minimum-cost-for-tickets/2023-03-29 11.30.05 - Accepted - runtime 47ms - memory 13.8MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def mincostTickets(self, days: List[int], costs: List[int]) -> int: - d, w, m = costs - dp = [0] * 30 - dy = set(days) - for i in range(1, days[-1] + 1): - if i not in dy: - dp[i % 30] = dp[(i - 1) % 30] - else: - dp[i % 30] = min(dp[(i - 1) % 30] + d, dp[max(0,(i - 7) % 30)] + w, dp[max(0, (i - 30) % 30)] + m) - - return dp[i % 30] \ No newline at end of file diff --git a/1025-minimum-cost-for-tickets/2023-03-29 11.36.18 - Accepted - runtime 35ms - memory 13.8MB.py b/1025-minimum-cost-for-tickets/2023-03-29 11.36.18 - Accepted - runtime 35ms - memory 13.8MB.py deleted file mode 100644 index fe01b7b..0000000 --- a/1025-minimum-cost-for-tickets/2023-03-29 11.36.18 - Accepted - runtime 35ms - memory 13.8MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def mincostTickets(self, days: List[int], costs: List[int]) -> int: - d, w, m = costs - costs = [0] * (days[-1] + 1) - dy = set(days) - for i in range(1, days[-1] + 1): - if i not in dy: - costs[i] = costs[i - 1] - else: - costs[i] = min(costs[i - 1] + d, costs[max(0,i - 7)] + w, costs[max(0, i - 30)] + m) - - return costs[-1] \ No newline at end of file diff --git a/103-binary-tree-zigzag-level-order-traversal/2023-02-19 21.06.38 - Accepted - runtime 44ms - memory 14.1MB.py b/103-binary-tree-zigzag-level-order-traversal/2023-02-19 21.06.38 - Accepted - runtime 44ms - memory 14.1MB.py deleted file mode 100644 index 0324c95..0000000 --- a/103-binary-tree-zigzag-level-order-traversal/2023-02-19 21.06.38 - Accepted - runtime 44ms - memory 14.1MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def traverse(self, node: Optional[TreeNode], res: dict[int, List[TreeNode]], depth: int) -> None: - if node: - res[depth] = res.get(depth, []) + [node.val] - if node.left: - self.traverse(node.left, res, depth + 1) - if node.right: - self.traverse(node.right, res, depth + 1) - - - def zigzagLevelOrder(self, root: Optional[TreeNode]) -> List[List[int]]: - if not root: - return [] - res = {} - self.traverse(root, res, 1) - return [val if key % 2 else val[::-1] for key, val in res.items()] diff --git a/1030-smallest-string-starting-from-leaf/2024-04-17 09.40.41 - Accepted - runtime 44ms - memory 18.3MB.py b/1030-smallest-string-starting-from-leaf/2024-04-17 09.40.41 - Accepted - runtime 44ms - memory 18.3MB.py deleted file mode 100644 index 933919a..0000000 --- a/1030-smallest-string-starting-from-leaf/2024-04-17 09.40.41 - Accepted - runtime 44ms - memory 18.3MB.py +++ /dev/null @@ -1,22 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def dfs(self, r, s = ()): - if not r or (not r.left and not r.right): - if r: - s += r.val, - if len(s) > 1: - yield s[::-1] - else: - s += r.val, - if r.left:yield from self.dfs(r.left, s) - if r.right:yield from self.dfs(r.right, s) - def smallestFromLeaf(self, root: Optional[TreeNode]) -> str: - if not root.left and not root.right: - return chr(97 + root.val) - l = list(self.dfs(root)) - return ''.join(chr(97 + f)for f in min(l)) \ No newline at end of file diff --git a/1030-smallest-string-starting-from-leaf/2024-04-17 09.42.52 - Accepted - runtime 40ms - memory 17.9MB.py b/1030-smallest-string-starting-from-leaf/2024-04-17 09.42.52 - Accepted - runtime 40ms - memory 17.9MB.py deleted file mode 100644 index 6b594cf..0000000 --- a/1030-smallest-string-starting-from-leaf/2024-04-17 09.42.52 - Accepted - runtime 40ms - memory 17.9MB.py +++ /dev/null @@ -1,24 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def smallestFromLeaf(self, root: Optional[TreeNode]) -> str: - self.results = [] - - def solve(node, res): - if node.left: - solve(node.left, res + chr(97 + node.val)) - - if node.right: - solve(node.right, res + chr(97 + node.val)) - - if not node.left and not node.right: - res += chr(97 + node.val) - self.results.append(res[::-1]) - - - solve(root, '') - return min(self.results) \ No newline at end of file diff --git a/1031-add-to-array-form-of-integer/2023-02-15 22.11.41 - Accepted - runtime 330ms - memory 14.9MB.py b/1031-add-to-array-form-of-integer/2023-02-15 22.11.41 - Accepted - runtime 330ms - memory 14.9MB.py deleted file mode 100644 index cebe223..0000000 --- a/1031-add-to-array-form-of-integer/2023-02-15 22.11.41 - Accepted - runtime 330ms - memory 14.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def addToArrayForm(self, num: List[int], k: int) -> List[int]: - return list(map(int,str(int(''.join(map(str, num))) + k))) \ No newline at end of file diff --git a/1034-subarrays-with-k-different-integers/2024-03-30 20.18.33 - Accepted - runtime 401ms - memory 20.5MB.py b/1034-subarrays-with-k-different-integers/2024-03-30 20.18.33 - Accepted - runtime 401ms - memory 20.5MB.py deleted file mode 100644 index 1bd8f1c..0000000 --- a/1034-subarrays-with-k-different-integers/2024-03-30 20.18.33 - Accepted - runtime 401ms - memory 20.5MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def subarraysWithKDistinct(self, A, K): - return self.atMostK(A, K) - self.atMostK(A, K - 1) - - def atMostK(self, A, K): - count = collections.Counter() - res = i = 0 - for j in range(len(A)): - if count[A[j]] == 0: K -= 1 - count[A[j]] += 1 - while K < 0: - count[A[i]] -= 1 - if count[A[i]] == 0: K += 1 - i += 1 - res += j - i + 1 - return res \ No newline at end of file diff --git a/1039-find-the-town-judge/2024-02-22 17.56.01 - Accepted - runtime 665ms - memory 21.6MB.py b/1039-find-the-town-judge/2024-02-22 17.56.01 - Accepted - runtime 665ms - memory 21.6MB.py deleted file mode 100644 index 2d62d5e..0000000 --- a/1039-find-the-town-judge/2024-02-22 17.56.01 - Accepted - runtime 665ms - memory 21.6MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def findJudge(self, n: int, trust: List[List[int]]) -> int: - if not trust: return 1 if n == 1 else -1 - d, k = defaultdict(int), defaultdict(int) - for i in trust: - k[i[0]] += 1 - d[i[1]] += 1 - - for r,v in d.items(): - if v == n - 1 and k[r] == 0: return r - - return -1 diff --git a/1039-find-the-town-judge/2024-02-22 18.03.13 - Accepted - runtime 102ms - memory 64.4MB.cpp b/1039-find-the-town-judge/2024-02-22 18.03.13 - Accepted - runtime 102ms - memory 64.4MB.cpp deleted file mode 100644 index f110831..0000000 --- a/1039-find-the-town-judge/2024-02-22 18.03.13 - Accepted - runtime 102ms - memory 64.4MB.cpp +++ /dev/null @@ -1,14 +0,0 @@ -class Solution { -public: - int findJudge(int n, vector>& trust) { - vector s(n + 1, 0); - for (int i=0; i < trust.size(); i++){ - s[trust[i][0]]--; - s[trust[i][1]]++; - } - for (int i=1; i <= n; i++){ - if (s[i] == n - 1) return i; - } - return -1; - } -}; \ No newline at end of file diff --git a/104-maximum-depth-of-binary-tree/2022-06-26 12.17.58 - Accepted - runtime 43ms - memory 16.4MB.py b/104-maximum-depth-of-binary-tree/2022-06-26 12.17.58 - Accepted - runtime 43ms - memory 16.4MB.py deleted file mode 100644 index 1d53f03..0000000 --- a/104-maximum-depth-of-binary-tree/2022-06-26 12.17.58 - Accepted - runtime 43ms - memory 16.4MB.py +++ /dev/null @@ -1,15 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def deep(self, root: Optional[TreeNode], deep=0) -> int: - if not root: - return deep - deep += 1 - return max(self.deep(root.left, deep), self.deep(root.right, deep)) - - def maxDepth(self, root: Optional[TreeNode]) -> int: - return self.deep(root) \ No newline at end of file diff --git a/104-maximum-depth-of-binary-tree/2022-06-26 12.19.31 - Accepted - runtime 71ms - memory 16.5MB.py b/104-maximum-depth-of-binary-tree/2022-06-26 12.19.31 - Accepted - runtime 71ms - memory 16.5MB.py deleted file mode 100644 index 25840f9..0000000 --- a/104-maximum-depth-of-binary-tree/2022-06-26 12.19.31 - Accepted - runtime 71ms - memory 16.5MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def deep(self, root: Optional[TreeNode], deep) -> int: - if not root: - return deep - return max(self.deep(root.left, deep + 1), self.deep(root.right, deep + 1)) - - def maxDepth(self, root: Optional[TreeNode]) -> int: - return self.deep(root, 0) \ No newline at end of file diff --git a/104-maximum-depth-of-binary-tree/2024-02-18 21.46.33 - Accepted - runtime 12ms - memory 17.4MB.cpp b/104-maximum-depth-of-binary-tree/2024-02-18 21.46.33 - Accepted - runtime 12ms - memory 17.4MB.cpp deleted file mode 100644 index 618b2b9..0000000 --- a/104-maximum-depth-of-binary-tree/2024-02-18 21.46.33 - Accepted - runtime 12ms - memory 17.4MB.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int maxDepth(TreeNode* root, int d = 1) { - return root != NULL ? - max(maxDepth(root -> left, d + 1), maxDepth(root -> right, d + 1)) : d - 1; - } -}; \ No newline at end of file diff --git a/104-maximum-depth-of-binary-tree/2024-02-18 21.47.06 - Accepted - runtime 3ms - memory 17.6MB.cpp b/104-maximum-depth-of-binary-tree/2024-02-18 21.47.06 - Accepted - runtime 3ms - memory 17.6MB.cpp deleted file mode 100644 index 7137633..0000000 --- a/104-maximum-depth-of-binary-tree/2024-02-18 21.47.06 - Accepted - runtime 3ms - memory 17.6MB.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int maxDepth(TreeNode* root, int d = 0) { - return root!=NULL?max(maxDepth(root->left, d+1), maxDepth(root->right, d + 1)) : d; - } -}; \ No newline at end of file diff --git a/1041-available-captures-for-rook/2023-03-06 23.13.43 - Accepted - runtime 35ms - memory 13.9MB.py b/1041-available-captures-for-rook/2023-03-06 23.13.43 - Accepted - runtime 35ms - memory 13.9MB.py deleted file mode 100644 index 7655894..0000000 --- a/1041-available-captures-for-rook/2023-03-06 23.13.43 - Accepted - runtime 35ms - memory 13.9MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def find_rook(self, board: List[List[str]]) -> tuple[int, int]: - for y,line in enumerate(board): - for x,i in enumerate(line): - if i.isalpha(): - if i == 'R': - return x, y - def numRookCaptures(self, board: List[List[str]]) -> int: - X, Y = self.find_rook(board) - h = v = '' - for y,line in enumerate(board): - if y == Y: - v = ''.join(line) - for x,i in enumerate(line): - if X == x: - h += i - - r = re.compile(r'p\.*R') - r2 = re.compile(r'R\.*p') - return len(re.findall(r, h)) + len(re.findall(r2, h)) + len(re.findall(r, v)) + len(re.findall(r2, v)) \ No newline at end of file diff --git a/1044-find-common-characters/2024-04-30 21.07.17 - Accepted - runtime 49ms - memory 16.7MB.py b/1044-find-common-characters/2024-04-30 21.07.17 - Accepted - runtime 49ms - memory 16.7MB.py deleted file mode 100644 index 17cfb01..0000000 --- a/1044-find-common-characters/2024-04-30 21.07.17 - Accepted - runtime 49ms - memory 16.7MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def commonChars(self, words: List[str]) -> List[str]: - d = Counter(words[0]) - for i in words[1:]: - t = Counter(i) - for j in list(d.keys()): - if j not in i: - del d[j] - else: - d[j] = min(d[j], t[j]) - - res = [] - for a,b in d.items(): - res.extend([a] * b) - return res \ No newline at end of file diff --git a/1058-lexicographically-smallest-equivalent-string/2023-01-14 22.15.48 - Accepted - runtime 34ms - memory 13.9MB.py b/1058-lexicographically-smallest-equivalent-string/2023-01-14 22.15.48 - Accepted - runtime 34ms - memory 13.9MB.py deleted file mode 100644 index be18c9d..0000000 --- a/1058-lexicographically-smallest-equivalent-string/2023-01-14 22.15.48 - Accepted - runtime 34ms - memory 13.9MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def find(self, char: str, d: dict[str, str]) -> str: - if d[char] != char: - d[char] = self.find(d[char], d) - return d[char] - - def smallestEquivalentString(self, s1: str, s2: str, baseStr: str) -> str: - d = {f:f for f in string.ascii_lowercase} - - for a,b in zip(s1, s2): - x, y = self.find(a, d), self.find(b, d) - if x > y: - d[x] = y - else: - d[y] = x - - return ''.join(self.find(f, d) for f in baseStr) \ No newline at end of file diff --git a/1065-binary-string-with-substrings-representing-1-to-n/2024-04-30 20.57.38 - Accepted - runtime 32ms - memory 16.4MB.py b/1065-binary-string-with-substrings-representing-1-to-n/2024-04-30 20.57.38 - Accepted - runtime 32ms - memory 16.4MB.py deleted file mode 100644 index db5696c..0000000 --- a/1065-binary-string-with-substrings-representing-1-to-n/2024-04-30 20.57.38 - Accepted - runtime 32ms - memory 16.4MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def queryString(self, s: str, n: int) -> bool: - return all(f'{f:b}'in s for f in range(1,n + 1)) \ No newline at end of file diff --git a/1073-number-of-enclaves/2023-04-07 11.10.14 - Accepted - runtime 1188ms - memory 19.5MB.py b/1073-number-of-enclaves/2023-04-07 11.10.14 - Accepted - runtime 1188ms - memory 19.5MB.py deleted file mode 100644 index 1cd6d23..0000000 --- a/1073-number-of-enclaves/2023-04-07 11.10.14 - Accepted - runtime 1188ms - memory 19.5MB.py +++ /dev/null @@ -1,26 +0,0 @@ -class Solution: - def numEnclaves(self, grid: List[List[int]]) -> int: - h, w = len(grid), len(grid[0]) - res = 0 - for y in range(h): - for x in range(w): - if grid[y][x]: - stack = [(x, y)] - is_boundary = False - length = 0 - while stack: - X, Y = stack.pop() - if not grid[Y][X]:continue - if X == 0 or X == w - 1 or Y == 0 or Y == h - 1: - is_boundary = True - length += 1 - grid[Y][X] = 0 - for i, j in ((0, 1), (1, 0), (-1, 0), (0, -1)): - XX = min(max(X + i, 0), w - 1) - YY = min(max(Y + j, 0), h - 1) - if grid[YY][XX]: - stack.append((XX, YY)) - if not is_boundary: - res += length - - return res \ No newline at end of file diff --git a/1079-sum-of-root-to-leaf-binary-numbers/2024-01-07 22.47.06 - Accepted - runtime 34ms - memory 17.6MB.py b/1079-sum-of-root-to-leaf-binary-numbers/2024-01-07 22.47.06 - Accepted - runtime 34ms - memory 17.6MB.py deleted file mode 100644 index ec3484e..0000000 --- a/1079-sum-of-root-to-leaf-binary-numbers/2024-01-07 22.47.06 - Accepted - runtime 34ms - memory 17.6MB.py +++ /dev/null @@ -1,22 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, n, s='') -> str: - s += str(n.val) - if not n.left and not n.right: - yield s - - else: - if n.left: - yield from self.traverse(n.left, s) - - if n.right: - yield from self.traverse(n.right, s) - - - def sumRootToLeaf(self, root: Optional[TreeNode]) -> int: - return sum(map(lambda x:int(x, 2), self.traverse(root))) \ No newline at end of file diff --git a/1079-sum-of-root-to-leaf-binary-numbers/2024-01-07 23.02.17 - Accepted - runtime 42ms - memory 17.6MB.py b/1079-sum-of-root-to-leaf-binary-numbers/2024-01-07 23.02.17 - Accepted - runtime 42ms - memory 17.6MB.py deleted file mode 100644 index b13fd57..0000000 --- a/1079-sum-of-root-to-leaf-binary-numbers/2024-01-07 23.02.17 - Accepted - runtime 42ms - memory 17.6MB.py +++ /dev/null @@ -1,12 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sumRootToLeaf(self, root: Optional[TreeNode], val = 0) -> int: - if not root: return 0 - val = val * 2 + root.val - if root.left == root.right:return val - return self.sumRootToLeaf(root.left, val) + self.sumRootToLeaf(root.right, val) \ No newline at end of file diff --git a/1079-sum-of-root-to-leaf-binary-numbers/2024-02-20 13.52.18 - Accepted - runtime 0ms - memory 15.8MB.cpp b/1079-sum-of-root-to-leaf-binary-numbers/2024-02-20 13.52.18 - Accepted - runtime 0ms - memory 15.8MB.cpp deleted file mode 100644 index 43de0df..0000000 --- a/1079-sum-of-root-to-leaf-binary-numbers/2024-02-20 13.52.18 - Accepted - runtime 0ms - memory 15.8MB.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int sumRootToLeaf(TreeNode* root, int val = 0) { - if (!root) return 0; - val = val * 2 + root -> val; - if (root -> left == root ->right) return val; - return sumRootToLeaf(root -> left, val) + sumRootToLeaf(root -> right, val); - } -}; \ No newline at end of file diff --git a/108-convert-sorted-array-to-binary-search-tree/2022-06-27 17.49.31 - Accepted - runtime 172ms - memory 15.6MB.py b/108-convert-sorted-array-to-binary-search-tree/2022-06-27 17.49.31 - Accepted - runtime 172ms - memory 15.6MB.py deleted file mode 100644 index 822b818..0000000 --- a/108-convert-sorted-array-to-binary-search-tree/2022-06-27 17.49.31 - Accepted - runtime 172ms - memory 15.6MB.py +++ /dev/null @@ -1,17 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: - if not nums: - return None - - n = len(nums) // 2 - root = TreeNode(nums[n]) - root.left = self.sortedArrayToBST(nums[:n]) - root.right = self.sortedArrayToBST(nums[n + 1:]) - - return root \ No newline at end of file diff --git a/108-convert-sorted-array-to-binary-search-tree/2022-06-27 17.49.43 - Accepted - runtime 166ms - memory 15.6MB.py b/108-convert-sorted-array-to-binary-search-tree/2022-06-27 17.49.43 - Accepted - runtime 166ms - memory 15.6MB.py deleted file mode 100644 index 822b818..0000000 --- a/108-convert-sorted-array-to-binary-search-tree/2022-06-27 17.49.43 - Accepted - runtime 166ms - memory 15.6MB.py +++ /dev/null @@ -1,17 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: - if not nums: - return None - - n = len(nums) // 2 - root = TreeNode(nums[n]) - root.left = self.sortedArrayToBST(nums[:n]) - root.right = self.sortedArrayToBST(nums[n + 1:]) - - return root \ No newline at end of file diff --git a/108-convert-sorted-array-to-binary-search-tree/2022-06-27 18.06.40 - Accepted - runtime 150ms - memory 15.8MB.py b/108-convert-sorted-array-to-binary-search-tree/2022-06-27 18.06.40 - Accepted - runtime 150ms - memory 15.8MB.py deleted file mode 100644 index 211159d..0000000 --- a/108-convert-sorted-array-to-binary-search-tree/2022-06-27 18.06.40 - Accepted - runtime 150ms - memory 15.8MB.py +++ /dev/null @@ -1,16 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: - if not nums: - return None - middle = len(nums) // 2 - root = TreeNode(nums[middle]) - root.left = self.sortedArrayToBST(nums[:middle]) - root.right = self.sortedArrayToBST(nums[middle + 1:]) - - return root \ No newline at end of file diff --git a/108-convert-sorted-array-to-binary-search-tree/2022-06-27 22.31.28 - Accepted - runtime 121ms - memory 15.6MB.py b/108-convert-sorted-array-to-binary-search-tree/2022-06-27 22.31.28 - Accepted - runtime 121ms - memory 15.6MB.py deleted file mode 100644 index 936ee57..0000000 --- a/108-convert-sorted-array-to-binary-search-tree/2022-06-27 22.31.28 - Accepted - runtime 121ms - memory 15.6MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: - if not nums: - return None - - middle = len(nums) // 2 - root = TreeNode(nums[middle]) - root.left = self.sortedArrayToBST(nums[:middle]) - root.right = self.sortedArrayToBST(nums[middle + 1:]) - - return root - \ No newline at end of file diff --git a/1092-maximum-difference-between-node-and-ancestor/2024-01-11 21.21.54 - Accepted - runtime 46ms - memory 19MB.py b/1092-maximum-difference-between-node-and-ancestor/2024-01-11 21.21.54 - Accepted - runtime 46ms - memory 19MB.py deleted file mode 100644 index ab4f006..0000000 --- a/1092-maximum-difference-between-node-and-ancestor/2024-01-11 21.21.54 - Accepted - runtime 46ms - memory 19MB.py +++ /dev/null @@ -1,11 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def maxAncestorDiff(self, root, m=100000, M=0) -> int: - return max(self.maxAncestorDiff(root.left, min(m, root.val), max(M, root.val)), \ - self.maxAncestorDiff(root.right, min(m, root.val), max(M, root.val))) \ - if root else M - m \ No newline at end of file diff --git a/11-container-with-most-water/2023-01-31 20.56.29 - Accepted - runtime 757ms - memory 27.5MB.py b/11-container-with-most-water/2023-01-31 20.56.29 - Accepted - runtime 757ms - memory 27.5MB.py deleted file mode 100644 index ceafb35..0000000 --- a/11-container-with-most-water/2023-01-31 20.56.29 - Accepted - runtime 757ms - memory 27.5MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def maxArea(self, height: List[int]) -> int: - left, right = 0, len(height) - 1 - res = 0 - while left < right: - res = max(res, min(height[left], height[right]) * (right - left)) - if height[left] > height[right]: - right -= 1 - else: - left += 1 - - return res \ No newline at end of file diff --git a/111-minimum-depth-of-binary-tree/2022-06-28 23.50.08 - Accepted - runtime 748ms - memory 55MB.py b/111-minimum-depth-of-binary-tree/2022-06-28 23.50.08 - Accepted - runtime 748ms - memory 55MB.py deleted file mode 100644 index f8b8e42..0000000 --- a/111-minimum-depth-of-binary-tree/2022-06-28 23.50.08 - Accepted - runtime 748ms - memory 55MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def bfs(self, root: Optional[TreeNode], depth: int) -> int: - if not root.left and not root.right: - return depth - if root.left and root.right: - return min(self.bfs(root.left, depth+1), self.bfs(root.right, depth+1)) - if root.left: - return self.bfs(root.left, depth+1) - return self.bfs(root.right, depth+1) - def minDepth(self, root: Optional[TreeNode]) -> int: - if not root: - return 0 - return self.bfs(root, 1) \ No newline at end of file diff --git a/111-minimum-depth-of-binary-tree/2022-06-28 23.53.42 - Accepted - runtime 1710ms - memory 58.4MB.py b/111-minimum-depth-of-binary-tree/2022-06-28 23.53.42 - Accepted - runtime 1710ms - memory 58.4MB.py deleted file mode 100644 index b813037..0000000 --- a/111-minimum-depth-of-binary-tree/2022-06-28 23.53.42 - Accepted - runtime 1710ms - memory 58.4MB.py +++ /dev/null @@ -1,11 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def minDepth(self, root): - if not root: return 0 - d = list(map(self.minDepth, (root.left, root.right))) - return 1 + (min(d) or max(d)) \ No newline at end of file diff --git a/111-minimum-depth-of-binary-tree/2022-06-28 23.53.50 - Accepted - runtime 1121ms - memory 58.4MB.py b/111-minimum-depth-of-binary-tree/2022-06-28 23.53.50 - Accepted - runtime 1121ms - memory 58.4MB.py deleted file mode 100644 index b813037..0000000 --- a/111-minimum-depth-of-binary-tree/2022-06-28 23.53.50 - Accepted - runtime 1121ms - memory 58.4MB.py +++ /dev/null @@ -1,11 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def minDepth(self, root): - if not root: return 0 - d = list(map(self.minDepth, (root.left, root.right))) - return 1 + (min(d) or max(d)) \ No newline at end of file diff --git a/1112-find-words-that-can-be-formed-by-characters/2023-01-26 14.41.00 - Accepted - runtime 177ms - memory 14.4MB.py b/1112-find-words-that-can-be-formed-by-characters/2023-01-26 14.41.00 - Accepted - runtime 177ms - memory 14.4MB.py deleted file mode 100644 index d9b8a50..0000000 --- a/1112-find-words-that-can-be-formed-by-characters/2023-01-26 14.41.00 - Accepted - runtime 177ms - memory 14.4MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class Solution: - def countCharacters(self, words: List[str], c: str) -> int: - c = collections.Counter(c) - res = 0 - for j in words: - good = True - i = collections.Counter(j).items() - for char, counter in i: - if char not in c or c[char] < counter: - good = False - break - - if good: - for char, counter in i: - res += counter - - - return res \ No newline at end of file diff --git a/112-path-sum/2022-07-08 22.14.15 - Accepted - runtime 4177ms - memory 15.1MB.py b/112-path-sum/2022-07-08 22.14.15 - Accepted - runtime 4177ms - memory 15.1MB.py deleted file mode 100644 index 1ab6651..0000000 --- a/112-path-sum/2022-07-08 22.14.15 - Accepted - runtime 4177ms - memory 15.1MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def check(self, root: Optional[TreeNode], res, target) -> bool: - if not root.left and not root.right: - yield res + root.val == target - if root.left: - if root.right: - yield from self.check(root.left, res + root.val, target) or self.check(root.right, res + root.val, target) - yield from self.check(root.left, res + root.val, target) - - if root.right: - yield from self.check(root.right, res + root.val, target) - - - - def hasPathSum(self, root: Optional[TreeNode], targetSum: int) -> bool: - if not root:return False - return any(self.check(root, 0, targetSum)) \ No newline at end of file diff --git a/112-path-sum/2022-07-08 22.18.51 - Accepted - runtime 43ms - memory 15MB.py b/112-path-sum/2022-07-08 22.18.51 - Accepted - runtime 43ms - memory 15MB.py deleted file mode 100644 index 0be6de5..0000000 --- a/112-path-sum/2022-07-08 22.18.51 - Accepted - runtime 43ms - memory 15MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def hasPathSum(self, root: Optional[TreeNode], target: int) -> bool: - if not root:return False - if not(root.left or root.right) and root.val == target:return True - target -= root.val - return self.hasPathSum(root.left, target) or self.hasPathSum(root.right, target) \ No newline at end of file diff --git a/112-path-sum/2022-07-09 10.59.17 - Accepted - runtime 77ms - memory 15.1MB.py b/112-path-sum/2022-07-09 10.59.17 - Accepted - runtime 77ms - memory 15.1MB.py deleted file mode 100644 index f1d097d..0000000 --- a/112-path-sum/2022-07-09 10.59.17 - Accepted - runtime 77ms - memory 15.1MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def hasPathSum(self, root: Optional[TreeNode], target: int) -> bool: - if not root:return False - if not(root.left or root.right) and target == root.val:return True - target -= root.val - return self.hasPathSum(root.left,target)or self.hasPathSum(root.right,target) \ No newline at end of file diff --git a/112-path-sum/2022-07-10 18.10.26 - Accepted - runtime 53ms - memory 15.1MB.py b/112-path-sum/2022-07-10 18.10.26 - Accepted - runtime 53ms - memory 15.1MB.py deleted file mode 100644 index f9700ea..0000000 --- a/112-path-sum/2022-07-10 18.10.26 - Accepted - runtime 53ms - memory 15.1MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def hasPathSum(self, root: Optional[TreeNode], target: int) -> bool: - if not root:return False - if not (root.left or root.right) and target == root.val:return True - target -= root.val - return self.hasPathSum(root.left,target)or self.hasPathSum(root.right,target) \ No newline at end of file diff --git a/112-path-sum/2022-10-07 20.24.27 - Accepted - runtime 47ms - memory 15MB.py b/112-path-sum/2022-10-07 20.24.27 - Accepted - runtime 47ms - memory 15MB.py deleted file mode 100644 index f9700ea..0000000 --- a/112-path-sum/2022-10-07 20.24.27 - Accepted - runtime 47ms - memory 15MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def hasPathSum(self, root: Optional[TreeNode], target: int) -> bool: - if not root:return False - if not (root.left or root.right) and target == root.val:return True - target -= root.val - return self.hasPathSum(root.left,target)or self.hasPathSum(root.right,target) \ No newline at end of file diff --git a/112-path-sum/2024-02-18 21.58.37 - Accepted - runtime 9ms - memory 19.7MB.cpp b/112-path-sum/2024-02-18 21.58.37 - Accepted - runtime 9ms - memory 19.7MB.cpp deleted file mode 100644 index f058dc1..0000000 --- a/112-path-sum/2024-02-18 21.58.37 - Accepted - runtime 9ms - memory 19.7MB.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - bool hasPathSum(TreeNode* r, int t) { - if (!r) return false; - if (!(r -> left || r -> right) && t == r -> val) return true; - t -= r -> val; - return hasPathSum(r -> left, t) || hasPathSum(r -> right, t); - } -}; \ No newline at end of file diff --git a/1127-last-stone-weight/2023-04-24 21.21.11 - Accepted - runtime 42ms - memory 13.9MB.py b/1127-last-stone-weight/2023-04-24 21.21.11 - Accepted - runtime 42ms - memory 13.9MB.py deleted file mode 100644 index f38e382..0000000 --- a/1127-last-stone-weight/2023-04-24 21.21.11 - Accepted - runtime 42ms - memory 13.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def lastStoneWeight(self, stones: List[int]) -> int: - h = [-f for f in stones] - heapq.heapify(h) - while len(h) > 1: - heapq.heappush(h, heapq.heappop(h) - heapq.heappop(h)) - return -h[0] \ No newline at end of file diff --git a/1127-last-stone-weight/2023-04-24 21.21.20 - Accepted - runtime 41ms - memory 13.9MB.py b/1127-last-stone-weight/2023-04-24 21.21.20 - Accepted - runtime 41ms - memory 13.9MB.py deleted file mode 100644 index f38e382..0000000 --- a/1127-last-stone-weight/2023-04-24 21.21.20 - Accepted - runtime 41ms - memory 13.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def lastStoneWeight(self, stones: List[int]) -> int: - h = [-f for f in stones] - heapq.heapify(h) - while len(h) > 1: - heapq.heappush(h, heapq.heappop(h) - heapq.heappop(h)) - return -h[0] \ No newline at end of file diff --git a/1137-height-checker/2024-04-04 18.32.28 - Accepted - runtime 44ms - memory 16.4MB.py b/1137-height-checker/2024-04-04 18.32.28 - Accepted - runtime 44ms - memory 16.4MB.py deleted file mode 100644 index e171965..0000000 --- a/1137-height-checker/2024-04-04 18.32.28 - Accepted - runtime 44ms - memory 16.4MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def heightChecker(self, heights: List[int]) -> int: - s = sorted(heights) - return sum(s[f] != heights[f] for f in range(len(heights))) \ No newline at end of file diff --git a/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.13 - Accepted - runtime 68ms - memory 15.2MB.py b/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.13 - Accepted - runtime 68ms - memory 15.2MB.py deleted file mode 100644 index 3e684d2..0000000 --- a/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.13 - Accepted - runtime 68ms - memory 15.2MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def flatten(self, root: Optional[TreeNode]) -> None: - curr = root - while curr: - if curr.left: - p = curr.left - while p.right:p = p.right - p.right = curr.right - curr.right = curr.left - curr.left = None - - curr = curr.right \ No newline at end of file diff --git a/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.24 - Accepted - runtime 62ms - memory 15.3MB.py b/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.24 - Accepted - runtime 62ms - memory 15.3MB.py deleted file mode 100644 index 3e684d2..0000000 --- a/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.24 - Accepted - runtime 62ms - memory 15.3MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def flatten(self, root: Optional[TreeNode]) -> None: - curr = root - while curr: - if curr.left: - p = curr.left - while p.right:p = p.right - p.right = curr.right - curr.right = curr.left - curr.left = None - - curr = curr.right \ No newline at end of file diff --git a/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.30 - Accepted - runtime 44ms - memory 15.3MB.py b/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.30 - Accepted - runtime 44ms - memory 15.3MB.py deleted file mode 100644 index 3e684d2..0000000 --- a/114-flatten-binary-tree-to-linked-list/2022-07-27 22.30.30 - Accepted - runtime 44ms - memory 15.3MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def flatten(self, root: Optional[TreeNode]) -> None: - curr = root - while curr: - if curr.left: - p = curr.left - while p.right:p = p.right - p.right = curr.right - curr.right = curr.left - curr.left = None - - curr = curr.right \ No newline at end of file diff --git a/114-flatten-binary-tree-to-linked-list/2022-07-27 22.43.40 - Accepted - runtime 89ms - memory 15.4MB.py b/114-flatten-binary-tree-to-linked-list/2022-07-27 22.43.40 - Accepted - runtime 89ms - memory 15.4MB.py deleted file mode 100644 index 9628c9d..0000000 --- a/114-flatten-binary-tree-to-linked-list/2022-07-27 22.43.40 - Accepted - runtime 89ms - memory 15.4MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def flatten(self, root: Optional[TreeNode]) -> None: - while root: - if root.left: - right_most = root.left - while right_most.right: - right_most = right_most.right - right_most.right = root.right - root.right = root.left - root.left = None - - root = root.right \ No newline at end of file diff --git a/114-flatten-binary-tree-to-linked-list/2024-02-25 19.50.20 - Accepted - runtime 11ms - memory 15.6MB.cpp b/114-flatten-binary-tree-to-linked-list/2024-02-25 19.50.20 - Accepted - runtime 11ms - memory 15.6MB.cpp deleted file mode 100644 index 1ef1c1d..0000000 --- a/114-flatten-binary-tree-to-linked-list/2024-02-25 19.50.20 - Accepted - runtime 11ms - memory 15.6MB.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - void flatten(TreeNode* root) { - while (root){ - if (root -> left){ - TreeNode* rm = root->left; - while (rm -> right) rm = rm -> right; - rm -> right = root -> right; - root -> right = root -> left; - root -> left = NULL; - } - root = root->right; - } - } -}; \ No newline at end of file diff --git a/118-pascals-triangle/2022-07-19 22.45.40 - Accepted - runtime 39ms - memory 14MB.py b/118-pascals-triangle/2022-07-19 22.45.40 - Accepted - runtime 39ms - memory 14MB.py deleted file mode 100644 index 330a430..0000000 --- a/118-pascals-triangle/2022-07-19 22.45.40 - Accepted - runtime 39ms - memory 14MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def generate(self, n: int) -> List[List[int]]: - l = [[1]] - for i in range(1, n):l.append([1 if not f or f==i else l[-1][f]+l[-1][f-1] for f in range(i+1)]) - return l - - \ No newline at end of file diff --git a/119-pascals-triangle-ii/2023-04-29 09.00.00 - Accepted - runtime 44ms - memory 16.2MB.py b/119-pascals-triangle-ii/2023-04-29 09.00.00 - Accepted - runtime 44ms - memory 16.2MB.py deleted file mode 100644 index 5e9e793..0000000 --- a/119-pascals-triangle-ii/2023-04-29 09.00.00 - Accepted - runtime 44ms - memory 16.2MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def getRow(self, rowIndex: int) -> List[int]: - l = [[1]] - for i in range(1, rowIndex + 1): - t = [1] - for j in range(1, len(l[i - 1])): - t.append(sum(l[i - 1][j-1 : j+1])) - t += [1] - l.append(t) - return l[rowIndex] \ No newline at end of file diff --git a/1195-distribute-candies-to-people/2022-07-11 00.23.50 - Accepted - runtime 52ms - memory 14MB.py b/1195-distribute-candies-to-people/2022-07-11 00.23.50 - Accepted - runtime 52ms - memory 14MB.py deleted file mode 100644 index 8298838..0000000 --- a/1195-distribute-candies-to-people/2022-07-11 00.23.50 - Accepted - runtime 52ms - memory 14MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def distributeCandies(self, candies: int, num_people: int) -> List[int]: - res = [0] * num_people - n = 0 - while True: - for i in range(num_people): - c = min(num_people * n + i + 1, candies) - res[i] += c - candies -= c - if candies <= 0: return res - n += 1 \ No newline at end of file diff --git a/12-integer-to-roman/2022-07-17 14.56.54 - Accepted - runtime 114ms - memory 14MB.py b/12-integer-to-roman/2022-07-17 14.56.54 - Accepted - runtime 114ms - memory 14MB.py deleted file mode 100644 index 158c05e..0000000 --- a/12-integer-to-roman/2022-07-17 14.56.54 - Accepted - runtime 114ms - memory 14MB.py +++ /dev/null @@ -1,23 +0,0 @@ -class Solution: - def intToRoman(self, num: int) -> str: - rom = { - "M":1000, - "CM":900, - "D":500, - "CD":400, - "C":100, - "XC":90, - "L":50, - "XL":40, - "X":10, - "IX":9, - "V":5, - "IV":4, - "I":1} - res = '' - for k,v in rom.items(): - div = num // v - res += k * div - num -= div * v - return res - \ No newline at end of file diff --git a/12-integer-to-roman/2022-07-17 14.58.19 - Accepted - runtime 85ms - memory 13.8MB.py b/12-integer-to-roman/2022-07-17 14.58.19 - Accepted - runtime 85ms - memory 13.8MB.py deleted file mode 100644 index 30fd8fe..0000000 --- a/12-integer-to-roman/2022-07-17 14.58.19 - Accepted - runtime 85ms - memory 13.8MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def intToRoman(self, num: int) -> str: - res = '' - for k,v in { - "M":1000, - "CM":900, - "D":500, - "CD":400, - "C":100, - "XC":90, - "L":50, - "XL":40, - "X":10, - "IX":9, - "V":5, - "IV":4, - "I":1}.items(): - res += k * (num // v) - num -= (num // v) * v - return res - \ No newline at end of file diff --git a/1203-print-in-order/2022-09-30 16.40.12 - Accepted - runtime 4172ms - memory 14.4MB.py b/1203-print-in-order/2022-09-30 16.40.12 - Accepted - runtime 4172ms - memory 14.4MB.py deleted file mode 100644 index 9297e36..0000000 --- a/1203-print-in-order/2022-09-30 16.40.12 - Accepted - runtime 4172ms - memory 14.4MB.py +++ /dev/null @@ -1,24 +0,0 @@ -class Foo: - def __init__(self): - self.f = self.s = False - - def first(self, printFirst: 'Callable[[], None]') -> None: - - # printFirst() outputs "first". Do not change or remove this line. - printFirst() - self.f = True - - - def second(self, printSecond: 'Callable[[], None]') -> None: - - # printSecond() outputs "second". Do not change or remove this line. - while not self.f:pass - printSecond() - self.s = True - - - def third(self, printThird: 'Callable[[], None]') -> None: - - # printThird() outputs "third". Do not change or remove this line. - while not self.s:pass - printThird() \ No newline at end of file diff --git a/1203-print-in-order/2022-09-30 16.43.22 - Accepted - runtime 109ms - memory 14.5MB.py b/1203-print-in-order/2022-09-30 16.43.22 - Accepted - runtime 109ms - memory 14.5MB.py deleted file mode 100644 index f17325d..0000000 --- a/1203-print-in-order/2022-09-30 16.43.22 - Accepted - runtime 109ms - memory 14.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -from threading import Barrier - -class Foo: - def __init__(self): - self.first_barrier = Barrier(2) - self.second_barrier = Barrier(2) - - def first(self, printFirst): - printFirst() - self.first_barrier.wait() - - def second(self, printSecond): - self.first_barrier.wait() - printSecond() - self.second_barrier.wait() - - def third(self, printThird): - self.second_barrier.wait() - printThird() \ No newline at end of file diff --git a/1203-print-in-order/2022-09-30 16.44.01 - Accepted - runtime 3460ms - memory 14.4MB.py b/1203-print-in-order/2022-09-30 16.44.01 - Accepted - runtime 3460ms - memory 14.4MB.py deleted file mode 100644 index ceddc03..0000000 --- a/1203-print-in-order/2022-09-30 16.44.01 - Accepted - runtime 3460ms - memory 14.4MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Foo: - def __init__(self): - self.f = self.s = False - - def first(self, printFirst: 'Callable[[], None]') -> None: - printFirst() - self.f = True - - def second(self, printSecond: 'Callable[[], None]') -> None: - while not self.f:pass - printSecond() - self.s = True - - - def third(self, printThird: 'Callable[[], None]') -> None: - while not self.s:pass - printThird() \ No newline at end of file diff --git a/1203-print-in-order/2022-09-30 17.06.59 - Accepted - runtime 100ms - memory 14.4MB.py b/1203-print-in-order/2022-09-30 17.06.59 - Accepted - runtime 100ms - memory 14.4MB.py deleted file mode 100644 index fc691cf..0000000 --- a/1203-print-in-order/2022-09-30 17.06.59 - Accepted - runtime 100ms - memory 14.4MB.py +++ /dev/null @@ -1,22 +0,0 @@ -from threading import Lock - -class Foo: - def __init__(self): - self.first_lock = Lock() - self.second_lock = Lock() - self.first_lock.acquire() - self.second_lock.acquire() - - def first(self, printFirst: 'Callable[[], None]') -> None: - printFirst() - self.first_lock.release() - - def second(self, printSecond: 'Callable[[], None]') -> None: - with self.first_lock: - printSecond() - self.second_lock.release() - - - def third(self, printThird: 'Callable[[], None]') -> None: - with self.second_lock: - printThird() \ No newline at end of file diff --git a/1205-defanging-an-ip-address/2022-07-11 00.27.40 - Accepted - runtime 47ms - memory 13.9MB.py b/1205-defanging-an-ip-address/2022-07-11 00.27.40 - Accepted - runtime 47ms - memory 13.9MB.py deleted file mode 100644 index bf9d356..0000000 --- a/1205-defanging-an-ip-address/2022-07-11 00.27.40 - Accepted - runtime 47ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def defangIPaddr(self, address: str) -> str: - return address.replace('.', '[.]') \ No newline at end of file diff --git a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.07.15 - Accepted - runtime 1551ms - memory 24.9MB.py b/121-best-time-to-buy-and-sell-stock/2022-06-22 14.07.15 - Accepted - runtime 1551ms - memory 24.9MB.py deleted file mode 100644 index 530a1c8..0000000 --- a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.07.15 - Accepted - runtime 1551ms - memory 24.9MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def maxProfit(self, prices: List[int]) -> int: - res = 0 - ko = prices[0] - for i in range(1, len(prices)): - if (a := prices[i] - ko) > res: - res = a - if ko > prices[i]: - ko = prices[i] - return res \ No newline at end of file diff --git a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.17 - Accepted - runtime 1889ms - memory 25MB.py b/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.17 - Accepted - runtime 1889ms - memory 25MB.py deleted file mode 100644 index 530a1c8..0000000 --- a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.17 - Accepted - runtime 1889ms - memory 25MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def maxProfit(self, prices: List[int]) -> int: - res = 0 - ko = prices[0] - for i in range(1, len(prices)): - if (a := prices[i] - ko) > res: - res = a - if ko > prices[i]: - ko = prices[i] - return res \ No newline at end of file diff --git a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.26 - Accepted - runtime 997ms - memory 25MB.py b/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.26 - Accepted - runtime 997ms - memory 25MB.py deleted file mode 100644 index 530a1c8..0000000 --- a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.26 - Accepted - runtime 997ms - memory 25MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def maxProfit(self, prices: List[int]) -> int: - res = 0 - ko = prices[0] - for i in range(1, len(prices)): - if (a := prices[i] - ko) > res: - res = a - if ko > prices[i]: - ko = prices[i] - return res \ No newline at end of file diff --git a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.33 - Accepted - runtime 2002ms - memory 25MB.py b/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.33 - Accepted - runtime 2002ms - memory 25MB.py deleted file mode 100644 index 530a1c8..0000000 --- a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.33 - Accepted - runtime 2002ms - memory 25MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def maxProfit(self, prices: List[int]) -> int: - res = 0 - ko = prices[0] - for i in range(1, len(prices)): - if (a := prices[i] - ko) > res: - res = a - if ko > prices[i]: - ko = prices[i] - return res \ No newline at end of file diff --git a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.42 - Accepted - runtime 1496ms - memory 25MB.py b/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.42 - Accepted - runtime 1496ms - memory 25MB.py deleted file mode 100644 index 95bdf15..0000000 --- a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.42 - Accepted - runtime 1496ms - memory 25MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def maxProfit(self,prices): - left = 0 #Buy - right = 1 #Sell - max_profit = 0 - while right < len(prices): - currentProfit = prices[right] - prices[left] #our current Profit - if prices[left] < prices[right]: - max_profit =max(currentProfit,max_profit) - else: - left = right - right += 1 - return max_profit \ No newline at end of file diff --git a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.50 - Accepted - runtime 1453ms - memory 25.2MB.py b/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.50 - Accepted - runtime 1453ms - memory 25.2MB.py deleted file mode 100644 index 95bdf15..0000000 --- a/121-best-time-to-buy-and-sell-stock/2022-06-22 14.44.50 - Accepted - runtime 1453ms - memory 25.2MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def maxProfit(self,prices): - left = 0 #Buy - right = 1 #Sell - max_profit = 0 - while right < len(prices): - currentProfit = prices[right] - prices[left] #our current Profit - if prices[left] < prices[right]: - max_profit =max(currentProfit,max_profit) - else: - left = right - right += 1 - return max_profit \ No newline at end of file diff --git a/1217-relative-sort-array/2022-07-19 17.44.13 - Accepted - runtime 48ms - memory 14MB.py b/1217-relative-sort-array/2022-07-19 17.44.13 - Accepted - runtime 48ms - memory 14MB.py deleted file mode 100644 index d2cf609..0000000 --- a/1217-relative-sort-array/2022-07-19 17.44.13 - Accepted - runtime 48ms - memory 14MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def relativeSortArray(self, arr1: List[int], arr2: List[int]) -> List[int]: - return sorted(arr1, key=lambda x:arr2.index(x) if x in arr2 else x * 1000) \ No newline at end of file diff --git a/1221-element-appearing-more-than-25-in-sorted-array/2024-01-04 15.55.37 - Accepted - runtime 81ms - memory 18.8MB.py b/1221-element-appearing-more-than-25-in-sorted-array/2024-01-04 15.55.37 - Accepted - runtime 81ms - memory 18.8MB.py deleted file mode 100644 index a806b64..0000000 --- a/1221-element-appearing-more-than-25-in-sorted-array/2024-01-04 15.55.37 - Accepted - runtime 81ms - memory 18.8MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def findSpecialInteger(self, arr: List[int]) -> int: - from collections import Counter - return Counter(arr).most_common(1)[0][0] - \ No newline at end of file diff --git a/1224-minimum-falling-path-sum-ii/2024-04-26 09.44.19 - Accepted - runtime 215ms - memory 20.1MB.py b/1224-minimum-falling-path-sum-ii/2024-04-26 09.44.19 - Accepted - runtime 215ms - memory 20.1MB.py deleted file mode 100644 index 60e7355..0000000 --- a/1224-minimum-falling-path-sum-ii/2024-04-26 09.44.19 - Accepted - runtime 215ms - memory 20.1MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def minFallingPathSum(self, grid: List[List[int]]) -> int: - r = [(0, -1)] - for row in grid: - r = heapq.nsmallest(2, ((a + r[i == r[0][1]][0], i) for i, a in enumerate(row))) - return r[0][0] diff --git a/1231-replace-elements-with-greatest-element-on-right-side/2023-11-28 21.49.20 - Accepted - runtime 592ms - memory 18.4MB.py b/1231-replace-elements-with-greatest-element-on-right-side/2023-11-28 21.49.20 - Accepted - runtime 592ms - memory 18.4MB.py deleted file mode 100644 index de13efc..0000000 --- a/1231-replace-elements-with-greatest-element-on-right-side/2023-11-28 21.49.20 - Accepted - runtime 592ms - memory 18.4MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def replaceElements(self, arr: List[int]) -> List[int]: - res = [-1] - g = 0 - for i in arr[::-1]: - if i > g: - g = i - res.append(g) - res.pop() - - return res[::-1] \ No newline at end of file diff --git a/1236-n-th-tribonacci-number/2024-04-24 12.22.18 - Accepted - runtime 38ms - memory 16.5MB.py b/1236-n-th-tribonacci-number/2024-04-24 12.22.18 - Accepted - runtime 38ms - memory 16.5MB.py deleted file mode 100644 index b81dc9b..0000000 --- a/1236-n-th-tribonacci-number/2024-04-24 12.22.18 - Accepted - runtime 38ms - memory 16.5MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def tribonacci(self, n: int) -> int: - l = [0, 1, 1] - for i in range(35): - l.append(sum(l[-3:])) - - return l[n] \ No newline at end of file diff --git a/1241-decompress-run-length-encoded-list/2022-08-01 21.03.28 - Accepted - runtime 82ms - memory 14.4MB.py b/1241-decompress-run-length-encoded-list/2022-08-01 21.03.28 - Accepted - runtime 82ms - memory 14.4MB.py deleted file mode 100644 index dc57cfe..0000000 --- a/1241-decompress-run-length-encoded-list/2022-08-01 21.03.28 - Accepted - runtime 82ms - memory 14.4MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def decompressRLElist(self, nums: List[int]) -> List[int]: - l = [] - for a,b in zip(nums[::2], nums[1::2]): - l += [b] * a - - return l \ No newline at end of file diff --git a/1243-sum-of-nodes-with-even-valued-grandparent/2024-04-30 21.44.42 - Accepted - runtime 71ms - memory 19.4MB.py b/1243-sum-of-nodes-with-even-valued-grandparent/2024-04-30 21.44.42 - Accepted - runtime 71ms - memory 19.4MB.py deleted file mode 100644 index 86bfaa3..0000000 --- a/1243-sum-of-nodes-with-even-valued-grandparent/2024-04-30 21.44.42 - Accepted - runtime 71ms - memory 19.4MB.py +++ /dev/null @@ -1,34 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sumEvenGrandparent(self, root: TreeNode) -> int: - def grandpa(node) -> int: - l = [] - for i in (node.left, node.right): - if i: - l.append(i) - if not l: return 0 - res = 0 - for i in l: - for j in (i.left, i.right): - if j: - res += j.val - - return res - - res = 0 - stack = [root] - while stack: - node = stack.pop() - if node.val % 2 == 0: - res += grandpa(node) - if node.left: - stack.append(node.left) - if node.right: - stack.append(node.right) - - return res \ No newline at end of file diff --git a/125-valid-palindrome/2022-06-22 13.41.26 - Accepted - runtime 89ms - memory 15.2MB.py b/125-valid-palindrome/2022-06-22 13.41.26 - Accepted - runtime 89ms - memory 15.2MB.py deleted file mode 100644 index 9ea4a14..0000000 --- a/125-valid-palindrome/2022-06-22 13.41.26 - Accepted - runtime 89ms - memory 15.2MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def isPalindrome(self, s: str) -> bool: - s = ''.join(f for f in s.lower() if f.isalnum()) - return s == s[::-1] \ No newline at end of file diff --git a/125-valid-palindrome/2022-12-16 17.15.52 - Accepted - runtime 51ms - memory 15.4MB.py b/125-valid-palindrome/2022-12-16 17.15.52 - Accepted - runtime 51ms - memory 15.4MB.py deleted file mode 100644 index 9ff0616..0000000 --- a/125-valid-palindrome/2022-12-16 17.15.52 - Accepted - runtime 51ms - memory 15.4MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def isPalindrome(self, s: str) -> bool: - s = ''.join(f for f in s.upper() if f.isalnum()) - l, r = 0, len(s) - 1 - while r > l: - if s[l] != s[r]: - return False - l += 1 - r -= 1 - - return True \ No newline at end of file diff --git a/1250-longest-common-subsequence/2024-03-12 18.58.26 - Accepted - runtime 373ms - memory 16.6MB.py b/1250-longest-common-subsequence/2024-03-12 18.58.26 - Accepted - runtime 373ms - memory 16.6MB.py deleted file mode 100644 index c3334af..0000000 --- a/1250-longest-common-subsequence/2024-03-12 18.58.26 - Accepted - runtime 373ms - memory 16.6MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: - m, n = map(len, (text1, text2)) - if m < n: - tex1, tex2 = text2, text1 - dp = [0] * (n + 1) - for c in text1: - prevRow, prevRowPrevCol = 0, 0 - for j, d in enumerate(text2): - prevRow, prevRowPrevCol = dp[j + 1], prevRow - dp[j + 1] = prevRowPrevCol + 1 if c == d else max(dp[j], prevRow) - return dp[-1] \ No newline at end of file diff --git a/1250-longest-common-subsequence/2024-03-12 18.58.37 - Accepted - runtime 363ms - memory 16.5MB.py b/1250-longest-common-subsequence/2024-03-12 18.58.37 - Accepted - runtime 363ms - memory 16.5MB.py deleted file mode 100644 index bfe1a1e..0000000 --- a/1250-longest-common-subsequence/2024-03-12 18.58.37 - Accepted - runtime 363ms - memory 16.5MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: - m, n = map(len, (text1, text2)) - dp = [0] * (n + 1) - for c in text1: - prevRow, prevRowPrevCol = 0, 0 - for j, d in enumerate(text2): - prevRow, prevRowPrevCol = dp[j + 1], prevRow - dp[j + 1] = prevRowPrevCol + 1 if c == d else max(dp[j], prevRow) - return dp[-1] \ No newline at end of file diff --git a/1250-longest-common-subsequence/2024-03-12 20.02.07 - Accepted - runtime 369ms - memory 16.7MB.py b/1250-longest-common-subsequence/2024-03-12 20.02.07 - Accepted - runtime 369ms - memory 16.7MB.py deleted file mode 100644 index 7e672a4..0000000 --- a/1250-longest-common-subsequence/2024-03-12 20.02.07 - Accepted - runtime 369ms - memory 16.7MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: - m, n = map(len, (text1, text2)) - dp = [0] * (n + 1) - for i in text1: - a = b = 0 - for j, c in enumerate(text2): - a, b = dp[j + 1], a - dp[j + 1] = b + 1 if c == i else max(dp[j], a) - - return dp[-1] \ No newline at end of file diff --git a/1250-longest-common-subsequence/2024-03-13 01.01.50 - Accepted - runtime 371ms - memory 16.5MB.py b/1250-longest-common-subsequence/2024-03-13 01.01.50 - Accepted - runtime 371ms - memory 16.5MB.py deleted file mode 100644 index 11cffc0..0000000 --- a/1250-longest-common-subsequence/2024-03-13 01.01.50 - Accepted - runtime 371ms - memory 16.5MB.py +++ /dev/null @@ -1,12 +0,0 @@ -from functools import lru_cache -class Solution: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: - n, m = len(text1), len(text2) - dp = [0] * (m + 1) - for i in text1: - a = b = 0 - for j, c in enumerate(text2): - a, b = dp[j + 1], a - dp[j + 1] = 1 + b if i == c else max(dp[j], a) - - return dp[-1] \ No newline at end of file diff --git a/1250-longest-common-subsequence/2024-03-14 12.15.09 - Accepted - runtime 372ms - memory 16.5MB.py b/1250-longest-common-subsequence/2024-03-14 12.15.09 - Accepted - runtime 372ms - memory 16.5MB.py deleted file mode 100644 index 7546a32..0000000 --- a/1250-longest-common-subsequence/2024-03-14 12.15.09 - Accepted - runtime 372ms - memory 16.5MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: - n, m = len(text1), len(text2) - dp = [0] * (m + 1) - for i in text1: - a = b = 0 - for j, c in enumerate(text2): - a, b = dp[j + 1], a - dp[j + 1] = 1 + b if i == c else max(dp[j], a) - - return dp[-1] \ No newline at end of file diff --git a/1250-longest-common-subsequence/2024-03-14 12.17.37 - Accepted - runtime 366ms - memory 16.6MB.py b/1250-longest-common-subsequence/2024-03-14 12.17.37 - Accepted - runtime 366ms - memory 16.6MB.py deleted file mode 100644 index dbdd447..0000000 --- a/1250-longest-common-subsequence/2024-03-14 12.17.37 - Accepted - runtime 366ms - memory 16.6MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: - n, m = len(text1), len(text2) - dp = [0] * (m + 1) - for i in text1: - a = b = 0 - for j, c in enumerate(text2): - a, b = dp[j + 1], a - dp[j + 1] = 1 + b if i == c else max(dp[j], a) - - return dp[-1] \ No newline at end of file diff --git a/1250-longest-common-subsequence/2024-03-14 13.03.08 - Accepted - runtime 368ms - memory 16.6MB.py b/1250-longest-common-subsequence/2024-03-14 13.03.08 - Accepted - runtime 368ms - memory 16.6MB.py deleted file mode 100644 index 996e5bf..0000000 --- a/1250-longest-common-subsequence/2024-03-14 13.03.08 - Accepted - runtime 368ms - memory 16.6MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: - n, m = map(len, (text1, text2)) - dp = [0] * (m + 1) - for i in text1: - a = b = 0 - for j, c in enumerate(text2): - a, b = dp[j + 1], a - dp[j + 1] = 1 + b if c == i else max(dp[j], a) - - return dp[-1] \ No newline at end of file diff --git a/1254-deepest-leaves-sum/2024-04-15 15.21.32 - Accepted - runtime 108ms - memory 19.5MB.py b/1254-deepest-leaves-sum/2024-04-15 15.21.32 - Accepted - runtime 108ms - memory 19.5MB.py deleted file mode 100644 index e42ea5a..0000000 --- a/1254-deepest-leaves-sum/2024-04-15 15.21.32 - Accepted - runtime 108ms - memory 19.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def deepestLeavesSum(self, root: Optional[TreeNode]) -> int: - level = deque([root]) - s = 0 - while level: - s = 0 - for _ in range(len(level)): - n = level.pop() - s += n.val - if n.left: level.appendleft(n.left) - if n.right: level.appendleft(n.right) - - return s diff --git a/1256-rank-transform-of-an-array/2024-04-15 15.25.23 - Accepted - runtime 234ms - memory 35.9MB.py b/1256-rank-transform-of-an-array/2024-04-15 15.25.23 - Accepted - runtime 234ms - memory 35.9MB.py deleted file mode 100644 index f8e565a..0000000 --- a/1256-rank-transform-of-an-array/2024-04-15 15.25.23 - Accepted - runtime 234ms - memory 35.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def arrayRankTransform(self, arr: List[int]) -> List[int]: - d = {} - for ind, i in enumerate(sorted(set(arr)), 1): - d[i] = ind - - return [d[f] for f in arr] \ No newline at end of file diff --git a/1267-remove-zero-sum-consecutive-nodes-from-linked-list/2024-03-12 15.01.50 - Accepted - runtime 36ms - memory 16.9MB.py b/1267-remove-zero-sum-consecutive-nodes-from-linked-list/2024-03-12 15.01.50 - Accepted - runtime 36ms - memory 16.9MB.py deleted file mode 100644 index 624f51e..0000000 --- a/1267-remove-zero-sum-consecutive-nodes-from-linked-list/2024-03-12 15.01.50 - Accepted - runtime 36ms - memory 16.9MB.py +++ /dev/null @@ -1,30 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeZeroSumSublists(self, head: Optional[ListNode]) -> Optional[ListNode]: - dummy = ListNode() - dummy.next = head - pre = 0 - dic = {0: dummy} - while head: - pre += head.val - if pre in dic: - tmp = dic[pre] - start = tmp - tmpsum = pre - while tmp != head: - tmp = tmp.next - tmpsum += tmp.val - if tmp != head: - del dic[tmpsum] - - start.next = head.next - else: - dic[pre] = head - - head = head.next - - return dummy.next \ No newline at end of file diff --git a/128-longest-consecutive-sequence/2022-07-05 18.22.25 - Accepted - runtime 740ms - memory 28MB.py b/128-longest-consecutive-sequence/2022-07-05 18.22.25 - Accepted - runtime 740ms - memory 28MB.py deleted file mode 100644 index eefb3d5..0000000 --- a/128-longest-consecutive-sequence/2022-07-05 18.22.25 - Accepted - runtime 740ms - memory 28MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def longestConsecutive(self, nums: List[int]) -> int: - nums = sorted(set(nums)) - l = len(nums) - if not l: return 0 - curr = res = 1 - for i in range(l - 1): - if nums[i] + 1 == nums[i + 1]: - curr += 1 - else: - res = max(res, curr) - curr = 1 - - return max(res, curr) \ No newline at end of file diff --git a/1287-distance-between-bus-stops/2024-04-21 18.13.37 - Accepted - runtime 50ms - memory 17.6MB.py b/1287-distance-between-bus-stops/2024-04-21 18.13.37 - Accepted - runtime 50ms - memory 17.6MB.py deleted file mode 100644 index b58b719..0000000 --- a/1287-distance-between-bus-stops/2024-04-21 18.13.37 - Accepted - runtime 50ms - memory 17.6MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def distanceBetweenBusStops(self, d: List[int], s: int, t: int) -> int: - a,b = sorted((s,t)) - return min(sum(d[a:b]), sum(d) - sum(d[a:b])) \ No newline at end of file diff --git a/129-sum-root-to-leaf-numbers/2023-03-14 15.07.37 - Accepted - runtime 32ms - memory 13.8MB.py b/129-sum-root-to-leaf-numbers/2023-03-14 15.07.37 - Accepted - runtime 32ms - memory 13.8MB.py deleted file mode 100644 index f76fc42..0000000 --- a/129-sum-root-to-leaf-numbers/2023-03-14 15.07.37 - Accepted - runtime 32ms - memory 13.8MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def get_nums(self, node: Optional[TreeNode], num: str = ''): - if node: - num = num + str(node.val) - if node.left or node.right: - for sub in (node.left, node.right): - if sub: - yield from self.get_nums(sub, num) - else: - yield num - else: - yield num - def sumNumbers(self, root: Optional[TreeNode]) -> int: - return sum(map(int, self.get_nums(root))) \ No newline at end of file diff --git a/129-sum-root-to-leaf-numbers/2023-03-14 15.11.48 - Accepted - runtime 29ms - memory 13.8MB.py b/129-sum-root-to-leaf-numbers/2023-03-14 15.11.48 - Accepted - runtime 29ms - memory 13.8MB.py deleted file mode 100644 index 19c0200..0000000 --- a/129-sum-root-to-leaf-numbers/2023-03-14 15.11.48 - Accepted - runtime 29ms - memory 13.8MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def sum(self, node: Optional[TreeNode], s: int = 0) -> int: - if not node: return 0 - if not node.left and not node.right: return s * 10 + node.val - return self.sum(node.left, s * 10 + node.val) + self.sum(node.right, s * 10 + node.val) - - def sumNumbers(self, root: Optional[TreeNode]) -> int: - return self.sum(root) \ No newline at end of file diff --git a/129-sum-root-to-leaf-numbers/2023-03-14 15.13.26 - Accepted - runtime 32ms - memory 14MB.py b/129-sum-root-to-leaf-numbers/2023-03-14 15.13.26 - Accepted - runtime 32ms - memory 14MB.py deleted file mode 100644 index 0df385d..0000000 --- a/129-sum-root-to-leaf-numbers/2023-03-14 15.13.26 - Accepted - runtime 32ms - memory 14MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def sum(self, node: Optional[TreeNode], s: int = 0) -> int: - if not node: return 0 - s = s * 10 + node.val - if not node.left and not node.right: return s - return self.sum(node.left, s) + self.sum(node.right, s) - - def sumNumbers(self, root: Optional[TreeNode]) -> int: - return self.sum(root) \ No newline at end of file diff --git a/129-sum-root-to-leaf-numbers/2024-04-15 08.29.06 - Accepted - runtime 31ms - memory 16.5MB.py b/129-sum-root-to-leaf-numbers/2024-04-15 08.29.06 - Accepted - runtime 31ms - memory 16.5MB.py deleted file mode 100644 index 2ad11c3..0000000 --- a/129-sum-root-to-leaf-numbers/2024-04-15 08.29.06 - Accepted - runtime 31ms - memory 16.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, root, res = ''): - if not root: - yield int(res) - else: - res += str(root.val) - if not root.left and not root.right: - yield int(res) - else: - if root.left: yield from self.traverse(root.left, res) - if root.right: yield from self.traverse(root.right, res) - def sumNumbers(self, root: Optional[TreeNode], t = 0) -> int: - return sum(self.traverse(root)) \ No newline at end of file diff --git a/129-sum-root-to-leaf-numbers/2024-04-15 08.36.50 - Accepted - runtime 26ms - memory 16.5MB.py b/129-sum-root-to-leaf-numbers/2024-04-15 08.36.50 - Accepted - runtime 26ms - memory 16.5MB.py deleted file mode 100644 index 106c1c1..0000000 --- a/129-sum-root-to-leaf-numbers/2024-04-15 08.36.50 - Accepted - runtime 26ms - memory 16.5MB.py +++ /dev/null @@ -1,12 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sumNumbers(self, root: Optional[TreeNode], t = 0) -> int: - if not root: return 0 - t = t * 10 + root.val - if not root.left and not root.right: return t - return self.sumNumbers(root.right, t) + self.sumNumbers(root.left, t) \ No newline at end of file diff --git a/1297-maximum-number-of-balloons/2024-04-01 16.15.39 - Accepted - runtime 32ms - memory 16.6MB.py b/1297-maximum-number-of-balloons/2024-04-01 16.15.39 - Accepted - runtime 32ms - memory 16.6MB.py deleted file mode 100644 index 0cc3250..0000000 --- a/1297-maximum-number-of-balloons/2024-04-01 16.15.39 - Accepted - runtime 32ms - memory 16.6MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def maxNumberOfBalloons(self, text: str) -> int: - c = Counter(text) - return min(c['b'], c['a'], c['l'] // 2, c['o'] // 2, c['n']) \ No newline at end of file diff --git a/13-roman-to-integer/2022-04-18 22.32.40 - Accepted - runtime 52ms - memory 13.9MB.py b/13-roman-to-integer/2022-04-18 22.32.40 - Accepted - runtime 52ms - memory 13.9MB.py deleted file mode 100644 index ff8efce..0000000 --- a/13-roman-to-integer/2022-04-18 22.32.40 - Accepted - runtime 52ms - memory 13.9MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def romanToInt(self, num: str) -> int: - roman_numerals = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} - result = 0 - for i,c in enumerate(num): - if (i+1) == len(num) or roman_numerals[c] >= roman_numerals[num[i+1]]: - result += roman_numerals[c] - else: - result -= roman_numerals[c] - return result \ No newline at end of file diff --git a/13-roman-to-integer/2024-02-16 19.45.57 - Accepted - runtime 8ms - memory 12.7MB.cpp b/13-roman-to-integer/2024-02-16 19.45.57 - Accepted - runtime 8ms - memory 12.7MB.cpp deleted file mode 100644 index 3dd3828..0000000 --- a/13-roman-to-integer/2024-02-16 19.45.57 - Accepted - runtime 8ms - memory 12.7MB.cpp +++ /dev/null @@ -1,24 +0,0 @@ -class Solution { -public: - int romanToInt(string s) { - unordered_map rn = { - {'I', 1}, - {'V', 5}, - {'X', 10}, - {'L', 50}, - {'C', 100}, - {'D', 500}, - {'M', 1000} - }; - int r = 0; - for (int ind=0; ind < s.size(); ++ind){ - if ((ind + 1) == s.size() || rn[s[ind]] >= rn[s[ind + 1]]){ - r += rn[s[ind]]; - } - else { - r -= rn[s[ind]]; - } - } - return r; - } -}; \ No newline at end of file diff --git a/13-roman-to-integer/2024-02-16 20.01.46 - Accepted - runtime 20ms - memory 12.9MB.cpp b/13-roman-to-integer/2024-02-16 20.01.46 - Accepted - runtime 20ms - memory 12.9MB.cpp deleted file mode 100644 index 4156b11..0000000 --- a/13-roman-to-integer/2024-02-16 20.01.46 - Accepted - runtime 20ms - memory 12.9MB.cpp +++ /dev/null @@ -1,24 +0,0 @@ -class Solution { -public: - int romanToInt(string s) { - unordered_map rn = { - {'I', 1}, - {'V', 5}, - {'X', 10}, - {'L', 50}, - {'C', 100}, - {'D', 500}, - {'M', 1000} - }; - int r = 0; - for (int i=0; i < s.size(); ++i){ // VI - if (rn[s[i]] >= rn[s[i + 1]]){ - r += rn[s[i]]; - } - else { - r -= rn[s[i]]; - } - } - return r; - } -}; \ No newline at end of file diff --git a/1306-minimum-absolute-difference/2022-09-26 18.06.25 - Accepted - runtime 716ms - memory 28.9MB.py b/1306-minimum-absolute-difference/2022-09-26 18.06.25 - Accepted - runtime 716ms - memory 28.9MB.py deleted file mode 100644 index dc5e702..0000000 --- a/1306-minimum-absolute-difference/2022-09-26 18.06.25 - Accepted - runtime 716ms - memory 28.9MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def minimumAbsDifference(self, arr: List[int]) -> List[List[int]]: - arr.sort() - min_difference = min(b - a for a,b in zip(arr, arr[1:])) - return [[a,b] for a,b in zip(arr, arr[1:]) if b - a == min_difference] \ No newline at end of file diff --git a/1319-unique-number-of-occurrences/2024-01-17 19.12.57 - Accepted - runtime 27ms - memory 17.4MB.py b/1319-unique-number-of-occurrences/2024-01-17 19.12.57 - Accepted - runtime 27ms - memory 17.4MB.py deleted file mode 100644 index 9ef564e..0000000 --- a/1319-unique-number-of-occurrences/2024-01-17 19.12.57 - Accepted - runtime 27ms - memory 17.4MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def uniqueOccurrences(self, arr: List[int]) -> bool: - k = Counter(arr).values() - return len(k) == len(set(k)) \ No newline at end of file diff --git a/133-clone-graph/2023-03-05 19.02.28 - Accepted - runtime 48ms - memory 14.5MB.py b/133-clone-graph/2023-03-05 19.02.28 - Accepted - runtime 48ms - memory 14.5MB.py deleted file mode 100644 index 90ead9d..0000000 --- a/133-clone-graph/2023-03-05 19.02.28 - Accepted - runtime 48ms - memory 14.5MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def cloneGraph(self, node: 'Node') -> 'Node': - from copy import deepcopy - return deepcopy(node) \ No newline at end of file diff --git a/133-clone-graph/2023-03-05 19.19.39 - Accepted - runtime 39ms - memory 14.4MB.py b/133-clone-graph/2023-03-05 19.19.39 - Accepted - runtime 39ms - memory 14.4MB.py deleted file mode 100644 index 25732d1..0000000 --- a/133-clone-graph/2023-03-05 19.19.39 - Accepted - runtime 39ms - memory 14.4MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def cloneGraph(self, node: 'Node') -> 'Node': - if not node: return node - - d, clones = deque([node]), {node.val: Node(node.val)} - while d: - curr = d.popleft() - curr_clone = clones[curr.val] - for i in curr.neighbors: - if i.val not in clones: - clones[i.val] = Node(i.val) - d.append(i) - - curr_clone.neighbors.append(clones[i.val]) - - - return clones[node.val] \ No newline at end of file diff --git a/133-clone-graph/2023-04-08 23.57.51 - Accepted - runtime 41ms - memory 14.3MB.py b/133-clone-graph/2023-04-08 23.57.51 - Accepted - runtime 41ms - memory 14.3MB.py deleted file mode 100644 index 303ede7..0000000 --- a/133-clone-graph/2023-04-08 23.57.51 - Accepted - runtime 41ms - memory 14.3MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def cloneGraph(self, node: 'Node') -> 'Node': - if not node: return node - - d, clones = deque([node]), {node.val: Node(node.val)} - while d: - curr = d.popleft() - curr_clone = clones[curr.val] - for i in curr.neighbors: - if i.val not in clones: - clones[i.val] = Node(i.val) - d.append(i) - curr_clone.neighbors.append(clones[i.val]) - - return clones[node.val] \ No newline at end of file diff --git a/134-gas-station/2023-01-07 16.38.42 - Accepted - runtime 704ms - memory 18.9MB.py b/134-gas-station/2023-01-07 16.38.42 - Accepted - runtime 704ms - memory 18.9MB.py deleted file mode 100644 index d734a5d..0000000 --- a/134-gas-station/2023-01-07 16.38.42 - Accepted - runtime 704ms - memory 18.9MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: - curr = total = start = 0 - for i in range(len(gas)): - total += gas[i] - cost[i] - curr += gas[i] - cost[i] - if curr < 0: - curr = 0 - start = i + 1 - - return -1 if total < 0 else start \ No newline at end of file diff --git a/1341-split-a-string-in-balanced-strings/2024-01-04 16.06.52 - Accepted - runtime 36ms - memory 17.4MB.py b/1341-split-a-string-in-balanced-strings/2024-01-04 16.06.52 - Accepted - runtime 36ms - memory 17.4MB.py deleted file mode 100644 index 61ec8b5..0000000 --- a/1341-split-a-string-in-balanced-strings/2024-01-04 16.06.52 - Accepted - runtime 36ms - memory 17.4MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def balancedStringSplit(self, s: str) -> int: - c = r = 0 - for i in s: - c += 1 if i == 'L' else -1 - if c == 0: - r += 1 - - return r \ No newline at end of file diff --git a/135-candy/2023-01-19 18.47.39 - Accepted - runtime 157ms - memory 16.8MB.py b/135-candy/2023-01-19 18.47.39 - Accepted - runtime 157ms - memory 16.8MB.py deleted file mode 100644 index aa21883..0000000 --- a/135-candy/2023-01-19 18.47.39 - Accepted - runtime 157ms - memory 16.8MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def candy(self, ratings: List[int]) -> int: - n = len(ratings) - rewards = [1] * n - for i in range(1, n): - if ratings[i] > ratings[i - 1]: - rewards[i] = rewards[i - 1] + 1 - - for i in range(n - 2, -1, -1): - if ratings[i] > ratings[i + 1]: - rewards[i] = max(rewards[i], rewards[i + 1] + 1) - - return sum(rewards) \ No newline at end of file diff --git a/1354-find-players-with-zero-or-one-losses/2024-01-15 18.28.43 - Accepted - runtime 1354ms - memory 71.2MB.py b/1354-find-players-with-zero-or-one-losses/2024-01-15 18.28.43 - Accepted - runtime 1354ms - memory 71.2MB.py deleted file mode 100644 index 7e81b74..0000000 --- a/1354-find-players-with-zero-or-one-losses/2024-01-15 18.28.43 - Accepted - runtime 1354ms - memory 71.2MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def findWinners(self, matches: List[List[int]]) -> List[List[int]]: - w = [] - l = [] - for a,b in matches: - w.append(a) - l.append(b) - - w, l = map(Counter, (w, l)) - return [sorted(w.keys() - l.keys()), sorted([a for a,b in l.items() if b == 1])] \ No newline at end of file diff --git a/136-single-number/2022-06-23 22.04.47 - Accepted - runtime 292ms - memory 16.8MB.py b/136-single-number/2022-06-23 22.04.47 - Accepted - runtime 292ms - memory 16.8MB.py deleted file mode 100644 index f1017c9..0000000 --- a/136-single-number/2022-06-23 22.04.47 - Accepted - runtime 292ms - memory 16.8MB.py +++ /dev/null @@ -1,4 +0,0 @@ -from collections import Counter -class Solution: - def singleNumber(self, nums: List[int]) -> int: - return Counter(nums).most_common()[-1][0] \ No newline at end of file diff --git a/136-single-number/2022-06-23 22.04.55 - Accepted - runtime 277ms - memory 16.8MB.py b/136-single-number/2022-06-23 22.04.55 - Accepted - runtime 277ms - memory 16.8MB.py deleted file mode 100644 index f1017c9..0000000 --- a/136-single-number/2022-06-23 22.04.55 - Accepted - runtime 277ms - memory 16.8MB.py +++ /dev/null @@ -1,4 +0,0 @@ -from collections import Counter -class Solution: - def singleNumber(self, nums: List[int]) -> int: - return Counter(nums).most_common()[-1][0] \ No newline at end of file diff --git a/136-single-number/2022-06-23 22.06.06 - Accepted - runtime 304ms - memory 16.8MB.py b/136-single-number/2022-06-23 22.06.06 - Accepted - runtime 304ms - memory 16.8MB.py deleted file mode 100644 index 4df1a44..0000000 --- a/136-single-number/2022-06-23 22.06.06 - Accepted - runtime 304ms - memory 16.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def singleNumber(self, nums: List[int]) -> int: - xor = 0 - for num in nums: - xor ^= num - - return xor \ No newline at end of file diff --git a/136-single-number/2022-06-23 22.06.14 - Accepted - runtime 178ms - memory 16.7MB.py b/136-single-number/2022-06-23 22.06.14 - Accepted - runtime 178ms - memory 16.7MB.py deleted file mode 100644 index 4df1a44..0000000 --- a/136-single-number/2022-06-23 22.06.14 - Accepted - runtime 178ms - memory 16.7MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def singleNumber(self, nums: List[int]) -> int: - xor = 0 - for num in nums: - xor ^= num - - return xor \ No newline at end of file diff --git a/1362-airplane-seat-assignment-probability/2024-04-15 14.42.55 - Accepted - runtime 40ms - memory 16.6MB.py b/1362-airplane-seat-assignment-probability/2024-04-15 14.42.55 - Accepted - runtime 40ms - memory 16.6MB.py deleted file mode 100644 index 5ec58e4..0000000 --- a/1362-airplane-seat-assignment-probability/2024-04-15 14.42.55 - Accepted - runtime 40ms - memory 16.6MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def nthPersonGetsNthSeat(self, n: int) -> float: - return 1 if n == 1 else 0.5 \ No newline at end of file diff --git a/1371-minimum-remove-to-make-valid-parentheses/2024-04-06 10.44.22 - Accepted - runtime 63ms - memory 17.9MB.py b/1371-minimum-remove-to-make-valid-parentheses/2024-04-06 10.44.22 - Accepted - runtime 63ms - memory 17.9MB.py deleted file mode 100644 index c5c1fdd..0000000 --- a/1371-minimum-remove-to-make-valid-parentheses/2024-04-06 10.44.22 - Accepted - runtime 63ms - memory 17.9MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def minRemoveToMakeValid(self, s: str) -> str: - r = '' - op = 0 - for i in s: - if i == '(': - op += 1 - r += i - - elif i == ')': - if op: - r += i - op -= 1 - - else: - r += i - - - return r[::-1].replace('(', '', op)[::-1] \ No newline at end of file diff --git a/1378-cells-with-odd-values-in-a-matrix/2022-09-20 20.06.43 - Accepted - runtime 85ms - memory 13.9MB.py b/1378-cells-with-odd-values-in-a-matrix/2022-09-20 20.06.43 - Accepted - runtime 85ms - memory 13.9MB.py deleted file mode 100644 index db952c7..0000000 --- a/1378-cells-with-odd-values-in-a-matrix/2022-09-20 20.06.43 - Accepted - runtime 85ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def oddCells(self, m: int, n: int, indices: List[List[int]]) -> int: - l = [[0] * m for f in range(n)] - for r, c in indices: - for i in l:i[r] += 1 - l[c] = [f+1 for f in l[c]] - - return sum(sum(i%2 for i in f)for f in l) - \ No newline at end of file diff --git a/1378-cells-with-odd-values-in-a-matrix/2022-09-20 20.11.45 - Accepted - runtime 75ms - memory 14MB.py b/1378-cells-with-odd-values-in-a-matrix/2022-09-20 20.11.45 - Accepted - runtime 75ms - memory 14MB.py deleted file mode 100644 index 20185c9..0000000 --- a/1378-cells-with-odd-values-in-a-matrix/2022-09-20 20.11.45 - Accepted - runtime 75ms - memory 14MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def oddCells(self, m: int, n: int, indices: List[List[int]]) -> int: - columns, rows = [0] * n, [0] * m - for r,c in indices: - rows[r] += 1 - columns[c] += 1 - return sum((r + c) % 2 for c in columns for r in rows) \ No newline at end of file diff --git a/1392-find-the-difference-of-two-arrays/2023-05-04 18.39.42 - Accepted - runtime 187ms - memory 16.7MB.py b/1392-find-the-difference-of-two-arrays/2023-05-04 18.39.42 - Accepted - runtime 187ms - memory 16.7MB.py deleted file mode 100644 index 90b6226..0000000 --- a/1392-find-the-difference-of-two-arrays/2023-05-04 18.39.42 - Accepted - runtime 187ms - memory 16.7MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def findDifference(self, nums1: List[int], nums2: List[int]) -> List[List[int]]: - a, b = set(nums1), set(nums2) - return a.difference(b), b.difference(a) \ No newline at end of file diff --git a/1393-maximum-value-of-k-coins-from-piles/2023-04-15 14.32.05 - Accepted - runtime 4459ms - memory 141.1MB.py b/1393-maximum-value-of-k-coins-from-piles/2023-04-15 14.32.05 - Accepted - runtime 4459ms - memory 141.1MB.py deleted file mode 100644 index eaccfa0..0000000 --- a/1393-maximum-value-of-k-coins-from-piles/2023-04-15 14.32.05 - Accepted - runtime 4459ms - memory 141.1MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def maxValueOfCoins(self, piles: List[List[int]], k: int) -> int: - n = len(piles) - @functools.lru_cache(None) - def solve(i: int, k: int) -> int: - if k == 0 or i == n: return 0 - res, curr = solve(i + 1, k), 0 - for j in range(min(len(piles[i]), k)): - curr += piles[i][j] - res = max(res, curr + solve(i + 1, k - j - 1)) - return res - - return solve(0, k) \ No newline at end of file diff --git a/1395-minimum-time-visiting-all-points/2022-07-27 01.07.04 - Accepted - runtime 112ms - memory 14MB.py b/1395-minimum-time-visiting-all-points/2022-07-27 01.07.04 - Accepted - runtime 112ms - memory 14MB.py deleted file mode 100644 index d2a446c..0000000 --- a/1395-minimum-time-visiting-all-points/2022-07-27 01.07.04 - Accepted - runtime 112ms - memory 14MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minTimeToVisitAllPoints(self, points: List[List[int]]) -> int: - r = 0 - for i in range(len(points) - 1): - x,y = points[i] - X,Y = points[i + 1] - r += max(abs(x - X), abs(y - Y)) - - return r \ No newline at end of file diff --git a/14-longest-common-prefix/2022-04-18 22.41.04 - Accepted - runtime 37ms - memory 13.9MB.py b/14-longest-common-prefix/2022-04-18 22.41.04 - Accepted - runtime 37ms - memory 13.9MB.py deleted file mode 100644 index d1a16cc..0000000 --- a/14-longest-common-prefix/2022-04-18 22.41.04 - Accepted - runtime 37ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def longestCommonPrefix(self, strs: List[str]) -> str: - res = '' - check = 0 - while(check < len(min(strs,key=len)) and len(set(f[check]for f in strs)) == 1): - res += strs[0][check] - check += 1 - - return res \ No newline at end of file diff --git a/14-longest-common-prefix/2024-02-16 20.12.12 - Accepted - runtime 31ms - memory 16.6MB.py b/14-longest-common-prefix/2024-02-16 20.12.12 - Accepted - runtime 31ms - memory 16.6MB.py deleted file mode 100644 index f656404..0000000 --- a/14-longest-common-prefix/2024-02-16 20.12.12 - Accepted - runtime 31ms - memory 16.6MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def longestCommonPrefix(self, strs: List[str]) -> str: - ind = 0 - while ind < len(strs[0]): - c = strs[0][ind] - for i in strs: - if len(i) <= ind or i[ind] != c: return strs[0][:ind] - ind += 1 - - return strs[0][:ind] - \ No newline at end of file diff --git a/14-longest-common-prefix/2024-02-16 20.14.08 - Accepted - runtime 29ms - memory 16.7MB.py b/14-longest-common-prefix/2024-02-16 20.14.08 - Accepted - runtime 29ms - memory 16.7MB.py deleted file mode 100644 index 00630b9..0000000 --- a/14-longest-common-prefix/2024-02-16 20.14.08 - Accepted - runtime 29ms - memory 16.7MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def longestCommonPrefix(self, strs: List[str]) -> str: - ind = 0 - m = len(min(strs, key=len)) - while ind < m: - c = strs[0][ind] - for i in strs: - if i[ind] != c: return strs[0][:ind] - ind += 1 - - return strs[0][:ind] - \ No newline at end of file diff --git a/14-longest-common-prefix/2024-02-16 22.04.32 - Accepted - runtime 0ms - memory 11.2MB.cpp b/14-longest-common-prefix/2024-02-16 22.04.32 - Accepted - runtime 0ms - memory 11.2MB.cpp deleted file mode 100644 index 7019ab4..0000000 --- a/14-longest-common-prefix/2024-02-16 22.04.32 - Accepted - runtime 0ms - memory 11.2MB.cpp +++ /dev/null @@ -1,13 +0,0 @@ -class Solution { -public: - string longestCommonPrefix(vector& s) { - sort(s.begin(), s.end()); - int n = s.size(); - string res = "", a = s[0], b = s[n - 1]; - for (int i = 0;i < min(a.size(), b.size()); i++){ - if(a[i] != b[i]) return res; - res += a[i]; - } - return res; - } -}; \ No newline at end of file diff --git a/1406-subtract-the-product-and-sum-of-digits-of-an-integer/2022-08-01 20.49.05 - Accepted - runtime 52ms - memory 13.9MB.py b/1406-subtract-the-product-and-sum-of-digits-of-an-integer/2022-08-01 20.49.05 - Accepted - runtime 52ms - memory 13.9MB.py deleted file mode 100644 index a0bb127..0000000 --- a/1406-subtract-the-product-and-sum-of-digits-of-an-integer/2022-08-01 20.49.05 - Accepted - runtime 52ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def subtractProductAndSum(self, n: int) -> int: - return eval('*'.join(str(n))) - eval('+'.join(str(n))) \ No newline at end of file diff --git a/141-linked-list-cycle/2022-06-29 00.09.52 - Accepted - runtime 67ms - memory 17.6MB.py b/141-linked-list-cycle/2022-06-29 00.09.52 - Accepted - runtime 67ms - memory 17.6MB.py deleted file mode 100644 index 0c99d26..0000000 --- a/141-linked-list-cycle/2022-06-29 00.09.52 - Accepted - runtime 67ms - memory 17.6MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, x): -# self.val = x -# self.next = None - -class Solution: - def hasCycle(self, head: Optional[ListNode]) -> bool: - while head: - if hasattr(head, 'visited'): - return True - head.visited = True - head = head.next - return False \ No newline at end of file diff --git a/141-linked-list-cycle/2024-03-07 03.03.12 - Accepted - runtime 40ms - memory 19.6MB.py b/141-linked-list-cycle/2024-03-07 03.03.12 - Accepted - runtime 40ms - memory 19.6MB.py deleted file mode 100644 index 408ee95..0000000 --- a/141-linked-list-cycle/2024-03-07 03.03.12 - Accepted - runtime 40ms - memory 19.6MB.py +++ /dev/null @@ -1,15 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, x): -# self.val = x -# self.next = None - -class Solution: - def hasCycle(self, head: Optional[ListNode]) -> bool: - vis = set() - while head: - if head in vis: - return True - vis.add(head) - head = head.next - return False \ No newline at end of file diff --git a/1411-convert-binary-number-in-a-linked-list-to-integer/2022-08-02 00.37.17 - Accepted - runtime 40ms - memory 13.8MB.py b/1411-convert-binary-number-in-a-linked-list-to-integer/2022-08-02 00.37.17 - Accepted - runtime 40ms - memory 13.8MB.py deleted file mode 100644 index 8ca5b30..0000000 --- a/1411-convert-binary-number-in-a-linked-list-to-integer/2022-08-02 00.37.17 - Accepted - runtime 40ms - memory 13.8MB.py +++ /dev/null @@ -1,13 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def getDecimalValue(self, head: ListNode) -> int: - r = '' - while head: - r += str(head.val) - head = head.next - - return int(r, 2) \ No newline at end of file diff --git a/142-linked-list-cycle-ii/2023-01-01 00.36.09 - Accepted - runtime 58ms - memory 17.3MB.py b/142-linked-list-cycle-ii/2023-01-01 00.36.09 - Accepted - runtime 58ms - memory 17.3MB.py deleted file mode 100644 index f23d64b..0000000 --- a/142-linked-list-cycle-ii/2023-01-01 00.36.09 - Accepted - runtime 58ms - memory 17.3MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, x): -# self.val = x -# self.next = None - -class Solution: - def detectCycle(self, head: Optional[ListNode]) -> Optional[ListNode]: - while head: - if hasattr(head, 'visited'): - return head - head.visited = True - head = head.next - return None \ No newline at end of file diff --git a/142-linked-list-cycle-ii/2023-01-01 00.36.51 - Accepted - runtime 55ms - memory 17.9MB.py b/142-linked-list-cycle-ii/2023-01-01 00.36.51 - Accepted - runtime 55ms - memory 17.9MB.py deleted file mode 100644 index da07624..0000000 --- a/142-linked-list-cycle-ii/2023-01-01 00.36.51 - Accepted - runtime 55ms - memory 17.9MB.py +++ /dev/null @@ -1,15 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, x): -# self.val = x -# self.next = None - -class Solution: - def detectCycle(self, head: Optional[ListNode]) -> Optional[ListNode]: - visited = set() - while head: - if head in visited: - return head - visited.add(head) - head = head.next - return None \ No newline at end of file diff --git a/142-linked-list-cycle-ii/2023-01-01 13.23.32 - Accepted - runtime 48ms - memory 17.2MB.py b/142-linked-list-cycle-ii/2023-01-01 13.23.32 - Accepted - runtime 48ms - memory 17.2MB.py deleted file mode 100644 index e14a7a3..0000000 --- a/142-linked-list-cycle-ii/2023-01-01 13.23.32 - Accepted - runtime 48ms - memory 17.2MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def detectCycle(self, head: Optional[ListNode]) -> Optional[ListNode]: - slow = fast = head - while fast and fast.next: - slow = slow.next - fast = fast.next.next - if slow == fast: - while head != fast: - fast = fast.next - head = head.next - return head - return None \ No newline at end of file diff --git a/1421-find-numbers-with-even-number-of-digits/2024-04-30 21.28.04 - Accepted - runtime 63ms - memory 16.7MB.py b/1421-find-numbers-with-even-number-of-digits/2024-04-30 21.28.04 - Accepted - runtime 63ms - memory 16.7MB.py deleted file mode 100644 index bbb5d32..0000000 --- a/1421-find-numbers-with-even-number-of-digits/2024-04-30 21.28.04 - Accepted - runtime 63ms - memory 16.7MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findNumbers(self, nums: List[int]) -> int: - return sum(len(str(f)) % 2 == 0 for f in nums) \ No newline at end of file diff --git a/143-reorder-list/2024-03-23 18.30.04 - Accepted - runtime 54ms - memory 24.6MB.py b/143-reorder-list/2024-03-23 18.30.04 - Accepted - runtime 54ms - memory 24.6MB.py deleted file mode 100644 index a2554c9..0000000 --- a/143-reorder-list/2024-03-23 18.30.04 - Accepted - runtime 54ms - memory 24.6MB.py +++ /dev/null @@ -1,35 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reorderList(self, head: Optional[ListNode]) -> None: - """ - Do not return anything, modify head in-place instead. - """ - if not head:return - fast, slow = head, head - while fast and fast.next: - slow, fast = slow.next, fast.next.next - - mid = slow - prev, cur = None, mid - - while cur: - cur.next, prev, cur = prev, cur, cur.next - - shelf = prev - - first, second = head, shelf - - while second.next: - - next_hop = first.next - first.next = second - first = next_hop - - next_hop = second.next - second.next = first - second = next_hop - \ No newline at end of file diff --git a/1430-find-the-k-beauty-of-a-number/2024-04-30 21.22.07 - Accepted - runtime 39ms - memory 16.4MB.py b/1430-find-the-k-beauty-of-a-number/2024-04-30 21.22.07 - Accepted - runtime 39ms - memory 16.4MB.py deleted file mode 100644 index 508282a..0000000 --- a/1430-find-the-k-beauty-of-a-number/2024-04-30 21.22.07 - Accepted - runtime 39ms - memory 16.4MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def divisorSubstrings(self, num: int, k: int) -> int: - t = str(num) - return sum(num % int(t[f:f + k]) == 0 for f in range(len(t) - k + 1)if int(t[f:f + k])) \ No newline at end of file diff --git a/144-binary-tree-preorder-traversal/2022-07-06 22.09.37 - Accepted - runtime 67ms - memory 13.8MB.py b/144-binary-tree-preorder-traversal/2022-07-06 22.09.37 - Accepted - runtime 67ms - memory 13.8MB.py deleted file mode 100644 index 20f57df..0000000 --- a/144-binary-tree-preorder-traversal/2022-07-06 22.09.37 - Accepted - runtime 67ms - memory 13.8MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]: - res = [] - stack = [root] - while stack: - node = stack.pop() - if node: - res.append(node.val) - stack.append(node.right) - stack.append(node.left) - - return res \ No newline at end of file diff --git a/144-binary-tree-preorder-traversal/2023-01-09 21.13.30 - Accepted - runtime 28ms - memory 13.9MB.py b/144-binary-tree-preorder-traversal/2023-01-09 21.13.30 - Accepted - runtime 28ms - memory 13.9MB.py deleted file mode 100644 index ed90455..0000000 --- a/144-binary-tree-preorder-traversal/2023-01-09 21.13.30 - Accepted - runtime 28ms - memory 13.9MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def dfs(self, node: Optional[TreeNode], res: list[int]) -> None: - if node: - res.append(node.val) - self.dfs(node.left, res) - self.dfs(node.right, res) - - def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]: - if not root: - return [] - res = [] - self.dfs(root, res) - return res \ No newline at end of file diff --git a/144-binary-tree-preorder-traversal/2024-02-18 22.05.34 - Accepted - runtime 4ms - memory 9.9MB.cpp b/144-binary-tree-preorder-traversal/2024-02-18 22.05.34 - Accepted - runtime 4ms - memory 9.9MB.cpp deleted file mode 100644 index 12ef8ad..0000000 --- a/144-binary-tree-preorder-traversal/2024-02-18 22.05.34 - Accepted - runtime 4ms - memory 9.9MB.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - vector preorderTraversal(TreeNode* root) { - vector p; - stack s; - if (root) s.push(root); - while(!s.empty()){ - TreeNode* n = s.top(); s.pop(); - p.push_back(n -> val); - if (n -> right) s.push(n -> right); - if (n -> left) s.push(n -> left); - } - return p; - } -}; \ No newline at end of file diff --git a/1444-number-of-steps-to-reduce-a-number-to-zero/2022-08-01 21.11.31 - Accepted - runtime 46ms - memory 13.9MB.py b/1444-number-of-steps-to-reduce-a-number-to-zero/2022-08-01 21.11.31 - Accepted - runtime 46ms - memory 13.9MB.py deleted file mode 100644 index 1e15f55..0000000 --- a/1444-number-of-steps-to-reduce-a-number-to-zero/2022-08-01 21.11.31 - Accepted - runtime 46ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def numberOfSteps(self, n: int) -> int: - r = 0 - while n: - r += 1 - if n % 2:n -= 1 - else:n //= 2 - - return r \ No newline at end of file diff --git a/1448-maximum-69-number/2022-09-20 19.23.41 - Accepted - runtime 65ms - memory 13.9MB.py b/1448-maximum-69-number/2022-09-20 19.23.41 - Accepted - runtime 65ms - memory 13.9MB.py deleted file mode 100644 index cfd51d4..0000000 --- a/1448-maximum-69-number/2022-09-20 19.23.41 - Accepted - runtime 65ms - memory 13.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def maximum69Number(self, num: int) -> int: - l = list(str(num)) - if '6' in l: - l[l.index('6')] = '9' - return ''.join(l) \ No newline at end of file diff --git a/1448-maximum-69-number/2022-09-20 19.24.20 - Accepted - runtime 30ms - memory 13.9MB.py b/1448-maximum-69-number/2022-09-20 19.24.20 - Accepted - runtime 30ms - memory 13.9MB.py deleted file mode 100644 index 0dabb83..0000000 --- a/1448-maximum-69-number/2022-09-20 19.24.20 - Accepted - runtime 30ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def maximum69Number(self, num: int) -> int: - return int(str(num).replace('6','9',1)) \ No newline at end of file diff --git a/145-binary-tree-postorder-traversal/2022-07-07 11.11.06 - Accepted - runtime 61ms - memory 13.9MB.py b/145-binary-tree-postorder-traversal/2022-07-07 11.11.06 - Accepted - runtime 61ms - memory 13.9MB.py deleted file mode 100644 index 0a2762b..0000000 --- a/145-binary-tree-postorder-traversal/2022-07-07 11.11.06 - Accepted - runtime 61ms - memory 13.9MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def postorderTraversal(self, root: Optional[TreeNode]) -> List[int]: - res = [] - stack = [root] - while stack: - node = stack.pop() - if node: - res.append(node.val) - stack.append(node.left) - stack.append(node.right) - - return res[::-1] \ No newline at end of file diff --git a/145-binary-tree-postorder-traversal/2024-02-18 22.08.10 - Accepted - runtime 0ms - memory 9.8MB.cpp b/145-binary-tree-postorder-traversal/2024-02-18 22.08.10 - Accepted - runtime 0ms - memory 9.8MB.cpp deleted file mode 100644 index f6ffa31..0000000 --- a/145-binary-tree-postorder-traversal/2024-02-18 22.08.10 - Accepted - runtime 0ms - memory 9.8MB.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - vector postorderTraversal(TreeNode* root) { - vector p; - stack s; - if (root) s.push(root); - while(!s.empty()){ - TreeNode* n = s.top(); s.pop(); - p.push_back(n -> val); - if (n -> left) s.push(n -> left); - if (n -> right) s.push(n -> right); - } - reverse(p.begin(), p.end()); - return p; - } -}; \ No newline at end of file diff --git a/1458-sort-integers-by-the-number-of-1-bits/2024-01-05 23.14.48 - Accepted - runtime 58ms - memory 17.5MB.py b/1458-sort-integers-by-the-number-of-1-bits/2024-01-05 23.14.48 - Accepted - runtime 58ms - memory 17.5MB.py deleted file mode 100644 index f527d77..0000000 --- a/1458-sort-integers-by-the-number-of-1-bits/2024-01-05 23.14.48 - Accepted - runtime 58ms - memory 17.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sortByBits(self, arr: List[int]) -> List[int]: - return sorted(arr, key=lambda x:(f'{x:b}'.count('1'), x)) \ No newline at end of file diff --git a/1469-minimum-number-of-steps-to-make-two-strings-anagram/2024-01-13 19.48.39 - Accepted - runtime 99ms - memory 17.9MB.py b/1469-minimum-number-of-steps-to-make-two-strings-anagram/2024-01-13 19.48.39 - Accepted - runtime 99ms - memory 17.9MB.py deleted file mode 100644 index 55dd784..0000000 --- a/1469-minimum-number-of-steps-to-make-two-strings-anagram/2024-01-13 19.48.39 - Accepted - runtime 99ms - memory 17.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minSteps(self, s: str, t: str) -> int: - a = collections.Counter(t).items() - b = collections.Counter(s) - r = 0 - for i,j in a: - r += max(j - b[i], 0) - - return r \ No newline at end of file diff --git a/1469-minimum-number-of-steps-to-make-two-strings-anagram/2024-01-13 19.53.03 - Accepted - runtime 108ms - memory 17.8MB.py b/1469-minimum-number-of-steps-to-make-two-strings-anagram/2024-01-13 19.53.03 - Accepted - runtime 108ms - memory 17.8MB.py deleted file mode 100644 index a76503b..0000000 --- a/1469-minimum-number-of-steps-to-make-two-strings-anagram/2024-01-13 19.53.03 - Accepted - runtime 108ms - memory 17.8MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def minSteps(self, s: str, t: str) -> int: - a, b = map(collections.Counter, (s, t)) - return sum((a - b).values()) \ No newline at end of file diff --git a/1474-longest-zigzag-path-in-a-binary-tree/2023-04-20 00.06.58 - Accepted - runtime 456ms - memory 63MB.py b/1474-longest-zigzag-path-in-a-binary-tree/2023-04-20 00.06.58 - Accepted - runtime 456ms - memory 63MB.py deleted file mode 100644 index 77fcaf7..0000000 --- a/1474-longest-zigzag-path-in-a-binary-tree/2023-04-20 00.06.58 - Accepted - runtime 456ms - memory 63MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def longestZigZag(self, root): - def dfs(root): - if not root: return [-1, -1, -1] - left, right = dfs(root.left), dfs(root.right) - return [left[1] + 1, right[0] + 1, max(left[1] + 1, right[0] + 1, left[2], right[2])] - return dfs(root)[-1] \ No newline at end of file diff --git a/1476-count-negative-numbers-in-a-sorted-matrix/2023-03-06 21.09.16 - Accepted - runtime 126ms - memory 15.1MB.py b/1476-count-negative-numbers-in-a-sorted-matrix/2023-03-06 21.09.16 - Accepted - runtime 126ms - memory 15.1MB.py deleted file mode 100644 index 418338e..0000000 --- a/1476-count-negative-numbers-in-a-sorted-matrix/2023-03-06 21.09.16 - Accepted - runtime 126ms - memory 15.1MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def countNegatives(self, grid: List[List[int]]) -> int: - return sum(sum(i < 0 for i in f) for f in grid) \ No newline at end of file diff --git a/148-sort-list/2024-01-05 22.36.53 - Accepted - runtime 137ms - memory 33.1MB.py b/148-sort-list/2024-01-05 22.36.53 - Accepted - runtime 137ms - memory 33.1MB.py deleted file mode 100644 index 8ced26a..0000000 --- a/148-sort-list/2024-01-05 22.36.53 - Accepted - runtime 137ms - memory 33.1MB.py +++ /dev/null @@ -1,20 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def sortList(self, head: Optional[ListNode]) -> Optional[ListNode]: - l = [] - while head: - l.append(head) - head = head.next - - k = sorted(l, key=lambda x: x.val) - for i in range(len(k) - 1): - k[i].next = k[i + 1] - if k: - k[-1].next = None - else: - return None - return k[0] \ No newline at end of file diff --git a/1482-how-many-numbers-are-smaller-than-the-current-number/2022-07-23 11.56.03 - Accepted - runtime 88ms - memory 14MB.py b/1482-how-many-numbers-are-smaller-than-the-current-number/2022-07-23 11.56.03 - Accepted - runtime 88ms - memory 14MB.py deleted file mode 100644 index 45aeec7..0000000 --- a/1482-how-many-numbers-are-smaller-than-the-current-number/2022-07-23 11.56.03 - Accepted - runtime 88ms - memory 14MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: - k = sorted(nums) - return [k.index(f)for f in nums] \ No newline at end of file diff --git a/1486-find-the-distance-value-between-two-arrays/2023-03-01 20.07.03 - Accepted - runtime 108ms - memory 14MB.py b/1486-find-the-distance-value-between-two-arrays/2023-03-01 20.07.03 - Accepted - runtime 108ms - memory 14MB.py deleted file mode 100644 index 6b364ca..0000000 --- a/1486-find-the-distance-value-between-two-arrays/2023-03-01 20.07.03 - Accepted - runtime 108ms - memory 14MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findTheDistanceValue(self, arr1: List[int], arr2: List[int], d: int) -> int: - return sum(all(abs(f - i) > d for f in arr2) for i in arr1) \ No newline at end of file diff --git a/1498-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/2022-08-01 20.46.14 - Accepted - runtime 977ms - memory 24MB.py b/1498-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/2022-08-01 20.46.14 - Accepted - runtime 977ms - memory 24MB.py deleted file mode 100644 index 4ef5f2f..0000000 --- a/1498-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/2022-08-01 20.46.14 - Accepted - runtime 977ms - memory 24MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, x): -# self.val = x -# self.left = None -# self.right = None - -class Solution: - def getTargetCopy(self, original: TreeNode, cloned: TreeNode, target: TreeNode) -> TreeNode: - stack = [cloned] - while stack: - node = stack.pop() - if not node:continue - if node.val == target.val: - return node - stack.append(node.left) - stack.append(node.right) - - return -1 \ No newline at end of file diff --git a/15-3sum/2022-04-18 23.07.44 - Accepted - runtime 803ms - memory 18.1MB.py b/15-3sum/2022-04-18 23.07.44 - Accepted - runtime 803ms - memory 18.1MB.py deleted file mode 100644 index 5974354..0000000 --- a/15-3sum/2022-04-18 23.07.44 - Accepted - runtime 803ms - memory 18.1MB.py +++ /dev/null @@ -1,23 +0,0 @@ -class Solution(object): - def threeSum(self, nums): - nums.sort() - res = [] - for i in range(len(nums) - 2): - if i == 0 or i > 0 and nums[i - 1] != nums[i]: - left = i + 1 - right = len(nums) - 1 - while left < right: - s = nums[i] + nums[left] + nums[right] - if s == 0: - res.append([nums[i], nums[left], nums[right]]) - left += 1 - right -= 1 - while left < right and nums[left] == nums[left - 1]: - left += 1 - while right > left and nums[right] == nums[right + 1]: - right -= 1 - elif s < 0: - left += 1 - else: - right -= 1 - return res \ No newline at end of file diff --git a/1505-create-target-array-in-the-given-order/2022-08-01 21.48.26 - Accepted - runtime 66ms - memory 13.8MB.py b/1505-create-target-array-in-the-given-order/2022-08-01 21.48.26 - Accepted - runtime 66ms - memory 13.8MB.py deleted file mode 100644 index f6534c1..0000000 --- a/1505-create-target-array-in-the-given-order/2022-08-01 21.48.26 - Accepted - runtime 66ms - memory 13.8MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: - l = [] - for a,b in zip(nums, index): - l.insert(b, a) - return l \ No newline at end of file diff --git a/1528-kids-with-the-greatest-number-of-candies/2022-08-01 16.35.54 - Accepted - runtime 56ms - memory 13.9MB.py b/1528-kids-with-the-greatest-number-of-candies/2022-08-01 16.35.54 - Accepted - runtime 56ms - memory 13.9MB.py deleted file mode 100644 index ce8634e..0000000 --- a/1528-kids-with-the-greatest-number-of-candies/2022-08-01 16.35.54 - Accepted - runtime 56ms - memory 13.9MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def kidsWithCandies(self, candies: List[int], e: int) -> List[bool]: - m = max(candies) - return [f+e >= m for f in candies] \ No newline at end of file diff --git a/1528-kids-with-the-greatest-number-of-candies/2023-04-17 12.13.29 - Accepted - runtime 45ms - memory 13.7MB.py b/1528-kids-with-the-greatest-number-of-candies/2023-04-17 12.13.29 - Accepted - runtime 45ms - memory 13.7MB.py deleted file mode 100644 index 93be917..0000000 --- a/1528-kids-with-the-greatest-number-of-candies/2023-04-17 12.13.29 - Accepted - runtime 45ms - memory 13.7MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def kidsWithCandies(self, candies: List[int], t: int) -> List[bool]: - r = max(candies) - return [f + t >= r for f in candies] diff --git a/153-find-minimum-in-rotated-sorted-array/2023-01-06 21.16.10 - Accepted - runtime 90ms - memory 14.2MB.py b/153-find-minimum-in-rotated-sorted-array/2023-01-06 21.16.10 - Accepted - runtime 90ms - memory 14.2MB.py deleted file mode 100644 index 5476270..0000000 --- a/153-find-minimum-in-rotated-sorted-array/2023-01-06 21.16.10 - Accepted - runtime 90ms - memory 14.2MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findMin(self, nums: List[int]) -> int: - return min(nums) \ No newline at end of file diff --git a/1532-reformat-the-string/2024-04-09 21.20.47 - Accepted - runtime 36ms - memory 16.5MB.py b/1532-reformat-the-string/2024-04-09 21.20.47 - Accepted - runtime 36ms - memory 16.5MB.py deleted file mode 100644 index a37c8a0..0000000 --- a/1532-reformat-the-string/2024-04-09 21.20.47 - Accepted - runtime 36ms - memory 16.5MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def reformat(self, s: str) -> str: - a = b = '' - for i in s: - if i.isalpha():a += i - else:b += i - if abs(len(a) - len(b)) > 1: return '' - a, b = sorted((a,b),key=len) - r = ''.join(i+j for i,j in zip(b,a)) - if len(a) != len(b): - r += b[-1] - return r diff --git a/1537-maximum-score-after-splitting-a-string/2024-02-08 23.35.57 - Accepted - runtime 39ms - memory 16.7MB.py b/1537-maximum-score-after-splitting-a-string/2024-02-08 23.35.57 - Accepted - runtime 39ms - memory 16.7MB.py deleted file mode 100644 index d38f260..0000000 --- a/1537-maximum-score-after-splitting-a-string/2024-02-08 23.35.57 - Accepted - runtime 39ms - memory 16.7MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def maxScore(self, s: str) -> int: - return max(s[:f + 1].count('0') + s[f + 1:].count('1') for f in range(len(s) - 1)) \ No newline at end of file diff --git a/1538-maximum-points-you-can-obtain-from-cards/2022-06-26 11.58.51 - Accepted - runtime 864ms - memory 28.8MB.py b/1538-maximum-points-you-can-obtain-from-cards/2022-06-26 11.58.51 - Accepted - runtime 864ms - memory 28.8MB.py deleted file mode 100644 index bf3d966..0000000 --- a/1538-maximum-points-you-can-obtain-from-cards/2022-06-26 11.58.51 - Accepted - runtime 864ms - memory 28.8MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution(object): - def maxScore(self, cardPoints, k): - frontSum, backSum = [0], [0] - for n in cardPoints: - frontSum.append(frontSum[-1]+n) - for n in cardPoints[::-1]: - backSum.append(backSum[-1]+n) - allCombinations = [frontSum[i]+backSum[k-i] for i in range(k+1)] - return max(allCombinations) \ No newline at end of file diff --git a/1538-maximum-points-you-can-obtain-from-cards/2022-06-26 11.59.00 - Accepted - runtime 491ms - memory 28.8MB.py b/1538-maximum-points-you-can-obtain-from-cards/2022-06-26 11.59.00 - Accepted - runtime 491ms - memory 28.8MB.py deleted file mode 100644 index bf3d966..0000000 --- a/1538-maximum-points-you-can-obtain-from-cards/2022-06-26 11.59.00 - Accepted - runtime 491ms - memory 28.8MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution(object): - def maxScore(self, cardPoints, k): - frontSum, backSum = [0], [0] - for n in cardPoints: - frontSum.append(frontSum[-1]+n) - for n in cardPoints[::-1]: - backSum.append(backSum[-1]+n) - allCombinations = [frontSum[i]+backSum[k-i] for i in range(k+1)] - return max(allCombinations) \ No newline at end of file diff --git a/1561-rearrange-words-in-a-sentence/2024-04-10 14.44.48 - Accepted - runtime 29ms - memory 18.8MB.py b/1561-rearrange-words-in-a-sentence/2024-04-10 14.44.48 - Accepted - runtime 29ms - memory 18.8MB.py deleted file mode 100644 index 981d6a3..0000000 --- a/1561-rearrange-words-in-a-sentence/2024-04-10 14.44.48 - Accepted - runtime 29ms - memory 18.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def arrangeWords(self, text: str) -> str: - return " ".join(sorted(text.split(), key=len)).capitalize() \ No newline at end of file diff --git a/1567-maximum-number-of-vowels-in-a-substring-of-given-length/2023-05-05 11.09.34 - Accepted - runtime 154ms - memory 17.3MB.py b/1567-maximum-number-of-vowels-in-a-substring-of-given-length/2023-05-05 11.09.34 - Accepted - runtime 154ms - memory 17.3MB.py deleted file mode 100644 index b538cc6..0000000 --- a/1567-maximum-number-of-vowels-in-a-substring-of-given-length/2023-05-05 11.09.34 - Accepted - runtime 154ms - memory 17.3MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def maxVowels(self, s: str, k: int) -> int: - count = 0 - for i in range(k): - if s[i] in 'aeiou': - count += 1 - - res = count - for end in range(k, len(s)): - start = end - k # 'abcde' - if s[start] in 'aeiou': - count -= 1 - if s[end] in 'aeiou': - count += 1 - res = max(res, count) - return res \ No newline at end of file diff --git a/1574-maximum-product-of-two-elements-in-an-array/2022-09-20 19.26.46 - Accepted - runtime 140ms - memory 14MB.py b/1574-maximum-product-of-two-elements-in-an-array/2022-09-20 19.26.46 - Accepted - runtime 140ms - memory 14MB.py deleted file mode 100644 index 6c83a66..0000000 --- a/1574-maximum-product-of-two-elements-in-an-array/2022-09-20 19.26.46 - Accepted - runtime 140ms - memory 14MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def maxProduct(self, nums: List[int]) -> int: - nums.sort() - return (nums[-1] - 1) * (nums[-2] - 1) \ No newline at end of file diff --git a/1580-shuffle-the-array/2022-08-01 16.16.04 - Accepted - runtime 120ms - memory 14.1MB.py b/1580-shuffle-the-array/2022-08-01 16.16.04 - Accepted - runtime 120ms - memory 14.1MB.py deleted file mode 100644 index 66f86db..0000000 --- a/1580-shuffle-the-array/2022-08-01 16.16.04 - Accepted - runtime 120ms - memory 14.1MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def shuffle(self, nums: List[int], n: int) -> List[int]: - res = [] - for a,b in zip(nums[:n], nums[n:]): - res.append(a) - res.append(b) - - return res \ No newline at end of file diff --git a/1582-design-browser-history/2024-03-01 00.25.51 - Accepted - runtime 178ms - memory 19.2MB.py b/1582-design-browser-history/2024-03-01 00.25.51 - Accepted - runtime 178ms - memory 19.2MB.py deleted file mode 100644 index 53c4aa2..0000000 --- a/1582-design-browser-history/2024-03-01 00.25.51 - Accepted - runtime 178ms - memory 19.2MB.py +++ /dev/null @@ -1,26 +0,0 @@ -class BrowserHistory: - - def __init__(self, homepage: str): - self.h = [homepage] - self.c = 0 - - def visit(self, url: str) -> None: - self.c += 1 - self.h = self.h[:self.c] - self.h.append(url) - - - def back(self, steps: int) -> str: - self.c = max(self.c - steps, 0) - return self.h[self.c] - - def forward(self, steps: int) -> str: - self.c = min(self.c + steps, len(self.h) - 1) - return self.h[self.c] - - -# Your BrowserHistory object will be instantiated and called as such: -# obj = BrowserHistory(homepage) -# obj.visit(url) -# param_2 = obj.back(steps) -# param_3 = obj.forward(steps) \ No newline at end of file diff --git a/1584-average-salary-excluding-the-minimum-and-maximum-salary/2023-05-02 00.39.10 - Accepted - runtime 50ms - memory 16.3MB.py b/1584-average-salary-excluding-the-minimum-and-maximum-salary/2023-05-02 00.39.10 - Accepted - runtime 50ms - memory 16.3MB.py deleted file mode 100644 index 6c783fd..0000000 --- a/1584-average-salary-excluding-the-minimum-and-maximum-salary/2023-05-02 00.39.10 - Accepted - runtime 50ms - memory 16.3MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def average(self, salary: List[int]) -> float: - salary.sort() - return sum(salary[1:-1]) / len(salary[1:-1]) \ No newline at end of file diff --git a/160-intersection-of-two-linked-lists/2023-11-26 19.51.42 - Accepted - runtime 121ms - memory 31.5MB.py b/160-intersection-of-two-linked-lists/2023-11-26 19.51.42 - Accepted - runtime 121ms - memory 31.5MB.py deleted file mode 100644 index 302b56e..0000000 --- a/160-intersection-of-two-linked-lists/2023-11-26 19.51.42 - Accepted - runtime 121ms - memory 31.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, x): -# self.val = x -# self.next = None - -class Solution: - def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: - a = b = 0 - t1, t2 = headA, headB - while t1: a += 1; t1 = t1.next - while t2: b += 1; t2 = t2.next - while a > b:a -= 1; headA = headA.next - while a < b:b -= 1; headB = headB.next - while headA and headB: - if headA is headB: - return headA - headA = headA.next - headB = headB.next \ No newline at end of file diff --git a/1603-running-sum-of-1d-array/2022-08-01 16.06.22 - Accepted - runtime 69ms - memory 14.1MB.py b/1603-running-sum-of-1d-array/2022-08-01 16.06.22 - Accepted - runtime 69ms - memory 14.1MB.py deleted file mode 100644 index 1ad6fb2..0000000 --- a/1603-running-sum-of-1d-array/2022-08-01 16.06.22 - Accepted - runtime 69ms - memory 14.1MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def runningSum(self, nums: List[int]) -> List[int]: - for i in range(1, len(nums)): - nums[i] += nums[i - 1] - - return nums - \ No newline at end of file diff --git a/1604-least-number-of-unique-integers-after-k-removals/2024-02-16 13.01.54 - Accepted - runtime 341ms - memory 36.9MB.py b/1604-least-number-of-unique-integers-after-k-removals/2024-02-16 13.01.54 - Accepted - runtime 341ms - memory 36.9MB.py deleted file mode 100644 index d67f0ba..0000000 --- a/1604-least-number-of-unique-integers-after-k-removals/2024-02-16 13.01.54 - Accepted - runtime 341ms - memory 36.9MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def findLeastNumOfUniqueInts(self, arr: List[int], k: int) -> int: - c = Counter(arr) - r = 0 - for a,b in sorted(c.items(), key=lambda x: x[1]): - if b <= k: - k -= b - else: - r += 1 - - return r \ No newline at end of file diff --git a/1604-least-number-of-unique-integers-after-k-removals/2024-02-16 13.16.39 - Accepted - runtime 534ms - memory 39.5MB.py b/1604-least-number-of-unique-integers-after-k-removals/2024-02-16 13.16.39 - Accepted - runtime 534ms - memory 39.5MB.py deleted file mode 100644 index b99bc9d..0000000 --- a/1604-least-number-of-unique-integers-after-k-removals/2024-02-16 13.16.39 - Accepted - runtime 534ms - memory 39.5MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def findLeastNumOfUniqueInts(self, arr: List[int], k: int) -> int: - c = Counter(arr) - s = sorted(arr, key = lambda x:(c[x], x)) - return len(set(s[k:])) \ No newline at end of file diff --git a/1610-xor-operation-in-an-array/2022-08-02 00.34.35 - Accepted - runtime 50ms - memory 13.8MB.py b/1610-xor-operation-in-an-array/2022-08-02 00.34.35 - Accepted - runtime 50ms - memory 13.8MB.py deleted file mode 100644 index bdba523..0000000 --- a/1610-xor-operation-in-an-array/2022-08-02 00.34.35 - Accepted - runtime 50ms - memory 13.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def xorOperation(self, n: int, start: int) -> int: - r = start - for i in range(1, n): - r ^= start + 2 * i - - return r \ No newline at end of file diff --git a/1626-can-make-arithmetic-progression-from-sequence/2024-05-05 20.05.40 - Accepted - runtime 39ms - memory 16.9MB.py b/1626-can-make-arithmetic-progression-from-sequence/2024-05-05 20.05.40 - Accepted - runtime 39ms - memory 16.9MB.py deleted file mode 100644 index e5bb066..0000000 --- a/1626-can-make-arithmetic-progression-from-sequence/2024-05-05 20.05.40 - Accepted - runtime 39ms - memory 16.9MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def canMakeArithmeticProgression(self, arr: List[int]) -> bool: - arr.sort() - t, prev = arr[0] - arr[1], arr[1] - for i in arr[2:]: - if prev - i != t: return False - prev = i - return True \ No newline at end of file diff --git a/1635-number-of-good-pairs/2022-08-01 16.30.28 - Accepted - runtime 65ms - memory 13.8MB.py b/1635-number-of-good-pairs/2022-08-01 16.30.28 - Accepted - runtime 65ms - memory 13.8MB.py deleted file mode 100644 index 72f0797..0000000 --- a/1635-number-of-good-pairs/2022-08-01 16.30.28 - Accepted - runtime 65ms - memory 13.8MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def numIdenticalPairs(self, nums: List[int]) -> int: - l = len(nums) - return sum(nums[i] == nums[j] for i in range(l) for j in range(i + 1, l)) \ No newline at end of file diff --git a/1646-kth-missing-positive-number/2023-03-06 21.02.21 - Accepted - runtime 47ms - memory 14.2MB.py b/1646-kth-missing-positive-number/2023-03-06 21.02.21 - Accepted - runtime 47ms - memory 14.2MB.py deleted file mode 100644 index 574584a..0000000 --- a/1646-kth-missing-positive-number/2023-03-06 21.02.21 - Accepted - runtime 47ms - memory 14.2MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def findKthPositive(self, arr: List[int], k: int) -> int: - l = set(arr) - res = 1 - while k: - if res not in l: - k -= 1 - res += 1 - - return res - 1 \ No newline at end of file diff --git a/165-compare-version-numbers/2024-05-03 09.37.53 - Accepted - runtime 38ms - memory 16.6MB.py b/165-compare-version-numbers/2024-05-03 09.37.53 - Accepted - runtime 38ms - memory 16.6MB.py deleted file mode 100644 index 7c4f75c..0000000 --- a/165-compare-version-numbers/2024-05-03 09.37.53 - Accepted - runtime 38ms - memory 16.6MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def compareVersion(self, version1: str, version2: str) -> int: - A, B = list(map(int, version1.split('.'))), list(map(int, t1 := version2.split('.'))) - for a, b in zip(A, B): - if a > b: - return 1 - elif b > a: - return -1 - - A, B = map(sum, (A, B)) - return 0 if A == B else 1 if A > B else -1 \ No newline at end of file diff --git a/1651-shuffle-string/2022-08-01 22.11.03 - Accepted - runtime 81ms - memory 13.9MB.py b/1651-shuffle-string/2022-08-01 22.11.03 - Accepted - runtime 81ms - memory 13.9MB.py deleted file mode 100644 index 9581d5a..0000000 --- a/1651-shuffle-string/2022-08-01 22.11.03 - Accepted - runtime 81ms - memory 13.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def restoreString(self, s: str, d: List[int]) -> str: - *a, = s - for i in range(len(s)): - a[d[i]] = s[i] - - return ''.join(a) \ No newline at end of file diff --git a/1666-make-the-string-great/2024-04-05 10.23.05 - Accepted - runtime 46ms - memory 16.6MB.py b/1666-make-the-string-great/2024-04-05 10.23.05 - Accepted - runtime 46ms - memory 16.6MB.py deleted file mode 100644 index a9b589f..0000000 --- a/1666-make-the-string-great/2024-04-05 10.23.05 - Accepted - runtime 46ms - memory 16.6MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def makeGood(self, s: str) -> str: - for i in range(len(s) - 1): - if s[i] != s[i + 1] and len(set((s[i] + s[i + 1]).lower())) == 1: - return self.makeGood(s[:i] + s[i + 2:]) - return s \ No newline at end of file diff --git a/1677-matrix-diagonal-sum/2023-05-08 11.29.50 - Accepted - runtime 115ms - memory 16.6MB.py b/1677-matrix-diagonal-sum/2023-05-08 11.29.50 - Accepted - runtime 115ms - memory 16.6MB.py deleted file mode 100644 index 8db7b0e..0000000 --- a/1677-matrix-diagonal-sum/2023-05-08 11.29.50 - Accepted - runtime 115ms - memory 16.6MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def diagonalSum(self, mat: List[List[int]]) -> int: - l = len(mat) - s = 0 - for i in range(l): - s += mat[i][i] + mat[i][~i] - if l % 2 and l // 2 == i: - s -= mat[i][i] - - return s \ No newline at end of file diff --git a/168-excel-sheet-column-title/2024-03-13 23.44.19 - Accepted - runtime 40ms - memory 16.7MB.py b/168-excel-sheet-column-title/2024-03-13 23.44.19 - Accepted - runtime 40ms - memory 16.7MB.py deleted file mode 100644 index 621b4d6..0000000 --- a/168-excel-sheet-column-title/2024-03-13 23.44.19 - Accepted - runtime 40ms - memory 16.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def convertToTitle(self, n: int) -> str: - r = "" - while n > 0: - r += chr(ord('A') + (n - 1) % 26) - n = (n - 1) // 26 - - return r[::-1] - \ No newline at end of file diff --git a/169-majority-element/2022-07-18 19.44.23 - Accepted - runtime 177ms - memory 15.5MB.py b/169-majority-element/2022-07-18 19.44.23 - Accepted - runtime 177ms - memory 15.5MB.py deleted file mode 100644 index ff3b266..0000000 --- a/169-majority-element/2022-07-18 19.44.23 - Accepted - runtime 177ms - memory 15.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def majorityElement(self, nums: List[int]) -> int: - return collections.Counter(nums).most_common(1)[0][0] \ No newline at end of file diff --git a/1693-sum-of-all-odd-length-subarrays/2022-09-20 14.43.46 - Accepted - runtime 129ms - memory 13.8MB.py b/1693-sum-of-all-odd-length-subarrays/2022-09-20 14.43.46 - Accepted - runtime 129ms - memory 13.8MB.py deleted file mode 100644 index c5041c9..0000000 --- a/1693-sum-of-all-odd-length-subarrays/2022-09-20 14.43.46 - Accepted - runtime 129ms - memory 13.8MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def sumOddLengthSubarrays(self, arr: List[int]) -> int: - i = 1 - res = 0 - l = len(arr) - while i <= l: - res += sum(sum(arr[f:i+f])for f in range(l - i + 1)) - i += 2 - return res \ No newline at end of file diff --git a/1693-sum-of-all-odd-length-subarrays/2022-09-20 14.46.02 - Accepted - runtime 72ms - memory 13.9MB.py b/1693-sum-of-all-odd-length-subarrays/2022-09-20 14.46.02 - Accepted - runtime 72ms - memory 13.9MB.py deleted file mode 100644 index 1756a80..0000000 --- a/1693-sum-of-all-odd-length-subarrays/2022-09-20 14.46.02 - Accepted - runtime 72ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def sumOddLengthSubarrays(self, arr: list[int]) -> int: - res = 0 - times = 0 - l = len(arr) - for i in range(l): - times = times-(i+1)//2+(l-i+1)//2 - res += times*arr[i] - return res \ No newline at end of file diff --git a/17-letter-combinations-of-a-phone-number/2022-12-31 20.31.16 - Accepted - runtime 36ms - memory 13.9MB.py b/17-letter-combinations-of-a-phone-number/2022-12-31 20.31.16 - Accepted - runtime 36ms - memory 13.9MB.py deleted file mode 100644 index 49441c0..0000000 --- a/17-letter-combinations-of-a-phone-number/2022-12-31 20.31.16 - Accepted - runtime 36ms - memory 13.9MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - d = {'2': 'abc', '3':'def', '4':'ghi', '5':'jkl', '6':'mno', '7':'pqrs', '8':'tuv', '9':'wxyz'} - def letterCombinations(self, digits: str) -> list[str]: - if not digits: - return [] - - res = [] - self.dfs(digits, "", res) - return res - - def dfs(self, digits: str, path: str, res: list[str]) -> None: - if not digits: - res.append(path) - return - - for i in self.d[digits[0]]: - self.dfs(digits[1:], path + i, res) \ No newline at end of file diff --git a/17-letter-combinations-of-a-phone-number/2022-12-31 22.41.38 - Accepted - runtime 29ms - memory 13.9MB.py b/17-letter-combinations-of-a-phone-number/2022-12-31 22.41.38 - Accepted - runtime 29ms - memory 13.9MB.py deleted file mode 100644 index e5846a1..0000000 --- a/17-letter-combinations-of-a-phone-number/2022-12-31 22.41.38 - Accepted - runtime 29ms - memory 13.9MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - d = {'2': 'abc', '3':'def', '4':'ghi', '5':'jkl', '6':'mno', '7':'pqrs', '8':'tuv', '9':'wxyz'} - def letterCombinations(self, digits: str) -> List[str]: - if not digits: - return [] - - res = [] - self.dfs(digits, '', res, 0, len(digits)) - return res - - def dfs(self, digits: str, combo: str, res: List[str], index: int, max_index: int) -> None: - if index == max_index: - return res.append(combo) - - for i in self.d[digits[index]]: - self.dfs(digits, combo + i, res, index + 1, max_index) \ No newline at end of file diff --git a/1708-design-parking-system/2022-08-01 16.33.48 - Accepted - runtime 232ms - memory 14.4MB.py b/1708-design-parking-system/2022-08-01 16.33.48 - Accepted - runtime 232ms - memory 14.4MB.py deleted file mode 100644 index 8495b6c..0000000 --- a/1708-design-parking-system/2022-08-01 16.33.48 - Accepted - runtime 232ms - memory 14.4MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class ParkingSystem: - - def __init__(self, big: int, medium: int, small: int): - self.space = {1: big, 2: medium, 3: small} - - def addCar(self, carType: int) -> bool: - if self.space[carType]: - self.space[carType] -= 1 - return True - - return False - - -# Your ParkingSystem object will be instantiated and called as such: -# obj = ParkingSystem(big, medium, small) -# param_1 = obj.addCar(carType) \ No newline at end of file diff --git a/171-excel-sheet-column-number/2024-03-31 19.39.05 - Accepted - runtime 36ms - memory 16.4MB.py b/171-excel-sheet-column-number/2024-03-31 19.39.05 - Accepted - runtime 36ms - memory 16.4MB.py deleted file mode 100644 index 8d94b30..0000000 --- a/171-excel-sheet-column-number/2024-03-31 19.39.05 - Accepted - runtime 36ms - memory 16.4MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def titleToNumber(self, t: str) -> int: - res = 0 - for i in t:res = res * 26 + (ord(i) - 65 + 1) - return res \ No newline at end of file diff --git a/1731-even-odd-tree/2024-02-29 13.33.14 - Accepted - runtime 262ms - memory 66.3MB.py b/1731-even-odd-tree/2024-02-29 13.33.14 - Accepted - runtime 262ms - memory 66.3MB.py deleted file mode 100644 index 63645c3..0000000 --- a/1731-even-odd-tree/2024-02-29 13.33.14 - Accepted - runtime 262ms - memory 66.3MB.py +++ /dev/null @@ -1,34 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def __init__(self): - self.levels = defaultdict(list) - - def traverse(self, node, d: int = 0): - self.levels[d].append(node.val) - if node.left: - self.traverse(node.left, d + 1) - if node.right: - self.traverse(node.right, d + 1) - - def isEvenOddTree(self, root: Optional[TreeNode]) -> bool: - self.traverse(root) - for a,b in self.levels.items(): - if a % 2: - f = b[0] - if f % 2: return False - for i in b[1:]: - if i % 2 or f <= i: return False - f = i - else: - f = b[0] - if f % 2 == 0: return False - for i in b[1:]: - if i % 2 == 0 or f >= i: return False - f = i - - return True \ No newline at end of file diff --git a/1731-even-odd-tree/2024-02-29 13.36.51 - Accepted - runtime 225ms - memory 39.3MB.py b/1731-even-odd-tree/2024-02-29 13.36.51 - Accepted - runtime 225ms - memory 39.3MB.py deleted file mode 100644 index 3d1fa2a..0000000 --- a/1731-even-odd-tree/2024-02-29 13.36.51 - Accepted - runtime 225ms - memory 39.3MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class Solution: - def isEvenOddTree(self, root: TreeNode) -> bool: - queue = deque([root]) - even = True - while queue: - prev = None - for _ in range(len(queue)): - node = queue.popleft() - if even: - if node.val % 2 == 0: return False - if prev and prev.val >= node.val: return False - else: - if node.val % 2: return False - if prev and prev.val <= node.val: return False - queue += filter(None, (node.left, node.right)) - prev = node - even = not even - return True \ No newline at end of file diff --git a/1737-maximum-nesting-depth-of-the-parentheses/2024-04-04 09.19.17 - Accepted - runtime 33ms - memory 16.5MB.py b/1737-maximum-nesting-depth-of-the-parentheses/2024-04-04 09.19.17 - Accepted - runtime 33ms - memory 16.5MB.py deleted file mode 100644 index 21958c1..0000000 --- a/1737-maximum-nesting-depth-of-the-parentheses/2024-04-04 09.19.17 - Accepted - runtime 33ms - memory 16.5MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def maxDepth(self, s: str) -> int: - curr = res = 0 - for i in s: - if i == '(': - curr += 1 - elif i == ')': - res = max(res, curr) - curr -= 1 - return res \ No newline at end of file diff --git a/175-combine-two-tables/2023-05-13 10.04.02 - Accepted - runtime 845ms - memory 0B.sql b/175-combine-two-tables/2023-05-13 10.04.02 - Accepted - runtime 845ms - memory 0B.sql deleted file mode 100644 index c008737..0000000 --- a/175-combine-two-tables/2023-05-13 10.04.02 - Accepted - runtime 845ms - memory 0B.sql +++ /dev/null @@ -1,6 +0,0 @@ -# Write your MySQL query statement below - - -SELECT A.firstName, A.lastName, S.city, S.state FROM PERSON A -LEFT JOIN ADDRESS S ON -A.personId = S.personId \ No newline at end of file diff --git a/1751-slowest-key/2024-04-21 18.01.05 - Accepted - runtime 60ms - memory 16.8MB.py b/1751-slowest-key/2024-04-21 18.01.05 - Accepted - runtime 60ms - memory 16.8MB.py deleted file mode 100644 index 4b86003..0000000 --- a/1751-slowest-key/2024-04-21 18.01.05 - Accepted - runtime 60ms - memory 16.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def slowestKey(self, rls: List[int], k: str) -> str: - res = (rls[0], k[0]) - for i in range(1, len(rls)): - res = max(res, (rls[i] - rls[i - 1], k[i])) - - return res[1] \ No newline at end of file diff --git a/1762-furthest-building-you-can-reach/2022-06-23 16.23.20 - Accepted - runtime 745ms - memory 28.6MB.py b/1762-furthest-building-you-can-reach/2022-06-23 16.23.20 - Accepted - runtime 745ms - memory 28.6MB.py deleted file mode 100644 index f0c4843..0000000 --- a/1762-furthest-building-you-can-reach/2022-06-23 16.23.20 - Accepted - runtime 745ms - memory 28.6MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: - n, climbed = len(heights), [] - - for i in range(n - 1): - if (climb := heights[i + 1] - heights[i]) <= 0: - continue - - heapq.heappush(climbed, climb) - - if len(climbed) > ladders: - bricks -= heapq.heappop(climbed) - - if bricks < 0: - return i - - return n - 1 \ No newline at end of file diff --git a/1762-furthest-building-you-can-reach/2024-02-17 15.57.37 - Accepted - runtime 78ms - memory 57.2MB.cpp b/1762-furthest-building-you-can-reach/2024-02-17 15.57.37 - Accepted - runtime 78ms - memory 57.2MB.cpp deleted file mode 100644 index 3e1e3b6..0000000 --- a/1762-furthest-building-you-can-reach/2024-02-17 15.57.37 - Accepted - runtime 78ms - memory 57.2MB.cpp +++ /dev/null @@ -1,17 +0,0 @@ -class Solution { -public: - int furthestBuilding(vector& heights, int bricks, int ladders) { - priority_queue pq; - int d, i; - for(i=0; i < heights.size() - 1; i++){ - d = heights[i] - heights[i + 1]; - if (d < 0) pq.push(d); - if (pq.size() > ladders){ - bricks += pq.top(); - pq.pop(); - } - if (bricks < 0) return i; - } - return heights.size() - 1; - } -}; \ No newline at end of file diff --git a/1765-merge-in-between-linked-lists/2024-03-21 00.55.26 - Accepted - runtime 188ms - memory 21.2MB.py b/1765-merge-in-between-linked-lists/2024-03-21 00.55.26 - Accepted - runtime 188ms - memory 21.2MB.py deleted file mode 100644 index ab793b4..0000000 --- a/1765-merge-in-between-linked-lists/2024-03-21 00.55.26 - Accepted - runtime 188ms - memory 21.2MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: - start, end = None, list1 - for i in range(b): - if i == a - 1: - start = end - end = end.next - start.next = list2 - while list2.next: - list2 = list2.next - list2.next = end.next - end.next = None - return list1 \ No newline at end of file diff --git a/1777-determine-if-two-strings-are-close/2024-01-14 22.58.46 - Accepted - runtime 125ms - memory 18.5MB.py b/1777-determine-if-two-strings-are-close/2024-01-14 22.58.46 - Accepted - runtime 125ms - memory 18.5MB.py deleted file mode 100644 index c0f4a20..0000000 --- a/1777-determine-if-two-strings-are-close/2024-01-14 22.58.46 - Accepted - runtime 125ms - memory 18.5MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def closeStrings(self, a: str, b: str) -> bool: - A, B = map(lambda x: sorted(Counter(x).values()), (a, b)) - return A == B and set(a) == set(b) \ No newline at end of file diff --git a/1777-determine-if-two-strings-are-close/2024-01-14 22.59.33 - Accepted - runtime 130ms - memory 18.1MB.py b/1777-determine-if-two-strings-are-close/2024-01-14 22.59.33 - Accepted - runtime 130ms - memory 18.1MB.py deleted file mode 100644 index 7b4e2ad..0000000 --- a/1777-determine-if-two-strings-are-close/2024-01-14 22.59.33 - Accepted - runtime 130ms - memory 18.1MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def closeStrings(self, a: str, b: str) -> bool: - A, B = map(Counter, (a, b)) - return sorted(A.values()) == sorted(B.values()) and A.keys() == B.keys() \ No newline at end of file diff --git a/1781-check-if-two-string-arrays-are-equivalent/2022-09-20 14.26.50 - Accepted - runtime 68ms - memory 13.8MB.py b/1781-check-if-two-string-arrays-are-equivalent/2022-09-20 14.26.50 - Accepted - runtime 68ms - memory 13.8MB.py deleted file mode 100644 index 113e32d..0000000 --- a/1781-check-if-two-string-arrays-are-equivalent/2022-09-20 14.26.50 - Accepted - runtime 68ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def arrayStringsAreEqual(self, word1: list[str], word2: list[str]) -> bool: - return ''.join(word1) == ''.join(word2) \ No newline at end of file diff --git a/1786-count-the-number-of-consistent-strings/2022-09-20 14.25.13 - Accepted - runtime 586ms - memory 16.1MB.py b/1786-count-the-number-of-consistent-strings/2022-09-20 14.25.13 - Accepted - runtime 586ms - memory 16.1MB.py deleted file mode 100644 index fe28b40..0000000 --- a/1786-count-the-number-of-consistent-strings/2022-09-20 14.25.13 - Accepted - runtime 586ms - memory 16.1MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def countConsistentStrings(self, allowed: str, words: List[str]) -> int: - return sum(all(f in allowed for f in word) for word in words) \ No newline at end of file diff --git a/1791-richest-customer-wealth/2022-08-01 16.11.46 - Accepted - runtime 101ms - memory 13.9MB.py b/1791-richest-customer-wealth/2022-08-01 16.11.46 - Accepted - runtime 101ms - memory 13.9MB.py deleted file mode 100644 index 6951cf8..0000000 --- a/1791-richest-customer-wealth/2022-08-01 16.11.46 - Accepted - runtime 101ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def maximumWealth(self, accounts: List[List[int]]) -> int: - return max(sum(f)for f in accounts) \ No newline at end of file diff --git a/1797-goal-parser-interpretation/2022-08-01 17.33.04 - Accepted - runtime 69ms - memory 13.9MB.py b/1797-goal-parser-interpretation/2022-08-01 17.33.04 - Accepted - runtime 69ms - memory 13.9MB.py deleted file mode 100644 index 0fa8215..0000000 --- a/1797-goal-parser-interpretation/2022-08-01 17.33.04 - Accepted - runtime 69ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def interpret(self, command: str) -> str: - return command.replace('()','o').replace('(','').replace(')','') \ No newline at end of file diff --git a/1802-number-of-students-unable-to-eat-lunch/2024-04-08 11.32.01 - Accepted - runtime 50ms - memory 16.5MB.py b/1802-number-of-students-unable-to-eat-lunch/2024-04-08 11.32.01 - Accepted - runtime 50ms - memory 16.5MB.py deleted file mode 100644 index 3eeee5e..0000000 --- a/1802-number-of-students-unable-to-eat-lunch/2024-04-08 11.32.01 - Accepted - runtime 50ms - memory 16.5MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class Solution: - def countStudents(self, s: List[int], sa: List[int]) -> int: - a = deque(s) - sa = deque(sa) - s = True - while s: - s = False - for i in range(len(a)): - st = a.popleft() - if sa[0] == st: - sa.popleft() - s = True - else: - a.append(st) - - - return len(a) - \ No newline at end of file diff --git a/1802-number-of-students-unable-to-eat-lunch/2024-04-08 11.33.08 - Accepted - runtime 31ms - memory 16.7MB.py b/1802-number-of-students-unable-to-eat-lunch/2024-04-08 11.33.08 - Accepted - runtime 31ms - memory 16.7MB.py deleted file mode 100644 index 5c43165..0000000 --- a/1802-number-of-students-unable-to-eat-lunch/2024-04-08 11.33.08 - Accepted - runtime 31ms - memory 16.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def countStudents(self, s: List[int], sa: List[int]) -> int: - c = Counter(s) - n, k = len(s), 0 - while k < n and c[sa[k]]: - c[sa[k]] -= 1 - k += 1 - return n - k - \ No newline at end of file diff --git a/1817-calculate-money-in-leetcode-bank/2024-04-06 19.30.29 - Accepted - runtime 32ms - memory 16.6MB.py b/1817-calculate-money-in-leetcode-bank/2024-04-06 19.30.29 - Accepted - runtime 32ms - memory 16.6MB.py deleted file mode 100644 index 19eba2b..0000000 --- a/1817-calculate-money-in-leetcode-bank/2024-04-06 19.30.29 - Accepted - runtime 32ms - memory 16.6MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def totalMoney(self, n: int) -> int: - w = n // 7 - money = w * 28 - money += (7 * w *( w - 1))//2 - - if (n % 7): - extra_days = n % 7 - money_to_add = w + 1 - for i in range(extra_days): - money += money_to_add - money_to_add += 1 - - return money \ No newline at end of file diff --git a/1823-determine-if-string-halves-are-alike/2022-09-26 14.23.33 - Accepted - runtime 57ms - memory 13.8MB.py b/1823-determine-if-string-halves-are-alike/2022-09-26 14.23.33 - Accepted - runtime 57ms - memory 13.8MB.py deleted file mode 100644 index 5276453..0000000 --- a/1823-determine-if-string-halves-are-alike/2022-09-26 14.23.33 - Accepted - runtime 57ms - memory 13.8MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def halvesAreAlike(self, s: str) -> bool: - l = len(s := s.upper()) // 2 - return sum((a in 'AEIOU') - (b in 'AEIOU')for a,b in zip(s[:l], s[l:])) == 0 \ No newline at end of file diff --git a/1823-determine-if-string-halves-are-alike/2024-01-12 16.42.16 - Accepted - runtime 34ms - memory 17.2MB.py b/1823-determine-if-string-halves-are-alike/2024-01-12 16.42.16 - Accepted - runtime 34ms - memory 17.2MB.py deleted file mode 100644 index f35e5a1..0000000 --- a/1823-determine-if-string-halves-are-alike/2024-01-12 16.42.16 - Accepted - runtime 34ms - memory 17.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def halvesAreAlike(self, s: str) -> bool: - s = s.lower() - k = len(s) // 2 - A = B = 0 - for a,b in zip(s[:k], s[k:]): - A += a in 'aeiou' - B += b in 'aeiou' - return A == B \ No newline at end of file diff --git a/1823-determine-if-string-halves-are-alike/2024-01-12 16.43.47 - Accepted - runtime 38ms - memory 17.2MB.py b/1823-determine-if-string-halves-are-alike/2024-01-12 16.43.47 - Accepted - runtime 38ms - memory 17.2MB.py deleted file mode 100644 index 5276453..0000000 --- a/1823-determine-if-string-halves-are-alike/2024-01-12 16.43.47 - Accepted - runtime 38ms - memory 17.2MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def halvesAreAlike(self, s: str) -> bool: - l = len(s := s.upper()) // 2 - return sum((a in 'AEIOU') - (b in 'AEIOU')for a,b in zip(s[:l], s[l:])) == 0 \ No newline at end of file diff --git a/1833-find-the-highest-altitude/2022-09-20 19.53.45 - Accepted - runtime 63ms - memory 13.9MB.py b/1833-find-the-highest-altitude/2022-09-20 19.53.45 - Accepted - runtime 63ms - memory 13.9MB.py deleted file mode 100644 index 4915bbe..0000000 --- a/1833-find-the-highest-altitude/2022-09-20 19.53.45 - Accepted - runtime 63ms - memory 13.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def largestAltitude(self, gain: list[int]) -> int: - a = r = 0 - for i in gain: - a += i - r = max(a, r) - return r \ No newline at end of file diff --git a/1833-find-the-highest-altitude/2022-09-20 19.55.56 - Accepted - runtime 68ms - memory 13.8MB.py b/1833-find-the-highest-altitude/2022-09-20 19.55.56 - Accepted - runtime 68ms - memory 13.8MB.py deleted file mode 100644 index 5a11aac..0000000 --- a/1833-find-the-highest-altitude/2022-09-20 19.55.56 - Accepted - runtime 68ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def largestAltitude(self, gain: list[int]) -> int: - return max(accumulate(gain, initial=0)) \ No newline at end of file diff --git a/1839-decode-xored-array/2022-08-01 21.10.08 - Accepted - runtime 322ms - memory 15.8MB.py b/1839-decode-xored-array/2022-08-01 21.10.08 - Accepted - runtime 322ms - memory 15.8MB.py deleted file mode 100644 index bd09555..0000000 --- a/1839-decode-xored-array/2022-08-01 21.10.08 - Accepted - runtime 322ms - memory 15.8MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def decode(self, encoded: List[int], first: int) -> List[int]: - res = [first] - for i in encoded:res.append(i ^ res[-1]) - return res \ No newline at end of file diff --git a/1848-sum-of-unique-elements/2022-09-26 17.13.11 - Accepted - runtime 81ms - memory 13.9MB.py b/1848-sum-of-unique-elements/2022-09-26 17.13.11 - Accepted - runtime 81ms - memory 13.9MB.py deleted file mode 100644 index d0402f2..0000000 --- a/1848-sum-of-unique-elements/2022-09-26 17.13.11 - Accepted - runtime 81ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sumOfUnique(self, nums: List[int]) -> int: - return sum(f for f in nums if nums.count(f) == 1) \ No newline at end of file diff --git a/1848-sum-of-unique-elements/2022-09-26 17.15.28 - Accepted - runtime 65ms - memory 13.8MB.py b/1848-sum-of-unique-elements/2022-09-26 17.15.28 - Accepted - runtime 65ms - memory 13.8MB.py deleted file mode 100644 index d3f83d5..0000000 --- a/1848-sum-of-unique-elements/2022-09-26 17.15.28 - Accepted - runtime 65ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sumOfUnique(self, nums: List[int]) -> int: - return sum(v for v,c in collections.Counter(nums).items()if c == 1) \ No newline at end of file diff --git a/1850-minimum-length-of-string-after-deleting-similar-ends/2024-03-05 15.31.22 - Accepted - runtime 104ms - memory 17.3MB.py b/1850-minimum-length-of-string-after-deleting-similar-ends/2024-03-05 15.31.22 - Accepted - runtime 104ms - memory 17.3MB.py deleted file mode 100644 index 765c4c3..0000000 --- a/1850-minimum-length-of-string-after-deleting-similar-ends/2024-03-05 15.31.22 - Accepted - runtime 104ms - memory 17.3MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def minimumLength(self, s: str) -> int: - while len(s) > 1 and s[0] == s[-1]: - s = s.strip(s[0]) - return len(s) \ No newline at end of file diff --git a/1850-minimum-length-of-string-after-deleting-similar-ends/2024-03-05 15.33.09 - Accepted - runtime 58ms - memory 17.4MB.py b/1850-minimum-length-of-string-after-deleting-similar-ends/2024-03-05 15.33.09 - Accepted - runtime 58ms - memory 17.4MB.py deleted file mode 100644 index 8d84ba8..0000000 --- a/1850-minimum-length-of-string-after-deleting-similar-ends/2024-03-05 15.33.09 - Accepted - runtime 58ms - memory 17.4MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def minimumLength(self, s: str) -> int: - l, r = 0, len(s) - 1 - while l < r and s[l] == s[r]: - char = s[l] - l += 1 - r -= 1 - while l <= r and s[l] == char: - l += 1 - while l <= r and s[r] == char: - r -= 1 - - return r - l + 1 \ No newline at end of file diff --git a/1894-merge-strings-alternately/2023-04-21 17.18.50 - Accepted - runtime 35ms - memory 13.9MB.py b/1894-merge-strings-alternately/2023-04-21 17.18.50 - Accepted - runtime 35ms - memory 13.9MB.py deleted file mode 100644 index 6f30696..0000000 --- a/1894-merge-strings-alternately/2023-04-21 17.18.50 - Accepted - runtime 35ms - memory 13.9MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def mergeAlternately(self, a: str, b: str) -> str: - a, b = list(a)[::-1], list(b)[::-1] - res = '' - while a or b: - if a: - res += a.pop() - if b: - res += b.pop() - - return res \ No newline at end of file diff --git a/1899-count-items-matching-a-rule/2022-08-02 00.29.15 - Accepted - runtime 363ms - memory 20.2MB.py b/1899-count-items-matching-a-rule/2022-08-02 00.29.15 - Accepted - runtime 363ms - memory 20.2MB.py deleted file mode 100644 index 4442dcd..0000000 --- a/1899-count-items-matching-a-rule/2022-08-02 00.29.15 - Accepted - runtime 363ms - memory 20.2MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def countMatches(self, items: List[List[str]], ruleKey: str, ruleValue: str) -> int: - return sum(i['tcn'.index(ruleKey[0])] == ruleValue for i in items) \ No newline at end of file diff --git a/19-remove-nth-node-from-end-of-list/2022-04-23 09.22.14 - Accepted - runtime 60ms - memory 13.9MB.py b/19-remove-nth-node-from-end-of-list/2022-04-23 09.22.14 - Accepted - runtime 60ms - memory 13.9MB.py deleted file mode 100644 index 78c0f22..0000000 --- a/19-remove-nth-node-from-end-of-list/2022-04-23 09.22.14 - Accepted - runtime 60ms - memory 13.9MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: - nodes = [head] - - while head.next: - nodes.append(head.next) - head = head.next - - res = nodes.pop(-n) - if nodes:nodes[-1].next = None - if len(nodes) - 1: - for i in range(len(nodes) - 1):nodes[i].next = nodes[i + 1] - else: - pass - - return nodes[0] if nodes else res.next \ No newline at end of file diff --git a/19-remove-nth-node-from-end-of-list/2022-04-23 09.28.17 - Accepted - runtime 61ms - memory 13.9MB.py b/19-remove-nth-node-from-end-of-list/2022-04-23 09.28.17 - Accepted - runtime 61ms - memory 13.9MB.py deleted file mode 100644 index f5098fb..0000000 --- a/19-remove-nth-node-from-end-of-list/2022-04-23 09.28.17 - Accepted - runtime 61ms - memory 13.9MB.py +++ /dev/null @@ -1,23 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: - res = head - first = head - second = head - for i in range(n): - if(second.next == None): - if(i == n - 1): - head = head.next - return head - second = second.next - - while(second.next != None): - second = second.next - first = first.next - - first.next = first.next.next - return res \ No newline at end of file diff --git a/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.22 - Accepted - runtime 32ms - memory 13.9MB.py b/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.22 - Accepted - runtime 32ms - memory 13.9MB.py deleted file mode 100644 index 733ad36..0000000 --- a/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.22 - Accepted - runtime 32ms - memory 13.9MB.py +++ /dev/null @@ -1,33 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: - k = 0 - - itr = head - - while itr: - itr = itr.next - k+=1 - - pos = k-n - j=0 - itr = head - prev = head - - if pos == 0: - head = head.next - return head - - while itr: - if j == pos-1: - prev = itr - itr = itr.next - j+=1 - - prev.next = prev.next.next - - return head \ No newline at end of file diff --git a/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.47 - Accepted - runtime 36ms - memory 13.8MB.py b/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.47 - Accepted - runtime 36ms - memory 13.8MB.py deleted file mode 100644 index 16f3272..0000000 --- a/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.47 - Accepted - runtime 36ms - memory 13.8MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: - dummy = ListNode(None, head) # Create a dummy node with next value set to the head pointer - left = dummy - right = head - - for _ in range(n): # Initiate right pointer to the nth index of the list - right = right.next - - while right != None: # Update each pointer to the next node until right reaches the end - right = right.next - left = left.next - - left.next = left.next.next # Remove nth node from the right - - return dummy.next \ No newline at end of file diff --git a/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.54 - Accepted - runtime 47ms - memory 13.8MB.py b/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.54 - Accepted - runtime 47ms - memory 13.8MB.py deleted file mode 100644 index 16f3272..0000000 --- a/19-remove-nth-node-from-end-of-list/2022-04-23 09.29.54 - Accepted - runtime 47ms - memory 13.8MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: - dummy = ListNode(None, head) # Create a dummy node with next value set to the head pointer - left = dummy - right = head - - for _ in range(n): # Initiate right pointer to the nth index of the list - right = right.next - - while right != None: # Update each pointer to the next node until right reaches the end - right = right.next - left = left.next - - left.next = left.next.next # Remove nth node from the right - - return dummy.next \ No newline at end of file diff --git a/19-remove-nth-node-from-end-of-list/2022-04-23 09.30.00 - Accepted - runtime 74ms - memory 13.9MB.py b/19-remove-nth-node-from-end-of-list/2022-04-23 09.30.00 - Accepted - runtime 74ms - memory 13.9MB.py deleted file mode 100644 index 16f3272..0000000 --- a/19-remove-nth-node-from-end-of-list/2022-04-23 09.30.00 - Accepted - runtime 74ms - memory 13.9MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: - dummy = ListNode(None, head) # Create a dummy node with next value set to the head pointer - left = dummy - right = head - - for _ in range(n): # Initiate right pointer to the nth index of the list - right = right.next - - while right != None: # Update each pointer to the next node until right reaches the end - right = right.next - left = left.next - - left.next = left.next.next # Remove nth node from the right - - return dummy.next \ No newline at end of file diff --git a/19-remove-nth-node-from-end-of-list/2022-04-23 09.30.09 - Accepted - runtime 29ms - memory 13.9MB.py b/19-remove-nth-node-from-end-of-list/2022-04-23 09.30.09 - Accepted - runtime 29ms - memory 13.9MB.py deleted file mode 100644 index 733ad36..0000000 --- a/19-remove-nth-node-from-end-of-list/2022-04-23 09.30.09 - Accepted - runtime 29ms - memory 13.9MB.py +++ /dev/null @@ -1,33 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: - k = 0 - - itr = head - - while itr: - itr = itr.next - k+=1 - - pos = k-n - j=0 - itr = head - prev = head - - if pos == 0: - head = head.next - return head - - while itr: - if j == pos-1: - prev = itr - itr = itr.next - j+=1 - - prev.next = prev.next.next - - return head \ No newline at end of file diff --git a/190-reverse-bits/2022-06-29 10.30.40 - Accepted - runtime 71ms - memory 13.8MB.py b/190-reverse-bits/2022-06-29 10.30.40 - Accepted - runtime 71ms - memory 13.8MB.py deleted file mode 100644 index 56f530e..0000000 --- a/190-reverse-bits/2022-06-29 10.30.40 - Accepted - runtime 71ms - memory 13.8MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def reverseBits(self, num: int) -> int: - num = ((num & 0x55555555) << 1) | ((num & 0xAAAAAAAA) >> 1) - num = ((num & 0x33333333) << 2) | ((num & 0xCCCCCCCC) >> 2) - num = ((num & 0x0F0F0F0F) << 4) | ((num & 0xF0F0F0F0) >> 4) - num = ((num & 0x00FF00FF) << 8) | ((num & 0xFF00FF00) >> 8) - num = ((num & 0x0000FFFF) << 16) | ((num & 0xFFFF0000) >> 16) - - return num \ No newline at end of file diff --git a/190-reverse-bits/2022-06-29 10.31.10 - Accepted - runtime 8ms - memory 6MB.cpp b/190-reverse-bits/2022-06-29 10.31.10 - Accepted - runtime 8ms - memory 6MB.cpp deleted file mode 100644 index 8370572..0000000 --- a/190-reverse-bits/2022-06-29 10.31.10 - Accepted - runtime 8ms - memory 6MB.cpp +++ /dev/null @@ -1,12 +0,0 @@ -class Solution { -public: - uint32_t reverseBits(uint32_t num) { - num = ((num & 0x55555555) << 1) | ((num & 0xAAAAAAAA) >> 1); - num = ((num & 0x33333333) << 2) | ((num & 0xCCCCCCCC) >> 2); - num = ((num & 0x0F0F0F0F) << 4) | ((num & 0xF0F0F0F0) >> 4); - num = ((num & 0x00FF00FF) << 8) | ((num & 0xFF00FF00) >> 8); - num = ((num & 0x0000FFFF) << 16) | ((num & 0xFFFF0000) >> 16); - - return num; - } -}; \ No newline at end of file diff --git a/190-reverse-bits/2022-06-29 10.31.49 - Accepted - runtime 7ms - memory 5.3MB.c b/190-reverse-bits/2022-06-29 10.31.49 - Accepted - runtime 7ms - memory 5.3MB.c deleted file mode 100644 index b393d0a..0000000 --- a/190-reverse-bits/2022-06-29 10.31.49 - Accepted - runtime 7ms - memory 5.3MB.c +++ /dev/null @@ -1,9 +0,0 @@ -uint32_t reverseBits(uint32_t num) { - num = ((num & 0x55555555) << 1) | ((num & 0xAAAAAAAA) >> 1); - num = ((num & 0x33333333) << 2) | ((num & 0xCCCCCCCC) >> 2); - num = ((num & 0x0F0F0F0F) << 4) | ((num & 0xF0F0F0F0) >> 4); - num = ((num & 0x00FF00FF) << 8) | ((num & 0xFF00FF00) >> 8); - num = ((num & 0x0000FFFF) << 16) | ((num & 0xFFFF0000) >> 16); - - return num; -} \ No newline at end of file diff --git a/190-reverse-bits/2022-08-20 17.15.16 - Accepted - runtime 10ms - memory 5.9MB.cpp b/190-reverse-bits/2022-08-20 17.15.16 - Accepted - runtime 10ms - memory 5.9MB.cpp deleted file mode 100644 index 8370572..0000000 --- a/190-reverse-bits/2022-08-20 17.15.16 - Accepted - runtime 10ms - memory 5.9MB.cpp +++ /dev/null @@ -1,12 +0,0 @@ -class Solution { -public: - uint32_t reverseBits(uint32_t num) { - num = ((num & 0x55555555) << 1) | ((num & 0xAAAAAAAA) >> 1); - num = ((num & 0x33333333) << 2) | ((num & 0xCCCCCCCC) >> 2); - num = ((num & 0x0F0F0F0F) << 4) | ((num & 0xF0F0F0F0) >> 4); - num = ((num & 0x00FF00FF) << 8) | ((num & 0xFF00FF00) >> 8); - num = ((num & 0x0000FFFF) << 16) | ((num & 0xFFFF0000) >> 16); - - return num; - } -}; \ No newline at end of file diff --git a/191-number-of-1-bits/2022-06-29 13.14.48 - Accepted - runtime 31ms - memory 13.8MB.py b/191-number-of-1-bits/2022-06-29 13.14.48 - Accepted - runtime 31ms - memory 13.8MB.py deleted file mode 100644 index 0f09adc..0000000 --- a/191-number-of-1-bits/2022-06-29 13.14.48 - Accepted - runtime 31ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def hammingWeight(self, n: int) -> int: - return f'{n:b}'.count('1') \ No newline at end of file diff --git a/1927-maximum-ascending-subarray-sum/2023-01-21 23.55.15 - Accepted - runtime 77ms - memory 13.8MB.py b/1927-maximum-ascending-subarray-sum/2023-01-21 23.55.15 - Accepted - runtime 77ms - memory 13.8MB.py deleted file mode 100644 index fc1ef4c..0000000 --- a/1927-maximum-ascending-subarray-sum/2023-01-21 23.55.15 - Accepted - runtime 77ms - memory 13.8MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def maxAscendingSum(self, nums: List[int]) -> int: - res = -2E6 - prev = prev_sum = nums[0] - for i in nums[1:]: - if prev < i: - prev_sum += i - else: - res = max(res, prev_sum) - prev_sum = i - - prev = i - - return max(res, prev_sum) - \ No newline at end of file diff --git a/1944-truncate-sentence/2022-09-20 14.24.51 - Accepted - runtime 45ms - memory 13.8MB.py b/1944-truncate-sentence/2022-09-20 14.24.51 - Accepted - runtime 45ms - memory 13.8MB.py deleted file mode 100644 index 5a5915e..0000000 --- a/1944-truncate-sentence/2022-09-20 14.24.51 - Accepted - runtime 45ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def truncateSentence(self, s: str, k: int) -> str: - return ' '.join(s.split()[:k]) \ No newline at end of file diff --git a/1950-sign-of-the-product-of-an-array/2023-05-02 15.06.30 - Accepted - runtime 74ms - memory 16.4MB.py b/1950-sign-of-the-product-of-an-array/2023-05-02 15.06.30 - Accepted - runtime 74ms - memory 16.4MB.py deleted file mode 100644 index 0888283..0000000 --- a/1950-sign-of-the-product-of-an-array/2023-05-02 15.06.30 - Accepted - runtime 74ms - memory 16.4MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def arraySign(self, nums: List[int]) -> int: - s = 1 - for i in nums: - if i == 0: - return 0 - i = 1 if i > 0 else -1 - s *= i - return s \ No newline at end of file diff --git a/1961-maximum-ice-cream-bars/2023-01-06 18.14.06 - Accepted - runtime 1148ms - memory 27.9MB.py b/1961-maximum-ice-cream-bars/2023-01-06 18.14.06 - Accepted - runtime 1148ms - memory 27.9MB.py deleted file mode 100644 index ba96dc5..0000000 --- a/1961-maximum-ice-cream-bars/2023-01-06 18.14.06 - Accepted - runtime 1148ms - memory 27.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def maxIceCream(self, costs: List[int], coins: int) -> int: - res = 0 - for i in sorted(costs): - if i > coins: - return res - res += 1 - coins -= i - return res \ No newline at end of file diff --git a/1961-maximum-ice-cream-bars/2023-01-06 18.16.40 - Accepted - runtime 2817ms - memory 27.9MB.py b/1961-maximum-ice-cream-bars/2023-01-06 18.16.40 - Accepted - runtime 2817ms - memory 27.9MB.py deleted file mode 100644 index bd340d5..0000000 --- a/1961-maximum-ice-cream-bars/2023-01-06 18.16.40 - Accepted - runtime 2817ms - memory 27.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def maxIceCream(self, costs: List[int], coins: int) -> int: - return sum((coins := coins - f) >= 0 for f in sorted(costs)) \ No newline at end of file diff --git a/1962-single-threaded-cpu/2022-12-29 23.23.08 - Accepted - runtime 1862ms - memory 63.5MB.py b/1962-single-threaded-cpu/2022-12-29 23.23.08 - Accepted - runtime 1862ms - memory 63.5MB.py deleted file mode 100644 index 311dd35..0000000 --- a/1962-single-threaded-cpu/2022-12-29 23.23.08 - Accepted - runtime 1862ms - memory 63.5MB.py +++ /dev/null @@ -1,22 +0,0 @@ -class Solution: - def getOrder(self, tasks: List[List[int]]) -> List[int]: - l = [(a, b, ind) for ind, (a, b) in enumerate(tasks)] - l.sort() - res = [] - next_tasks = [] - n = len(tasks) - curr_time = curr_ind = 0 - while n > curr_ind or next_tasks: - if not next_tasks and curr_time < l[curr_ind][0]: - curr_time = l[curr_ind][0] - while n > curr_ind and curr_time >= l[curr_ind][0]: - _, b, original_index = l[curr_ind] - heapq.heappush(next_tasks, (b, original_index)) - curr_ind += 1 - - b, index = heapq.heappop(next_tasks) - curr_time += b - res.append(index) - - - return res \ No newline at end of file diff --git a/1962-single-threaded-cpu/2022-12-30 11.00.36 - Accepted - runtime 2007ms - memory 63.5MB.py b/1962-single-threaded-cpu/2022-12-30 11.00.36 - Accepted - runtime 2007ms - memory 63.5MB.py deleted file mode 100644 index 665b089..0000000 --- a/1962-single-threaded-cpu/2022-12-30 11.00.36 - Accepted - runtime 2007ms - memory 63.5MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def getOrder(self, tasks: List[List[int]]) -> List[int]: - l = sorted((a, b, ind) for ind, (a, b) in enumerate(tasks)) - res = [] - next_tasks = [] - curr_time = curr_ind = 0 - n = len(tasks) - while n > curr_ind or next_tasks: - if not next_tasks and curr_time < l[curr_ind][0]: - curr_time = l[curr_ind][0] - - while n > curr_ind and curr_time >= l[curr_ind][0]: - _, b, original_index = l[curr_ind] - heapq.heappush(next_tasks, (b, original_index)) - curr_ind += 1 - - b, ind = heapq.heappop(next_tasks) - curr_time += b - res.append(ind) - - return res \ No newline at end of file diff --git a/1962-single-threaded-cpu/2022-12-30 11.01.51 - Accepted - runtime 1998ms - memory 63.6MB.py b/1962-single-threaded-cpu/2022-12-30 11.01.51 - Accepted - runtime 1998ms - memory 63.6MB.py deleted file mode 100644 index 69b4188..0000000 --- a/1962-single-threaded-cpu/2022-12-30 11.01.51 - Accepted - runtime 1998ms - memory 63.6MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def getOrder(self, tasks: List[List[int]]) -> List[int]: - tasks = sorted((a, b, ind) for ind, (a, b) in enumerate(tasks)) - res = [] - next_tasks = [] - curr_time = curr_ind = 0 - n = len(tasks) - while n > curr_ind or next_tasks: - if not next_tasks and curr_time < tasks[curr_ind][0]: - curr_time = tasks[curr_ind][0] - - while n > curr_ind and curr_time >= tasks[curr_ind][0]: - _, b, original_index = tasks[curr_ind] - heapq.heappush(next_tasks, (b, original_index)) - curr_ind += 1 - - b, ind = heapq.heappop(next_tasks) - curr_time += b - res.append(ind) - - return res \ No newline at end of file diff --git a/1965-sum-of-digits-in-base-k/2022-09-26 14.48.50 - Accepted - runtime 56ms - memory 13.9MB.py b/1965-sum-of-digits-in-base-k/2022-09-26 14.48.50 - Accepted - runtime 56ms - memory 13.9MB.py deleted file mode 100644 index fcc16d6..0000000 --- a/1965-sum-of-digits-in-base-k/2022-09-26 14.48.50 - Accepted - runtime 56ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sumBase(self, n: int, k: int) -> int: - return self.sumBase(n // k, k) + n % k if n else 0 \ No newline at end of file diff --git a/1970-sorting-the-sentence/2022-08-02 00.31.50 - Accepted - runtime 33ms - memory 13.8MB.py b/1970-sorting-the-sentence/2022-08-02 00.31.50 - Accepted - runtime 33ms - memory 13.8MB.py deleted file mode 100644 index e6c8d7d..0000000 --- a/1970-sorting-the-sentence/2022-08-02 00.31.50 - Accepted - runtime 33ms - memory 13.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def sortSentence(self, s: str) -> str: - a = s.split() - for i in a[:]: - a[int(i[-1]) - 1] = i[:-1] - - return ' '.join(a) \ No newline at end of file diff --git a/1978-minimum-adjacent-swaps-to-reach-the-kth-smallest-number/2024-01-06 15.44.59 - Accepted - runtime 471ms - memory 17.4MB.py b/1978-minimum-adjacent-swaps-to-reach-the-kth-smallest-number/2024-01-06 15.44.59 - Accepted - runtime 471ms - memory 17.4MB.py deleted file mode 100644 index 6f763e5..0000000 --- a/1978-minimum-adjacent-swaps-to-reach-the-kth-smallest-number/2024-01-06 15.44.59 - Accepted - runtime 471ms - memory 17.4MB.py +++ /dev/null @@ -1,21 +0,0 @@ -from bisect import bisect - -class Solution: - def getMinSwaps(self, num: str, k: int) -> int: - - arr = list(num) - for _ in range(k): - brr = [arr.pop()] - while arr[-1] >= brr[-1]: - brr.append(arr.pop()) - i = bisect(brr, arr[-1]) - arr[-1], brr[i] = brr[i], arr[-1] - arr += brr - - count = 0 - for item in num: - i = arr.index(item) - count += i - arr.pop(i) - - return count \ No newline at end of file diff --git a/198-house-robber/2022-12-17 19.05.19 - Accepted - runtime 39ms - memory 13.9MB.py b/198-house-robber/2022-12-17 19.05.19 - Accepted - runtime 39ms - memory 13.9MB.py deleted file mode 100644 index 5f537f6..0000000 --- a/198-house-robber/2022-12-17 19.05.19 - Accepted - runtime 39ms - memory 13.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def rob(self, nums: list[int]) -> int: - res = [0] - for i in nums: - res = [max(res), res[0] + i] - - return max(res) \ No newline at end of file diff --git a/198-house-robber/2022-12-17 19.21.25 - Accepted - runtime 66ms - memory 14MB.py b/198-house-robber/2022-12-17 19.21.25 - Accepted - runtime 66ms - memory 14MB.py deleted file mode 100644 index 434b02e..0000000 --- a/198-house-robber/2022-12-17 19.21.25 - Accepted - runtime 66ms - memory 14MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def rob(self, nums: list[int]) -> int: - a = b = 0 - for i in nums: - a, b = max(a, b), a + i - - return max(a, b) \ No newline at end of file diff --git a/198-house-robber/2022-12-17 19.21.35 - Accepted - runtime 33ms - memory 13.8MB.py b/198-house-robber/2022-12-17 19.21.35 - Accepted - runtime 33ms - memory 13.8MB.py deleted file mode 100644 index 434b02e..0000000 --- a/198-house-robber/2022-12-17 19.21.35 - Accepted - runtime 33ms - memory 13.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def rob(self, nums: list[int]) -> int: - a = b = 0 - for i in nums: - a, b = max(a, b), a + i - - return max(a, b) \ No newline at end of file diff --git a/198-house-robber/2024-01-21 18.13.48 - Accepted - runtime 44ms - memory 16.6MB.py b/198-house-robber/2024-01-21 18.13.48 - Accepted - runtime 44ms - memory 16.6MB.py deleted file mode 100644 index 529f991..0000000 --- a/198-house-robber/2024-01-21 18.13.48 - Accepted - runtime 44ms - memory 16.6MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def rob(self, nums: List[int]) -> int: - a = b = 0 - for i in nums: - a, b = max(a, b), a + i - - return max(a, b) \ No newline at end of file diff --git a/1983-maximum-population-year/2023-01-04 00.18.07 - Accepted - runtime 62ms - memory 13.9MB.py b/1983-maximum-population-year/2023-01-04 00.18.07 - Accepted - runtime 62ms - memory 13.9MB.py deleted file mode 100644 index ae08554..0000000 --- a/1983-maximum-population-year/2023-01-04 00.18.07 - Accepted - runtime 62ms - memory 13.9MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def maximumPopulation(self, logs: List[List[int]]) -> int: - best_alive = alive = best_year = 0 - years = [] - logs.sort() - for a,b in logs: - if years: - m = heapq.nsmallest(1, years)[0] - if a >= m: - heapq.heappop(years) - alive -= 1 - - alive += 1 - heapq.heappush(years, b) - if alive > best_alive: - best_year = a - best_alive = alive - - - return best_year \ No newline at end of file diff --git a/1983-maximum-population-year/2023-01-04 00.39.21 - Accepted - runtime 59ms - memory 13.9MB.py b/1983-maximum-population-year/2023-01-04 00.39.21 - Accepted - runtime 59ms - memory 13.9MB.py deleted file mode 100644 index 8b83339..0000000 --- a/1983-maximum-population-year/2023-01-04 00.39.21 - Accepted - runtime 59ms - memory 13.9MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def maximumPopulation(self, logs: List[List[int]]) -> int: - pop = [0] * 101 - res = 0 - for a,b in logs: - pop[a - 1950] += 1 - pop[b - 1950] -= 1 - - for i in range(101): - pop[i] += pop[i - 1] - if pop[i] > pop[res]: - res = i - - print(pop) - - return res + 1950 \ No newline at end of file diff --git a/1983-maximum-population-year/2023-01-04 01.13.58 - Accepted - runtime 58ms - memory 13.8MB.py b/1983-maximum-population-year/2023-01-04 01.13.58 - Accepted - runtime 58ms - memory 13.8MB.py deleted file mode 100644 index cea0f68..0000000 --- a/1983-maximum-population-year/2023-01-04 01.13.58 - Accepted - runtime 58ms - memory 13.8MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def maximumPopulation(self, logs: List[List[int]]) -> int: - pop = [0] * 101 - res = 0 - for a,b in logs: - pop[a - 1950] += 1 - pop[b - 1950] -= 1 - - for i in range(101): - pop[i] += pop[i - 1] - if pop[i] > pop[res]: - res = i - - return res + 1950 \ No newline at end of file diff --git a/1993-sum-of-all-subset-xor-totals/2022-09-20 19.42.40 - Accepted - runtime 169ms - memory 13.8MB.py b/1993-sum-of-all-subset-xor-totals/2022-09-20 19.42.40 - Accepted - runtime 169ms - memory 13.8MB.py deleted file mode 100644 index 96d5894..0000000 --- a/1993-sum-of-all-subset-xor-totals/2022-09-20 19.42.40 - Accepted - runtime 169ms - memory 13.8MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def subsetXORSum(self, nums: List[int]) -> int: - r = 0 - for i in range(1, len(nums) + 1): - for f in itertools.combinations(nums, r=i): - k = 0 - for n in f: - k ^= n - r += k - return r \ No newline at end of file diff --git a/1993-sum-of-all-subset-xor-totals/2022-09-20 19.45.26 - Accepted - runtime 63ms - memory 14MB.py b/1993-sum-of-all-subset-xor-totals/2022-09-20 19.45.26 - Accepted - runtime 63ms - memory 14MB.py deleted file mode 100644 index 716f058..0000000 --- a/1993-sum-of-all-subset-xor-totals/2022-09-20 19.45.26 - Accepted - runtime 63ms - memory 14MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def subsetXORSum(self, nums: List[int]) -> int: - return eval('|'.join(map(str,nums))) * int(pow(2, len(nums)-1)) \ No newline at end of file diff --git a/2-add-two-numbers/2022-06-22 18.27.40 - Accepted - runtime 121ms - memory 14MB.py b/2-add-two-numbers/2022-06-22 18.27.40 - Accepted - runtime 121ms - memory 14MB.py deleted file mode 100644 index cb7a484..0000000 --- a/2-add-two-numbers/2022-06-22 18.27.40 - Accepted - runtime 121ms - memory 14MB.py +++ /dev/null @@ -1,28 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def chain(self, node: Optional[ListNode]) -> list: - a = '' - while node: - a += str(node.val) - node = node.next - - return int(a[::-1]) - - - def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]: - res = str(self.chain(l1) + self.chain(l2)) - hhead = head = ListNode(int(res[-1])) - for i in res[-2::-1]: - _next = ListNode(int(i)) - head.next = _next - head = _next - - return hhead - - - - \ No newline at end of file diff --git a/2-add-two-numbers/2024-02-17 17.55.23 - Accepted - runtime 23ms - memory 76.9MB.cpp b/2-add-two-numbers/2024-02-17 17.55.23 - Accepted - runtime 23ms - memory 76.9MB.cpp deleted file mode 100644 index d9890eb..0000000 --- a/2-add-two-numbers/2024-02-17 17.55.23 - Accepted - runtime 23ms - memory 76.9MB.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { - string a, b, res; - while (l1){ a += to_string(l1 -> val); l1 = l1 -> next; } - while (l2){ b += to_string(l2 -> val); l2 = l2 -> next; } - ListNode* dummy = new ListNode(); - ListNode* prev = dummy; - bool remainder = false; - for (int i = 0; i < max(a.size(), b.size()); i++){ - int val = (i < a.size()? a[i]: '0') + (i < b.size()? b[i]: '0') - 96; - if (remainder) { val++; remainder=false; }; - if (val > 9) remainder = true; - ListNode* tmp = new ListNode(val % 10); - prev -> next = tmp; - prev = tmp; - } - if (remainder) prev -> next = new ListNode(1); - return dummy -> next; - } -}; \ No newline at end of file diff --git a/2-add-two-numbers/2024-02-17 18.03.04 - Accepted - runtime 39ms - memory 76MB.cpp b/2-add-two-numbers/2024-02-17 18.03.04 - Accepted - runtime 39ms - memory 76MB.cpp deleted file mode 100644 index 8eaf020..0000000 --- a/2-add-two-numbers/2024-02-17 18.03.04 - Accepted - runtime 39ms - memory 76MB.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { - ListNode* dummy = new ListNode(); - ListNode* prev = dummy; - int remainder = 0, sum; - while (l1 || l2 || remainder){ - sum = 0; - if (l1){ sum = l1 -> val; l1 = l1 -> next; } - if (l2){ sum += l2 -> val; l2 = l2 -> next; } - sum += remainder; - remainder = sum / 10; - ListNode* tmp = new ListNode(sum % 10); - prev -> next = tmp; - prev = tmp; - } - return dummy -> next; - } -}; \ No newline at end of file diff --git a/2-add-two-numbers/2024-02-17 18.03.27 - Accepted - runtime 19ms - memory 75.9MB.cpp b/2-add-two-numbers/2024-02-17 18.03.27 - Accepted - runtime 19ms - memory 75.9MB.cpp deleted file mode 100644 index 8eaf020..0000000 --- a/2-add-two-numbers/2024-02-17 18.03.27 - Accepted - runtime 19ms - memory 75.9MB.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { - ListNode* dummy = new ListNode(); - ListNode* prev = dummy; - int remainder = 0, sum; - while (l1 || l2 || remainder){ - sum = 0; - if (l1){ sum = l1 -> val; l1 = l1 -> next; } - if (l2){ sum += l2 -> val; l2 = l2 -> next; } - sum += remainder; - remainder = sum / 10; - ListNode* tmp = new ListNode(sum % 10); - prev -> next = tmp; - prev = tmp; - } - return dummy -> next; - } -}; \ No newline at end of file diff --git a/20-valid-parentheses/2022-04-23 09.58.48 - Accepted - runtime 43ms - memory 13.9MB.py b/20-valid-parentheses/2022-04-23 09.58.48 - Accepted - runtime 43ms - memory 13.9MB.py deleted file mode 100644 index c802e5d..0000000 --- a/20-valid-parentheses/2022-04-23 09.58.48 - Accepted - runtime 43ms - memory 13.9MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def closing(self, current_open: str, check_val: str) -> bool: - if current_open == '(' and check_val == ')':return True - if current_open == '[' and check_val == ']':return True - if current_open == '{' and check_val == '}':return True - return False - - def isValid(self, s: str) -> bool: - opened = '' - for i in s: - if i in '([{': - opened += i - else: - if not opened or not self.closing(opened[-1], i): - return False - else: - opened = opened[:-1] - - return opened == '' - \ No newline at end of file diff --git a/20-valid-parentheses/2023-04-10 08.24.46 - Accepted - runtime 37ms - memory 13.9MB.py b/20-valid-parentheses/2023-04-10 08.24.46 - Accepted - runtime 37ms - memory 13.9MB.py deleted file mode 100644 index 5cbb78a..0000000 --- a/20-valid-parentheses/2023-04-10 08.24.46 - Accepted - runtime 37ms - memory 13.9MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def isValid(self, s: str) -> bool: - m = {'(': ')', '{': '}', '[': ']'} - d = {'(': 0, '{': 0, '[': 0} - o = '' - for i in s: - if i in '({[': - d[i] += 1 - o += i - else: - if not o: - return False - if m[o[-1]] != i: - return False - d[o[-1]] -= 1 - if d[o[-1]] < 0: - return False - o = o[:-1] - - return all(f == 0 for f in d.values()) \ No newline at end of file diff --git a/20-valid-parentheses/2023-04-10 23.39.46 - Accepted - runtime 40ms - memory 13.8MB.py b/20-valid-parentheses/2023-04-10 23.39.46 - Accepted - runtime 40ms - memory 13.8MB.py deleted file mode 100644 index e67387f..0000000 --- a/20-valid-parentheses/2023-04-10 23.39.46 - Accepted - runtime 40ms - memory 13.8MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def isValid(self, s: str) -> bool: - m = {'(': ')', '{': '}', '[': ']'} - stack = [] - for i in s: - if i in m.keys(): - stack.append(i) - else: - if not stack or i != m[stack.pop()]: - return False - - return not stack \ No newline at end of file diff --git a/20-valid-parentheses/2023-04-10 23.39.59 - Accepted - runtime 22ms - memory 13.8MB.py b/20-valid-parentheses/2023-04-10 23.39.59 - Accepted - runtime 22ms - memory 13.8MB.py deleted file mode 100644 index e67387f..0000000 --- a/20-valid-parentheses/2023-04-10 23.39.59 - Accepted - runtime 22ms - memory 13.8MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def isValid(self, s: str) -> bool: - m = {'(': ')', '{': '}', '[': ']'} - stack = [] - for i in s: - if i in m.keys(): - stack.append(i) - else: - if not stack or i != m[stack.pop()]: - return False - - return not stack \ No newline at end of file diff --git a/20-valid-parentheses/2024-02-16 22.46.20 - Accepted - runtime 2ms - memory 8MB.cpp b/20-valid-parentheses/2024-02-16 22.46.20 - Accepted - runtime 2ms - memory 8MB.cpp deleted file mode 100644 index 89e959c..0000000 --- a/20-valid-parentheses/2024-02-16 22.46.20 - Accepted - runtime 2ms - memory 8MB.cpp +++ /dev/null @@ -1,20 +0,0 @@ -class Solution { -public: - bool isValid(string s) { - unordered_map mp = { - {'(', ')'}, - {'{', '}'}, - {'[', ']'} - }; - stack st; - for (char i : s) { - if (mp.find(i) != mp.end()) st.push(i); - else { - if (st.empty() || i != mp[st.top()])return false; - st.pop(); - } - } - - return st.empty(); - } -}; \ No newline at end of file diff --git a/20-valid-parentheses/2024-02-16 22.46.33 - Accepted - runtime 3ms - memory 8MB.cpp b/20-valid-parentheses/2024-02-16 22.46.33 - Accepted - runtime 3ms - memory 8MB.cpp deleted file mode 100644 index 89e959c..0000000 --- a/20-valid-parentheses/2024-02-16 22.46.33 - Accepted - runtime 3ms - memory 8MB.cpp +++ /dev/null @@ -1,20 +0,0 @@ -class Solution { -public: - bool isValid(string s) { - unordered_map mp = { - {'(', ')'}, - {'{', '}'}, - {'[', ']'} - }; - stack st; - for (char i : s) { - if (mp.find(i) != mp.end()) st.push(i); - else { - if (st.empty() || i != mp[st.top()])return false; - st.pop(); - } - } - - return st.empty(); - } -}; \ No newline at end of file diff --git a/20-valid-parentheses/2024-02-16 22.53.29 - Accepted - runtime 0ms - memory 7.7MB.cpp b/20-valid-parentheses/2024-02-16 22.53.29 - Accepted - runtime 0ms - memory 7.7MB.cpp deleted file mode 100644 index a5d5553..0000000 --- a/20-valid-parentheses/2024-02-16 22.53.29 - Accepted - runtime 0ms - memory 7.7MB.cpp +++ /dev/null @@ -1,18 +0,0 @@ -class Solution { -public: - bool isValid(string s) { - stack st; - for (char i: s){ - if (i == '(' || i == '{' || i == '[')st.push(i); - else{ - if (st.empty() || - (i == ')' && st.top() != '(') || - (i == ']' && st.top() != '[') || - (i == '}' && st.top() != '{') - ) return false; - st.pop(); - } - } - return st.empty(); - } -}; \ No newline at end of file diff --git a/200-number-of-islands/2022-07-15 15.01.49 - Accepted - runtime 469ms - memory 16.2MB.py b/200-number-of-islands/2022-07-15 15.01.49 - Accepted - runtime 469ms - memory 16.2MB.py deleted file mode 100644 index a23dee7..0000000 --- a/200-number-of-islands/2022-07-15 15.01.49 - Accepted - runtime 469ms - memory 16.2MB.py +++ /dev/null @@ -1,25 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - w, h = len(grid[0]), len(grid) - visited = [[0] * w for _ in range(h)] - rivers = 0 - for y,i in enumerate(grid): - for x,j in enumerate(i): - if not visited[y][x]: - visit = [(x,y)] - size = 0 - while visit: - X,Y = visit.pop() - if visited[Y][X] or grid[Y][X] == '0':continue - visited[Y][X] = 1 - size = 1 - for a,b in ((1,0),(-1,0),(0,1),(0,-1)): - XX = max(min(X + a, w - 1), 0) - YY = max(min(Y + b, h - 1), 0) - if not visited[YY][XX] and grid[YY][XX] == '1': - visit.append((XX,YY)) - - rivers += size - - - return rivers \ No newline at end of file diff --git a/200-number-of-islands/2022-12-18 15.13.54 - Accepted - runtime 1356ms - memory 16.2MB.py b/200-number-of-islands/2022-12-18 15.13.54 - Accepted - runtime 1356ms - memory 16.2MB.py deleted file mode 100644 index ded4857..0000000 --- a/200-number-of-islands/2022-12-18 15.13.54 - Accepted - runtime 1356ms - memory 16.2MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - h, w = len(grid), len(grid[0]) - res = 0 - for y in range(h): - for x in range(w): - if grid[y][x] == '1': - stack = [(x, y)] - res += 1 - while stack: - X, Y = stack.pop() - grid[Y][X] = '0' - for i,j in ((0, 1), (0, -1), (1, 0), (-1, 0)): - XX = max(min(X + i, w - 1), 0) - YY = max(min(Y + j, h - 1), 0) - if grid[YY][XX] == '1': - stack.append((XX, YY)) - - - - return res \ No newline at end of file diff --git a/200-number-of-islands/2022-12-18 15.14.08 - Accepted - runtime 1331ms - memory 16.3MB.py b/200-number-of-islands/2022-12-18 15.14.08 - Accepted - runtime 1331ms - memory 16.3MB.py deleted file mode 100644 index ded4857..0000000 --- a/200-number-of-islands/2022-12-18 15.14.08 - Accepted - runtime 1331ms - memory 16.3MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - h, w = len(grid), len(grid[0]) - res = 0 - for y in range(h): - for x in range(w): - if grid[y][x] == '1': - stack = [(x, y)] - res += 1 - while stack: - X, Y = stack.pop() - grid[Y][X] = '0' - for i,j in ((0, 1), (0, -1), (1, 0), (-1, 0)): - XX = max(min(X + i, w - 1), 0) - YY = max(min(Y + j, h - 1), 0) - if grid[YY][XX] == '1': - stack.append((XX, YY)) - - - - return res \ No newline at end of file diff --git a/200-number-of-islands/2022-12-18 15.14.37 - Accepted - runtime 1307ms - memory 16.2MB.py b/200-number-of-islands/2022-12-18 15.14.37 - Accepted - runtime 1307ms - memory 16.2MB.py deleted file mode 100644 index ded4857..0000000 --- a/200-number-of-islands/2022-12-18 15.14.37 - Accepted - runtime 1307ms - memory 16.2MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - h, w = len(grid), len(grid[0]) - res = 0 - for y in range(h): - for x in range(w): - if grid[y][x] == '1': - stack = [(x, y)] - res += 1 - while stack: - X, Y = stack.pop() - grid[Y][X] = '0' - for i,j in ((0, 1), (0, -1), (1, 0), (-1, 0)): - XX = max(min(X + i, w - 1), 0) - YY = max(min(Y + j, h - 1), 0) - if grid[YY][XX] == '1': - stack.append((XX, YY)) - - - - return res \ No newline at end of file diff --git a/200-number-of-islands/2022-12-18 15.18.16 - Accepted - runtime 427ms - memory 16.2MB.py b/200-number-of-islands/2022-12-18 15.18.16 - Accepted - runtime 427ms - memory 16.2MB.py deleted file mode 100644 index d7541e7..0000000 --- a/200-number-of-islands/2022-12-18 15.18.16 - Accepted - runtime 427ms - memory 16.2MB.py +++ /dev/null @@ -1,22 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - h, w = len(grid), len(grid[0]) - res = 0 - hh, ww = h - 1, w - 1 - for y in range(h): - for x in range(w): - if grid[y][x] == '1': - stack = [(x, y)] - res += 1 - while stack: - X, Y = stack.pop() - grid[Y][X] = '0' - for i,j in ((0, 1), (0, -1), (1, 0), (-1, 0)): - XX = max(min(X + i, ww), 0) - YY = max(min(Y + j, hh), 0) - if grid[YY][XX] == '1': - stack.append((XX, YY)) - - - - return res \ No newline at end of file diff --git a/200-number-of-islands/2022-12-18 15.18.27 - Accepted - runtime 434ms - memory 16.2MB.py b/200-number-of-islands/2022-12-18 15.18.27 - Accepted - runtime 434ms - memory 16.2MB.py deleted file mode 100644 index d7541e7..0000000 --- a/200-number-of-islands/2022-12-18 15.18.27 - Accepted - runtime 434ms - memory 16.2MB.py +++ /dev/null @@ -1,22 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - h, w = len(grid), len(grid[0]) - res = 0 - hh, ww = h - 1, w - 1 - for y in range(h): - for x in range(w): - if grid[y][x] == '1': - stack = [(x, y)] - res += 1 - while stack: - X, Y = stack.pop() - grid[Y][X] = '0' - for i,j in ((0, 1), (0, -1), (1, 0), (-1, 0)): - XX = max(min(X + i, ww), 0) - YY = max(min(Y + j, hh), 0) - if grid[YY][XX] == '1': - stack.append((XX, YY)) - - - - return res \ No newline at end of file diff --git a/200-number-of-islands/2022-12-18 15.18.39 - Accepted - runtime 1300ms - memory 16.3MB.py b/200-number-of-islands/2022-12-18 15.18.39 - Accepted - runtime 1300ms - memory 16.3MB.py deleted file mode 100644 index d7541e7..0000000 --- a/200-number-of-islands/2022-12-18 15.18.39 - Accepted - runtime 1300ms - memory 16.3MB.py +++ /dev/null @@ -1,22 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - h, w = len(grid), len(grid[0]) - res = 0 - hh, ww = h - 1, w - 1 - for y in range(h): - for x in range(w): - if grid[y][x] == '1': - stack = [(x, y)] - res += 1 - while stack: - X, Y = stack.pop() - grid[Y][X] = '0' - for i,j in ((0, 1), (0, -1), (1, 0), (-1, 0)): - XX = max(min(X + i, ww), 0) - YY = max(min(Y + j, hh), 0) - if grid[YY][XX] == '1': - stack.append((XX, YY)) - - - - return res \ No newline at end of file diff --git a/200-number-of-islands/2024-03-07 16.17.13 - Accepted - runtime 326ms - memory 19MB.py b/200-number-of-islands/2024-03-07 16.17.13 - Accepted - runtime 326ms - memory 19MB.py deleted file mode 100644 index 795f16c..0000000 --- a/200-number-of-islands/2024-03-07 16.17.13 - Accepted - runtime 326ms - memory 19MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - h, w = len(grid), len(grid[0]) - visited = [[False] * w for _ in range(h)] - res = 0 - for y in range(h): - for x in range(w): - res += not visited[y][x] and grid[y][x] == '1' - stack = [(x, y)] if grid[y][x] == '1' else [] - while stack: - X, Y = stack.pop() - if visited[Y][X]: continue - visited[Y][X] = True - for XX, YY in ((0, 1), (0, -1), (1, 0), (-1, 0)): - xs = min(max(0, X + XX), w - 1) - ys = min(max(0, Y + YY), h - 1) - if grid[ys][xs] == '1': - stack.append((xs, ys)) - - return res diff --git a/200-number-of-islands/2024-03-07 16.18.25 - Accepted - runtime 71ms - memory 17.4MB.py b/200-number-of-islands/2024-03-07 16.18.25 - Accepted - runtime 71ms - memory 17.4MB.py deleted file mode 100644 index 1f8f630..0000000 --- a/200-number-of-islands/2024-03-07 16.18.25 - Accepted - runtime 71ms - memory 17.4MB.py +++ /dev/null @@ -1,27 +0,0 @@ -from json import loads as l -def dfs(g, i, j): - g[i][j] = "0" - if i+1 < len(g) and g[i+1][j] == '1': - g = dfs(g, i+1, j) - if j+1 < len(g[i]) and g[i][j+1] == '1': - g = dfs(g, i, j+1) - if i-1 >= 0 and g[i-1][j] == '1': - g = dfs(g, i-1, j) - if j-1 >= 0 and g[i][j-1] == '1': - g = dfs(g, i, j-1) - return g - -with open('user.out','w') as file: - for g in stdin: - g = l(g) - if not g or not g[0]: - file.write('0'+'\n') - else: - c = 0 - for i in range(len(g)): - for j in range(len(g[i])): - if g[i][j] == "1": - c += 1 - g = dfs(g, i, j) - file.write(str(c)+'\n') -exit() \ No newline at end of file diff --git a/200-number-of-islands/2024-03-09 15.11.57 - Accepted - runtime 314ms - memory 18.9MB.py b/200-number-of-islands/2024-03-09 15.11.57 - Accepted - runtime 314ms - memory 18.9MB.py deleted file mode 100644 index 1965b5f..0000000 --- a/200-number-of-islands/2024-03-09 15.11.57 - Accepted - runtime 314ms - memory 18.9MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - w, h = len(grid[0]), len(grid) - visited = [[False] * w for f in range(h)] - res = 0 - for y in range(h): - for x in range(w): - if grid[y][x] == '1' and not visited[y][x]: - res += 1 - stack = [(x, y)] - while stack: - X, Y = stack.pop() - if visited[Y][X]:continue - visited[Y][X] = True - for XX, YY in ((1, 0), (0, 1), (-1, 0), (0, -1)): - xx = min(max(0, X + XX), w - 1) - yy = min(max(0, Y + YY), h - 1) - if grid[yy][xx] == '1': - stack.append((xx, yy)) - - return res diff --git a/200-number-of-islands/2024-04-19 09.50.52 - Accepted - runtime 307ms - memory 18.9MB.py b/200-number-of-islands/2024-04-19 09.50.52 - Accepted - runtime 307ms - memory 18.9MB.py deleted file mode 100644 index 0c6fdb3..0000000 --- a/200-number-of-islands/2024-04-19 09.50.52 - Accepted - runtime 307ms - memory 18.9MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def numIslands(self, grid: List[List[str]]) -> int: - h, w = len(grid), len(grid[0]) - res = 0 - for y in range(h): - for x in range(w): - if grid[y][x] == '1': - stack = [(x, y)] - res += 1 - while stack: - X, Y = stack.pop() - if grid[Y][X] != '1':continue - grid[Y][X] = '0' - for i,j in ((0, 1), (1, 0), (-1, 0), (0, -1)): - xx = min(max(0, X - i), w - 1) - yy = min(max(0, Y - j), h - 1) - if grid[yy][xx] == '1': stack.append((xx, yy)) - - return res \ No newline at end of file diff --git a/201-bitwise-and-of-numbers-range/2024-02-21 10.54.59 - Accepted - runtime 3ms - memory 8.8MB.cpp b/201-bitwise-and-of-numbers-range/2024-02-21 10.54.59 - Accepted - runtime 3ms - memory 8.8MB.cpp deleted file mode 100644 index 1b3a927..0000000 --- a/201-bitwise-and-of-numbers-range/2024-02-21 10.54.59 - Accepted - runtime 3ms - memory 8.8MB.cpp +++ /dev/null @@ -1,7 +0,0 @@ -class Solution { -public: - int rangeBitwiseAnd(int left, int right) { - while (right > left) right &= right - 1; - return left & right; - } -}; \ No newline at end of file diff --git a/202-happy-number/2022-06-30 14.39.41 - Accepted - runtime 96ms - memory 13.9MB.py b/202-happy-number/2022-06-30 14.39.41 - Accepted - runtime 96ms - memory 13.9MB.py deleted file mode 100644 index 50ab0b8..0000000 --- a/202-happy-number/2022-06-30 14.39.41 - Accepted - runtime 96ms - memory 13.9MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def isHappy(self, n: int) -> bool: - for i in range(100): - n = sum(map(lambda x:int(x)**2, str(n))) - if n == 1: - return True - return False - \ No newline at end of file diff --git a/203-remove-linked-list-elements/2022-06-29 14.21.15 - Accepted - runtime 83ms - memory 17.8MB.py b/203-remove-linked-list-elements/2022-06-29 14.21.15 - Accepted - runtime 83ms - memory 17.8MB.py deleted file mode 100644 index 977231e..0000000 --- a/203-remove-linked-list-elements/2022-06-29 14.21.15 - Accepted - runtime 83ms - memory 17.8MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: - prev = ListNode() - returned_head = prev - while head: - if head.val == val: - head = head.next - prev.next = None - continue - prev.next = head - prev = head - head = head.next - - return returned_head.next \ No newline at end of file diff --git a/203-remove-linked-list-elements/2022-06-29 14.24.06 - Accepted - runtime 81ms - memory 27MB.py b/203-remove-linked-list-elements/2022-06-29 14.24.06 - Accepted - runtime 81ms - memory 27MB.py deleted file mode 100644 index f9f31f9..0000000 --- a/203-remove-linked-list-elements/2022-06-29 14.24.06 - Accepted - runtime 81ms - memory 27MB.py +++ /dev/null @@ -1,10 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: - if not head: return None - head.next = self.removeElements(head.next, val) - return head if head.val != val else head.next \ No newline at end of file diff --git a/203-remove-linked-list-elements/2022-06-29 14.24.16 - Accepted - runtime 98ms - memory 26.9MB.py b/203-remove-linked-list-elements/2022-06-29 14.24.16 - Accepted - runtime 98ms - memory 26.9MB.py deleted file mode 100644 index f9f31f9..0000000 --- a/203-remove-linked-list-elements/2022-06-29 14.24.16 - Accepted - runtime 98ms - memory 26.9MB.py +++ /dev/null @@ -1,10 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: - if not head: return None - head.next = self.removeElements(head.next, val) - return head if head.val != val else head.next \ No newline at end of file diff --git a/2044-number-of-wonderful-substrings/2024-04-30 09.08.22 - Accepted - runtime 1426ms - memory 17.5MB.py b/2044-number-of-wonderful-substrings/2024-04-30 09.08.22 - Accepted - runtime 1426ms - memory 17.5MB.py deleted file mode 100644 index 07a647a..0000000 --- a/2044-number-of-wonderful-substrings/2024-04-30 09.08.22 - Accepted - runtime 1426ms - memory 17.5MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def wonderfulSubstrings(self, word: str) -> int: - count = [1] + [0] * 1024 - res = cur = 0 - for i in word: - cur ^= 1 << (ord(i) - 97) - res += count[cur] - res += sum(count[cur ^ (1 << f)] for f in range(10)) - count[cur] += 1 - - return res \ No newline at end of file diff --git a/2048-build-array-from-permutation/2022-08-01 16.03.14 - Accepted - runtime 214ms - memory 14.1MB.py b/2048-build-array-from-permutation/2022-08-01 16.03.14 - Accepted - runtime 214ms - memory 14.1MB.py deleted file mode 100644 index f17665f..0000000 --- a/2048-build-array-from-permutation/2022-08-01 16.03.14 - Accepted - runtime 214ms - memory 14.1MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def buildArray(self, nums: List[int]) -> List[int]: - l = len(nums) - res = [0] * l - for i in range(l): - res[i] = nums[nums[i]] - - return res - \ No newline at end of file diff --git a/205-isomorphic-strings/2024-04-02 11.17.24 - Accepted - runtime 60ms - memory 17.3MB.py b/205-isomorphic-strings/2024-04-02 11.17.24 - Accepted - runtime 60ms - memory 17.3MB.py deleted file mode 100644 index fb80cee..0000000 --- a/205-isomorphic-strings/2024-04-02 11.17.24 - Accepted - runtime 60ms - memory 17.3MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def isIsomorphic(self, s: str, t: str) -> bool: - a, b = map(Counter, (s, t)) - for i in range(len(s)): - if a[s[i]] != b[t[i]]: - return False - - a, b = map(lambda x: [len(list(i)) for f,i in groupby(x)], (s, t)) - return a == b \ No newline at end of file diff --git a/205-isomorphic-strings/2024-04-02 11.22.09 - Accepted - runtime 52ms - memory 16.8MB.py b/205-isomorphic-strings/2024-04-02 11.22.09 - Accepted - runtime 52ms - memory 16.8MB.py deleted file mode 100644 index 426cecc..0000000 --- a/205-isomorphic-strings/2024-04-02 11.22.09 - Accepted - runtime 52ms - memory 16.8MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def isIsomorphic(self, s: str, t: str) -> bool: - a, b = Counter(), Counter() - for i in range(len(s)): - if a[s[i]] != b[t[i]]: - return False - a[s[i]] = i + 1 - b[t[i]] = i + 1 - - return True diff --git a/2058-concatenation-of-array/2022-08-01 16.03.49 - Accepted - runtime 142ms - memory 14.3MB.py b/2058-concatenation-of-array/2022-08-01 16.03.49 - Accepted - runtime 142ms - memory 14.3MB.py deleted file mode 100644 index 5e822e9..0000000 --- a/2058-concatenation-of-array/2022-08-01 16.03.49 - Accepted - runtime 142ms - memory 14.3MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def getConcatenation(self, nums: List[int]) -> List[int]: - return nums + nums \ No newline at end of file diff --git a/206-reverse-linked-list/2022-06-29 13.23.56 - Accepted - runtime 49ms - memory 20.5MB.py b/206-reverse-linked-list/2022-06-29 13.23.56 - Accepted - runtime 49ms - memory 20.5MB.py deleted file mode 100644 index f878614..0000000 --- a/206-reverse-linked-list/2022-06-29 13.23.56 - Accepted - runtime 49ms - memory 20.5MB.py +++ /dev/null @@ -1,15 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - if not head or not head.next: - return head - - new_head = self.reverseList(head.next) - head.next.next = head - head.next = None - - return new_head \ No newline at end of file diff --git a/206-reverse-linked-list/2022-11-25 22.26.51 - Accepted - runtime 77ms - memory 20.4MB.py b/206-reverse-linked-list/2022-11-25 22.26.51 - Accepted - runtime 77ms - memory 20.4MB.py deleted file mode 100644 index 96adffc..0000000 --- a/206-reverse-linked-list/2022-11-25 22.26.51 - Accepted - runtime 77ms - memory 20.4MB.py +++ /dev/null @@ -1,15 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - if not head or not head.next: - return head - - new_head = self.reverseList(head.next) - head.next.next = head - head.next = None - - return new_head \ No newline at end of file diff --git a/206-reverse-linked-list/2022-11-27 19.33.04 - Accepted - runtime 45ms - memory 20.5MB.py b/206-reverse-linked-list/2022-11-27 19.33.04 - Accepted - runtime 45ms - memory 20.5MB.py deleted file mode 100644 index d6d1388..0000000 --- a/206-reverse-linked-list/2022-11-27 19.33.04 - Accepted - runtime 45ms - memory 20.5MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - if not (head and head.next): - return head - - new_head = self.reverseList(head.next) - head.next.next = head - head.next = None - - return new_head \ No newline at end of file diff --git a/206-reverse-linked-list/2023-04-02 15.45.56 - Accepted - runtime 42ms - memory 20.5MB.py b/206-reverse-linked-list/2023-04-02 15.45.56 - Accepted - runtime 42ms - memory 20.5MB.py deleted file mode 100644 index db45b7c..0000000 --- a/206-reverse-linked-list/2023-04-02 15.45.56 - Accepted - runtime 42ms - memory 20.5MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - if not head or not head.next: - return head - - new_head = self.reverseList(head.next) - head.next.next = head - head.next = None - - return new_head \ No newline at end of file diff --git a/206-reverse-linked-list/2024-01-21 21.30.48 - Accepted - runtime 39ms - memory 17.8MB.py b/206-reverse-linked-list/2024-01-21 21.30.48 - Accepted - runtime 39ms - memory 17.8MB.py deleted file mode 100644 index c2c1628..0000000 --- a/206-reverse-linked-list/2024-01-21 21.30.48 - Accepted - runtime 39ms - memory 17.8MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - l = [] - while head: - l.append(head) - head = head.next - for i in range(len(l) - 1): - l[~i].next = l[~i - 1] - if l: - l[0].next = None - return l[-1] - - return None \ No newline at end of file diff --git a/206-reverse-linked-list/2024-01-21 21.32.39 - Accepted - runtime 29ms - memory 17.6MB.py b/206-reverse-linked-list/2024-01-21 21.32.39 - Accepted - runtime 29ms - memory 17.6MB.py deleted file mode 100644 index fb5004a..0000000 --- a/206-reverse-linked-list/2024-01-21 21.32.39 - Accepted - runtime 29ms - memory 17.6MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - if not head or not head.next: - return head - - new_head = self.reverseList(head.next) - head.next.next = head - head.next = None - return new_head \ No newline at end of file diff --git a/206-reverse-linked-list/2024-02-17 16.13.35 - Accepted - runtime 0ms - memory 11.9MB.cpp b/206-reverse-linked-list/2024-02-17 16.13.35 - Accepted - runtime 0ms - memory 11.9MB.cpp deleted file mode 100644 index 291b3cc..0000000 --- a/206-reverse-linked-list/2024-02-17 16.13.35 - Accepted - runtime 0ms - memory 11.9MB.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* reverseList(ListNode* head) { - if(head == NULL || head -> next == NULL) return head; - // 1 -> 2 -> 3 -> 4; - ListNode* newHead = reverseList(head -> next); - head -> next -> next = head; - head -> next = NULL; - return newHead; - } -}; \ No newline at end of file diff --git a/206-reverse-linked-list/2024-03-08 18.12.39 - Accepted - runtime 38ms - memory 17.8MB.py b/206-reverse-linked-list/2024-03-08 18.12.39 - Accepted - runtime 38ms - memory 17.8MB.py deleted file mode 100644 index 4bc463b..0000000 --- a/206-reverse-linked-list/2024-03-08 18.12.39 - Accepted - runtime 38ms - memory 17.8MB.py +++ /dev/null @@ -1,16 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - prev = None - curr = head - while curr: - next_node = curr.next - curr.next = prev - prev = curr - curr = next_node - - return prev diff --git a/206-reverse-linked-list/2024-03-09 15.14.43 - Accepted - runtime 37ms - memory 17.7MB.py b/206-reverse-linked-list/2024-03-09 15.14.43 - Accepted - runtime 37ms - memory 17.7MB.py deleted file mode 100644 index fb5004a..0000000 --- a/206-reverse-linked-list/2024-03-09 15.14.43 - Accepted - runtime 37ms - memory 17.7MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - if not head or not head.next: - return head - - new_head = self.reverseList(head.next) - head.next.next = head - head.next = None - return new_head \ No newline at end of file diff --git a/206-reverse-linked-list/2024-03-09 15.15.43 - Accepted - runtime 33ms - memory 17.6MB.py b/206-reverse-linked-list/2024-03-09 15.15.43 - Accepted - runtime 33ms - memory 17.6MB.py deleted file mode 100644 index 7f3e8fe..0000000 --- a/206-reverse-linked-list/2024-03-09 15.15.43 - Accepted - runtime 33ms - memory 17.6MB.py +++ /dev/null @@ -1,16 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - prev = None - curr = head - while curr: - next_node = curr.next - curr.next = prev - prev = curr - curr = next_node - - return prev \ No newline at end of file diff --git a/206-reverse-linked-list/2024-03-21 21.46.14 - Accepted - runtime 31ms - memory 17.6MB.py b/206-reverse-linked-list/2024-03-21 21.46.14 - Accepted - runtime 31ms - memory 17.6MB.py deleted file mode 100644 index 7f3e8fe..0000000 --- a/206-reverse-linked-list/2024-03-21 21.46.14 - Accepted - runtime 31ms - memory 17.6MB.py +++ /dev/null @@ -1,16 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: - prev = None - curr = head - while curr: - next_node = curr.next - curr.next = prev - prev = curr - curr = next_node - - return prev \ No newline at end of file diff --git a/208-implement-trie-prefix-tree/2024-03-08 19.48.43 - Accepted - runtime 114ms - memory 31.4MB.py b/208-implement-trie-prefix-tree/2024-03-08 19.48.43 - Accepted - runtime 114ms - memory 31.4MB.py deleted file mode 100644 index 48df922..0000000 --- a/208-implement-trie-prefix-tree/2024-03-08 19.48.43 - Accepted - runtime 114ms - memory 31.4MB.py +++ /dev/null @@ -1,37 +0,0 @@ -class Node: - def __init__(self): - self.children = defaultdict(Node) - self.is_word = False - -class Trie: - def __init__(self): - self.root = Node() - - def insert(self, word: str) -> None: - curr = self.root - for i in word: - curr = curr.children[i] - - curr.is_word = True - - def search(self, word: str, is_word=True) -> bool: - curr = self.root - for i in word: - curr = curr.children.get(i) - if not curr: - return False - - if is_word: - return curr.is_word - - return True - - def startsWith(self, prefix: str) -> bool: - return self.search(prefix, False) - - -# Your Trie object will be instantiated and called as such: -# obj = Trie() -# obj.insert(word) -# param_2 = obj.search(word) -# param_3 = obj.startsWith(prefix) \ No newline at end of file diff --git a/2083-three-divisors/2024-01-05 23.21.34 - Accepted - runtime 34ms - memory 17.3MB.py b/2083-three-divisors/2024-01-05 23.21.34 - Accepted - runtime 34ms - memory 17.3MB.py deleted file mode 100644 index 6e726ba..0000000 --- a/2083-three-divisors/2024-01-05 23.21.34 - Accepted - runtime 34ms - memory 17.3MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def isThree(self, n: int) -> bool: - k = 1 - for i in range(2, n + 1): - if n % i == 0: - k += 1 - if k > 3: - return False - return k == 3 \ No newline at end of file diff --git a/21-merge-two-sorted-lists/2022-04-24 22.29.26 - Accepted - runtime 42ms - memory 14MB.py b/21-merge-two-sorted-lists/2022-04-24 22.29.26 - Accepted - runtime 42ms - memory 14MB.py deleted file mode 100644 index ed619fa..0000000 --- a/21-merge-two-sorted-lists/2022-04-24 22.29.26 - Accepted - runtime 42ms - memory 14MB.py +++ /dev/null @@ -1,22 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: - if list1 and list2: - nodes = [] - while list1: - nodes.append(list1) - list1 = list1.next - while list2: - nodes.append(list2) - list2 = list2.next - nodes.sort(key=lambda x: x.val) - for i in range(len(nodes) - 1):nodes[i].next = nodes[i + 1] - - return nodes[0] - - elif list1:return list1 - return list2 \ No newline at end of file diff --git a/21-merge-two-sorted-lists/2022-04-24 22.30.38 - Accepted - runtime 40ms - memory 13.9MB.py b/21-merge-two-sorted-lists/2022-04-24 22.30.38 - Accepted - runtime 40ms - memory 13.9MB.py deleted file mode 100644 index ba8fb75..0000000 --- a/21-merge-two-sorted-lists/2022-04-24 22.30.38 - Accepted - runtime 40ms - memory 13.9MB.py +++ /dev/null @@ -1,20 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: - cur = dummy = ListNode() - while list1 and list2: - if list1.val < list2.val: - cur.next = list1 - list1, cur = list1.next, list1 - else: - cur.next = list2 - list2, cur = list2.next, list2 - - if list1 or list2: - cur.next = list1 if list1 else list2 - - return dummy.next \ No newline at end of file diff --git a/21-merge-two-sorted-lists/2022-04-24 22.35.54 - Accepted - runtime 91ms - memory 13.9MB.py b/21-merge-two-sorted-lists/2022-04-24 22.35.54 - Accepted - runtime 91ms - memory 13.9MB.py deleted file mode 100644 index a25a488..0000000 --- a/21-merge-two-sorted-lists/2022-04-24 22.35.54 - Accepted - runtime 91ms - memory 13.9MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: - cur = dummy = ListNode() - while list1 and list2: - if list1.val < list2.val: - cur.next = list1 - list1, cur = list1.next, list1 - else: - cur.next = list2 - list2, cur = list2.next, list2 - if list1 or list2: - cur.next = list1 if list1 else list2 - return dummy.next \ No newline at end of file diff --git a/21-merge-two-sorted-lists/2022-04-24 22.36.04 - Accepted - runtime 38ms - memory 14MB.py b/21-merge-two-sorted-lists/2022-04-24 22.36.04 - Accepted - runtime 38ms - memory 14MB.py deleted file mode 100644 index a25a488..0000000 --- a/21-merge-two-sorted-lists/2022-04-24 22.36.04 - Accepted - runtime 38ms - memory 14MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: - cur = dummy = ListNode() - while list1 and list2: - if list1.val < list2.val: - cur.next = list1 - list1, cur = list1.next, list1 - else: - cur.next = list2 - list2, cur = list2.next, list2 - if list1 or list2: - cur.next = list1 if list1 else list2 - return dummy.next \ No newline at end of file diff --git a/21-merge-two-sorted-lists/2024-02-17 01.34.39 - Accepted - runtime 8ms - memory 18.7MB.cpp b/21-merge-two-sorted-lists/2024-02-17 01.34.39 - Accepted - runtime 8ms - memory 18.7MB.cpp deleted file mode 100644 index 009ff2c..0000000 --- a/21-merge-two-sorted-lists/2024-02-17 01.34.39 - Accepted - runtime 8ms - memory 18.7MB.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* mergeTwoLists(ListNode* a, ListNode* b) { - vector st; - while (a){ - st.push_back(a -> val); - a = a -> next; - } - while (b){ - st.push_back(b -> val); - b = b -> next; - } - sort(st.begin(), st.end()); - if (st.empty()) return NULL; - ListNode* res = new ListNode(st[0]); - ListNode* prev = res; - for (int i=1;i < st.size();i++){ - ListNode* temp = new ListNode(st[i]); - prev -> next = temp; - prev = temp; - } - return res; - } -}; \ No newline at end of file diff --git a/21-merge-two-sorted-lists/2024-02-17 01.43.55 - Accepted - runtime 3ms - memory 18.2MB.cpp b/21-merge-two-sorted-lists/2024-02-17 01.43.55 - Accepted - runtime 3ms - memory 18.2MB.cpp deleted file mode 100644 index 60f08a4..0000000 --- a/21-merge-two-sorted-lists/2024-02-17 01.43.55 - Accepted - runtime 3ms - memory 18.2MB.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* mergeTwoLists(ListNode* a, ListNode* b) { - if (!a) return b; - if (!b) return a; - if (a -> val <= b -> val){ - a -> next = mergeTwoLists(a -> next, b); - return a; - } - else { - b -> next = mergeTwoLists(a, b -> next); - return b; - } - } -}; \ No newline at end of file diff --git a/2103-find-all-groups-of-farmland/2024-04-20 10.15.12 - Accepted - runtime 1211ms - memory 28.7MB.py b/2103-find-all-groups-of-farmland/2024-04-20 10.15.12 - Accepted - runtime 1211ms - memory 28.7MB.py deleted file mode 100644 index 4d29530..0000000 --- a/2103-find-all-groups-of-farmland/2024-04-20 10.15.12 - Accepted - runtime 1211ms - memory 28.7MB.py +++ /dev/null @@ -1,23 +0,0 @@ -class Solution: - def findFarmland(self, land: List[List[int]]) -> List[List[int]]: - h, w = len(land), len(land[0]) - res = [] - for y in range(h): - for x in range(w): - if land[y][x]: - stack = [(x, y)] - xi, yi = x, y - while stack: - X, Y = stack.pop() - if not land[Y][X]:continue - land[Y][X] = 0 - for i,j in ((0, 1), (1, 0), (-1, 0), (0, -1)): - xx = min(max(0, X + i), w - 1) - yy = min(max(0, Y + j), h - 1) - if land[yy][xx]: - xi, yi = max((xi, yi), (xx, yy)) - stack.append((xx, yy)) - - res.append((y, x, yi, xi)) - - return res \ No newline at end of file diff --git a/2116-count-number-of-pairs-with-absolute-difference-k/2022-09-20 14.27.22 - Accepted - runtime 456ms - memory 14MB.py b/2116-count-number-of-pairs-with-absolute-difference-k/2022-09-20 14.27.22 - Accepted - runtime 456ms - memory 14MB.py deleted file mode 100644 index fa220e9..0000000 --- a/2116-count-number-of-pairs-with-absolute-difference-k/2022-09-20 14.27.22 - Accepted - runtime 456ms - memory 14MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def countKDifference(self, nums: list[int], k: int) -> int: - r = 0 - l = len(nums) - for i in range(l): - for j in range(i, l): - if i == j:continue - r += abs(nums[i] - nums[j]) == k - - return r \ No newline at end of file diff --git a/2121-find-if-path-exists-in-graph/2024-04-21 09.28.47 - Accepted - runtime 1606ms - memory 108.8MB.py b/2121-find-if-path-exists-in-graph/2024-04-21 09.28.47 - Accepted - runtime 1606ms - memory 108.8MB.py deleted file mode 100644 index 474554a..0000000 --- a/2121-find-if-path-exists-in-graph/2024-04-21 09.28.47 - Accepted - runtime 1606ms - memory 108.8MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def validPath(self, n: int, edges: List[List[int]], src: int, dst: int) -> bool: - l = defaultdict(list) - for a,b in edges: - l[a].append(b) - l[b].append(a) - stack = [src] - while stack: - n = stack.pop() - if n == dst: return True - while l[n]:stack.append(l[n].pop()) - - - return False \ No newline at end of file diff --git a/2128-reverse-prefix-of-word/2024-05-01 09.31.24 - Accepted - runtime 34ms - memory 16.5MB.py b/2128-reverse-prefix-of-word/2024-05-01 09.31.24 - Accepted - runtime 34ms - memory 16.5MB.py deleted file mode 100644 index 75a5472..0000000 --- a/2128-reverse-prefix-of-word/2024-05-01 09.31.24 - Accepted - runtime 34ms - memory 16.5MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def reversePrefix(self, word: str, ch: str) -> str: - t = word.find(ch) - return word[:t + 1][::-1] + word[t + 1:] \ No newline at end of file diff --git a/2137-final-value-of-variable-after-performing-operations/2022-08-01 16.09.56 - Accepted - runtime 96ms - memory 13.8MB.py b/2137-final-value-of-variable-after-performing-operations/2022-08-01 16.09.56 - Accepted - runtime 96ms - memory 13.8MB.py deleted file mode 100644 index 7d1f61b..0000000 --- a/2137-final-value-of-variable-after-performing-operations/2022-08-01 16.09.56 - Accepted - runtime 96ms - memory 13.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def finalValueAfterOperations(self, operations: List[str]) -> int: - x = 0 - for i in operations: - x += 1 if '+' in i else -1 - - return x \ No newline at end of file diff --git a/215-kth-largest-element-in-an-array/2022-06-22 18.12.39 - Accepted - runtime 1327ms - memory 14.7MB.py b/215-kth-largest-element-in-an-array/2022-06-22 18.12.39 - Accepted - runtime 1327ms - memory 14.7MB.py deleted file mode 100644 index 599605f..0000000 --- a/215-kth-largest-element-in-an-array/2022-06-22 18.12.39 - Accepted - runtime 1327ms - memory 14.7MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def findKthLargest(self, nums: List[int], k: int) -> int: - for i in range(k - 1): - nums.remove(max(nums)) - - return max(nums) \ No newline at end of file diff --git a/2154-minimum-moves-to-convert-string/2024-01-06 18.28.41 - Accepted - runtime 34ms - memory 17.3MB.py b/2154-minimum-moves-to-convert-string/2024-01-06 18.28.41 - Accepted - runtime 34ms - memory 17.3MB.py deleted file mode 100644 index 99d5fa6..0000000 --- a/2154-minimum-moves-to-convert-string/2024-01-06 18.28.41 - Accepted - runtime 34ms - memory 17.3MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def minimumMoves(self, s: str) -> int: - r = i = 0 - l = len(s) - while i < l: - if s[i] == 'X': - r += 1 - i += 3 - else: - i += 1 - return r \ No newline at end of file diff --git a/217-contains-duplicate/2022-06-29 13.33.09 - Accepted - runtime 722ms - memory 26.1MB.py b/217-contains-duplicate/2022-06-29 13.33.09 - Accepted - runtime 722ms - memory 26.1MB.py deleted file mode 100644 index b4eee98..0000000 --- a/217-contains-duplicate/2022-06-29 13.33.09 - Accepted - runtime 722ms - memory 26.1MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def containsDuplicate(self, nums: List[int]) -> bool: - return not len(nums) == len(set(nums)) \ No newline at end of file diff --git a/2181-smallest-index-with-equal-value/2022-09-26 17.46.15 - Accepted - runtime 90ms - memory 13.8MB.py b/2181-smallest-index-with-equal-value/2022-09-26 17.46.15 - Accepted - runtime 90ms - memory 13.8MB.py deleted file mode 100644 index f10e996..0000000 --- a/2181-smallest-index-with-equal-value/2022-09-26 17.46.15 - Accepted - runtime 90ms - memory 13.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def smallestEqual(self, nums: List[int]) -> int: - for i in range(len(nums)): - if i % 10 == nums[i]: - return i - - return -1 \ No newline at end of file diff --git a/219-contains-duplicate-ii/2022-06-29 13.49.16 - Accepted - runtime 588ms - memory 27.2MB.py b/219-contains-duplicate-ii/2022-06-29 13.49.16 - Accepted - runtime 588ms - memory 27.2MB.py deleted file mode 100644 index ccb78fb..0000000 --- a/219-contains-duplicate-ii/2022-06-29 13.49.16 - Accepted - runtime 588ms - memory 27.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool: - d = {} - for i, val in enumerate(nums): - if val in d and i - d[val] <= k: - return True - d[val] = i - - return False \ No newline at end of file diff --git a/2195-time-needed-to-buy-tickets/2024-04-09 09.56.41 - Accepted - runtime 47ms - memory 16.8MB.py b/2195-time-needed-to-buy-tickets/2024-04-09 09.56.41 - Accepted - runtime 47ms - memory 16.8MB.py deleted file mode 100644 index b8df2e9..0000000 --- a/2195-time-needed-to-buy-tickets/2024-04-09 09.56.41 - Accepted - runtime 47ms - memory 16.8MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def timeRequiredToBuy(self, tickets: List[int], k: int) -> int: - res = 0 - l = len(tickets) - while tickets[k]: - for ind in range(l): - if tickets[ind]: - res += 1 - tickets[ind] -= 1 - if not tickets[k]: - return res - - - return res \ No newline at end of file diff --git a/22-generate-parentheses/2022-07-11 23.32.50 - Accepted - runtime 68ms - memory 14.2MB.py b/22-generate-parentheses/2022-07-11 23.32.50 - Accepted - runtime 68ms - memory 14.2MB.py deleted file mode 100644 index 2224baa..0000000 --- a/22-generate-parentheses/2022-07-11 23.32.50 - Accepted - runtime 68ms - memory 14.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def generateParenthesis(self, n: int) -> List[str]: - if n == 0: return [''] - ans = [] - for c in range(n): - for left in self.generateParenthesis(c): - for right in self.generateParenthesis(n-1-c): - ans.append('({}){}'.format(left, right)) - return ans \ No newline at end of file diff --git a/22-generate-parentheses/2022-07-13 03.51.05 - Accepted - runtime 73ms - memory 14.1MB.py b/22-generate-parentheses/2022-07-13 03.51.05 - Accepted - runtime 73ms - memory 14.1MB.py deleted file mode 100644 index f486266..0000000 --- a/22-generate-parentheses/2022-07-13 03.51.05 - Accepted - runtime 73ms - memory 14.1MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def generateParenthesis(self, n: int) -> List[str]: - def solve(p: str, left: int, right: int, res: List[str] = []) -> List[str]: - if left:solve(p + '(', left - 1, right) - if right > left:solve(p + ')', left, right - 1) - if not right:res += p, - return res - - return solve('', n, n) \ No newline at end of file diff --git a/2204-find-subsequence-of-length-k-with-the-largest-sum/2024-01-24 21.21.44 - Accepted - runtime 50ms - memory 16.8MB.py b/2204-find-subsequence-of-length-k-with-the-largest-sum/2024-01-24 21.21.44 - Accepted - runtime 50ms - memory 16.8MB.py deleted file mode 100644 index b046203..0000000 --- a/2204-find-subsequence-of-length-k-with-the-largest-sum/2024-01-24 21.21.44 - Accepted - runtime 50ms - memory 16.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def maxSubsequence(self, nums: List[int], k: int) -> List[int]: - return [f[1] for f in sorted(sorted(enumerate(nums), key=lambda x:x[1])[-k:])] \ No newline at end of file diff --git a/2219-maximum-number-of-words-found-in-sentences/2022-08-01 16.17.28 - Accepted - runtime 52ms - memory 13.8MB.py b/2219-maximum-number-of-words-found-in-sentences/2022-08-01 16.17.28 - Accepted - runtime 52ms - memory 13.8MB.py deleted file mode 100644 index 58d1c67..0000000 --- a/2219-maximum-number-of-words-found-in-sentences/2022-08-01 16.17.28 - Accepted - runtime 52ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def mostWordsFound(self, sentences: List[str]) -> int: - return max(f.count(' ')+1 for f in sentences) \ No newline at end of file diff --git a/222-count-complete-tree-nodes/2024-02-18 22.16.50 - Accepted - runtime 23ms - memory 29.2MB.cpp b/222-count-complete-tree-nodes/2024-02-18 22.16.50 - Accepted - runtime 23ms - memory 29.2MB.cpp deleted file mode 100644 index 4225a0d..0000000 --- a/222-count-complete-tree-nodes/2024-02-18 22.16.50 - Accepted - runtime 23ms - memory 29.2MB.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int countNodes(TreeNode* root) { - stack st; - if (root) st.push(root); - int res = 0; - while (!st.empty()){ - TreeNode* n = st.top(); st.pop(); res++; - if (n -> left) st.push(n -> left); - if (n -> right) st.push(n -> right); - } - return res; - } -}; \ No newline at end of file diff --git a/222-count-complete-tree-nodes/2024-02-18 22.19.10 - Accepted - runtime 24ms - memory 29.1MB.cpp b/222-count-complete-tree-nodes/2024-02-18 22.19.10 - Accepted - runtime 24ms - memory 29.1MB.cpp deleted file mode 100644 index 7df6dcc..0000000 --- a/222-count-complete-tree-nodes/2024-02-18 22.19.10 - Accepted - runtime 24ms - memory 29.1MB.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int countNodes(TreeNode* root) { - if(root == NULL) return 0; - return countNodes(root->left) + countNodes(root->right) + 1; - } -}; \ No newline at end of file diff --git a/2231-find-first-palindromic-string-in-the-array/2022-09-20 20.00.13 - Accepted - runtime 111ms - memory 13.9MB.py b/2231-find-first-palindromic-string-in-the-array/2022-09-20 20.00.13 - Accepted - runtime 111ms - memory 13.9MB.py deleted file mode 100644 index 195bc64..0000000 --- a/2231-find-first-palindromic-string-in-the-array/2022-09-20 20.00.13 - Accepted - runtime 111ms - memory 13.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def firstPalindrome(self, words: List[str]) -> str: - for word in words: - if word == word[::-1]: - return word - return '' \ No newline at end of file diff --git a/2238-a-number-after-a-double-reversal/2022-07-21 16.18.20 - Accepted - runtime 46ms - memory 13.9MB.py b/2238-a-number-after-a-double-reversal/2022-07-21 16.18.20 - Accepted - runtime 46ms - memory 13.9MB.py deleted file mode 100644 index d6d2a26..0000000 --- a/2238-a-number-after-a-double-reversal/2022-07-21 16.18.20 - Accepted - runtime 46ms - memory 13.9MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def isSameAfterReversals(self, num: int) -> bool: - a = int(str(num)[::-1]) - return str(a)[::-1] == str(num) \ No newline at end of file diff --git a/224-basic-calculator/2024-04-10 00.28.35 - Accepted - runtime 272ms - memory 18.1MB.py b/224-basic-calculator/2024-04-10 00.28.35 - Accepted - runtime 272ms - memory 18.1MB.py deleted file mode 100644 index 1b6ba08..0000000 --- a/224-basic-calculator/2024-04-10 00.28.35 - Accepted - runtime 272ms - memory 18.1MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def calculate(self, s: str) -> int: - from re import compile, findall - regex = compile(r'\([^\(\)]+\)') - while a := findall(regex, s): - for i in a: - s = s.replace(i, str(eval(i))) - - - return eval(s) \ No newline at end of file diff --git a/2243-check-if-all-as-appears-before-all-bs/2022-07-21 16.16.47 - Accepted - runtime 58ms - memory 14MB.py b/2243-check-if-all-as-appears-before-all-bs/2022-07-21 16.16.47 - Accepted - runtime 58ms - memory 14MB.py deleted file mode 100644 index ae1ef98..0000000 --- a/2243-check-if-all-as-appears-before-all-bs/2022-07-21 16.16.47 - Accepted - runtime 58ms - memory 14MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def checkString(self, s: str) -> bool: - return ''.join(sorted(s)) == s - \ No newline at end of file diff --git a/2248-minimum-cost-of-buying-candies-with-discount/2022-07-21 16.14.47 - Accepted - runtime 79ms - memory 13.8MB.py b/2248-minimum-cost-of-buying-candies-with-discount/2022-07-21 16.14.47 - Accepted - runtime 79ms - memory 13.8MB.py deleted file mode 100644 index 7ec304d..0000000 --- a/2248-minimum-cost-of-buying-candies-with-discount/2022-07-21 16.14.47 - Accepted - runtime 79ms - memory 13.8MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minimumCost(self, cost: List[int]) -> int: - heapq._heapify_max(cost) - res = 0 - for i in range(1, len(cost) + 1): - if i % 3:res += heapq._heappop_max(cost) - else:heapq._heappop_max(cost) - - return res \ No newline at end of file diff --git a/225-implement-stack-using-queues/2022-07-18 12.55.34 - Accepted - runtime 38ms - memory 14MB.py b/225-implement-stack-using-queues/2022-07-18 12.55.34 - Accepted - runtime 38ms - memory 14MB.py deleted file mode 100644 index 662d896..0000000 --- a/225-implement-stack-using-queues/2022-07-18 12.55.34 - Accepted - runtime 38ms - memory 14MB.py +++ /dev/null @@ -1,24 +0,0 @@ -class MyStack: - - def __init__(self): - self.stack = [] - - def push(self, x: int) -> None: - self.stack.append(x) - - def pop(self) -> int: - return self.stack.pop() - - def top(self) -> int: - return self.stack[-1] - - def empty(self) -> bool: - return not self.stack - - -# Your MyStack object will be instantiated and called as such: -# obj = MyStack() -# obj.push(x) -# param_2 = obj.pop() -# param_3 = obj.top() -# param_4 = obj.empty() \ No newline at end of file diff --git a/2254-check-if-every-row-and-column-contains-all-numbers/2022-07-21 16.13.49 - Accepted - runtime 1170ms - memory 14.4MB.py b/2254-check-if-every-row-and-column-contains-all-numbers/2022-07-21 16.13.49 - Accepted - runtime 1170ms - memory 14.4MB.py deleted file mode 100644 index 46de452..0000000 --- a/2254-check-if-every-row-and-column-contains-all-numbers/2022-07-21 16.13.49 - Accepted - runtime 1170ms - memory 14.4MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def checkValid(self, matrix: List[List[int]]) -> bool: - a = [*range(1, len(matrix) + 1)] - return all(sorted(f)==a for f in matrix) and all(sorted(f)==a for f in zip(*matrix)) \ No newline at end of file diff --git a/226-invert-binary-tree/2022-06-30 14.48.00 - Accepted - runtime 58ms - memory 13.9MB.py b/226-invert-binary-tree/2022-06-30 14.48.00 - Accepted - runtime 58ms - memory 13.9MB.py deleted file mode 100644 index 07cf187..0000000 --- a/226-invert-binary-tree/2022-06-30 14.48.00 - Accepted - runtime 58ms - memory 13.9MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def invert(self, node: TreeNode) -> TreeNode: - node.left, node.right = node.right, node.left - for node in (node.left, node.right): - if node:self.invert(node) - - def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - if not root: return None - self.invert(root) - - return root \ No newline at end of file diff --git a/226-invert-binary-tree/2022-06-30 14.51.01 - Accepted - runtime 52ms - memory 13.7MB.py b/226-invert-binary-tree/2022-06-30 14.51.01 - Accepted - runtime 52ms - memory 13.7MB.py deleted file mode 100644 index b1a1002..0000000 --- a/226-invert-binary-tree/2022-06-30 14.51.01 - Accepted - runtime 52ms - memory 13.7MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - if root: - root.left, root.right = self.invertTree(root.right), self.invertTree(root.left) - return root \ No newline at end of file diff --git a/226-invert-binary-tree/2024-01-14 23.33.43 - Accepted - runtime 29ms - memory 17.5MB.py b/226-invert-binary-tree/2024-01-14 23.33.43 - Accepted - runtime 29ms - memory 17.5MB.py deleted file mode 100644 index c1d574b..0000000 --- a/226-invert-binary-tree/2024-01-14 23.33.43 - Accepted - runtime 29ms - memory 17.5MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - if not root: - return None - stack = [root] - while stack: - n = stack.pop() - n.left, n.right = n.right, n.left - for i in (n.left, n.right): - if i: - stack.append(i) - return root \ No newline at end of file diff --git a/226-invert-binary-tree/2024-02-17 16.02.51 - Accepted - runtime 5ms - memory 11.3MB.cpp b/226-invert-binary-tree/2024-02-17 16.02.51 - Accepted - runtime 5ms - memory 11.3MB.cpp deleted file mode 100644 index b38d53f..0000000 --- a/226-invert-binary-tree/2024-02-17 16.02.51 - Accepted - runtime 5ms - memory 11.3MB.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - TreeNode* invertTree(TreeNode* root) { - if (!root) return root; - TreeNode* temp = root -> left; - root -> left = root -> right; - root -> right = temp; - invertTree(root -> left); - invertTree(root -> right); - return root; - } -}; \ No newline at end of file diff --git a/226-invert-binary-tree/2024-02-18 17.48.32 - Accepted - runtime 5ms - memory 11.4MB.cpp b/226-invert-binary-tree/2024-02-18 17.48.32 - Accepted - runtime 5ms - memory 11.4MB.cpp deleted file mode 100644 index 0f51cf7..0000000 --- a/226-invert-binary-tree/2024-02-18 17.48.32 - Accepted - runtime 5ms - memory 11.4MB.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - TreeNode* invertTree(TreeNode* root) { - if (!root) return root; - swap(root -> left, root -> right); - invertTree(root -> left); - invertTree(root -> right); - return root; - } -}; \ No newline at end of file diff --git a/2260-divide-a-string-into-groups-of-size-k/2022-07-21 16.10.25 - Accepted - runtime 60ms - memory 14MB.py b/2260-divide-a-string-into-groups-of-size-k/2022-07-21 16.10.25 - Accepted - runtime 60ms - memory 14MB.py deleted file mode 100644 index d952f7b..0000000 --- a/2260-divide-a-string-into-groups-of-size-k/2022-07-21 16.10.25 - Accepted - runtime 60ms - memory 14MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def divideString(self, s: str, k: int, fill: str) -> List[str]: - import textwrap - return [f'{f:{fill}<{k}}' for f in textwrap.wrap(s, k)] \ No newline at end of file diff --git a/2264-minimum-sum-of-four-digit-number-after-splitting-digits/2022-07-21 16.09.50 - Accepted - runtime 48ms - memory 13.9MB.py b/2264-minimum-sum-of-four-digit-number-after-splitting-digits/2022-07-21 16.09.50 - Accepted - runtime 48ms - memory 13.9MB.py deleted file mode 100644 index b2919bc..0000000 --- a/2264-minimum-sum-of-four-digit-number-after-splitting-digits/2022-07-21 16.09.50 - Accepted - runtime 48ms - memory 13.9MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def minimumSum(self, num: int) -> int: - a,b,c,d = sorted(str(num)) - return int(a + c) + int(b + d) \ No newline at end of file diff --git a/227-basic-calculator-ii/2024-03-31 22.27.01 - Accepted - runtime 130ms - memory 107.7MB.py b/227-basic-calculator-ii/2024-03-31 22.27.01 - Accepted - runtime 130ms - memory 107.7MB.py deleted file mode 100644 index b0c60c9..0000000 --- a/227-basic-calculator-ii/2024-03-31 22.27.01 - Accepted - runtime 130ms - memory 107.7MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def calculate(self, s: str) -> int: - return int(eval(s.replace('/', '//'))) diff --git a/2274-keep-multiplying-found-values-by-two/2022-07-21 16.06.16 - Accepted - runtime 80ms - memory 14MB.py b/2274-keep-multiplying-found-values-by-two/2022-07-21 16.06.16 - Accepted - runtime 80ms - memory 14MB.py deleted file mode 100644 index e9c420b..0000000 --- a/2274-keep-multiplying-found-values-by-two/2022-07-21 16.06.16 - Accepted - runtime 80ms - memory 14MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def findFinalValue(self, nums: List[int], original: int) -> int: - while original in nums: - original *= 2 - return original \ No newline at end of file diff --git a/228-summary-ranges/2023-04-30 00.03.40 - Accepted - runtime 43ms - memory 16.3MB.py b/228-summary-ranges/2023-04-30 00.03.40 - Accepted - runtime 43ms - memory 16.3MB.py deleted file mode 100644 index 3928a2c..0000000 --- a/228-summary-ranges/2023-04-30 00.03.40 - Accepted - runtime 43ms - memory 16.3MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def summaryRanges(self, nums: List[int]) -> List[str]: - if not nums: - return [] - l = [] - s = e = nums[0] - for i in range(1, len(nums)): - if nums[i] - 1 == e: - e += 1 - else: - if s != e: - l.append(f'{s}->{e}') - else: - l.append(str(s)) - s = e = nums[i] - - if s != e: - l.append(f'{s}->{e}') - else: - l.append(str(s)) - return l \ No newline at end of file diff --git a/2283-sort-even-and-odd-indices-independently/2022-07-21 10.57.31 - Accepted - runtime 114ms - memory 13.8MB.py b/2283-sort-even-and-odd-indices-independently/2022-07-21 10.57.31 - Accepted - runtime 114ms - memory 13.8MB.py deleted file mode 100644 index 38e85b7..0000000 --- a/2283-sort-even-and-odd-indices-independently/2022-07-21 10.57.31 - Accepted - runtime 114ms - memory 13.8MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def sortEvenOdd(self, nums: List[int]) -> List[int]: - a, b = sorted(nums[::2]), sorted(nums[1::2])[::-1] - c = [] - t = 0 - while a or b: - if t % 2 == 0 and a:c.append(a.pop(0)) - else:c.append(b.pop(0)) - t += 1 - return c \ No newline at end of file diff --git a/2288-count-operations-to-obtain-zero/2022-09-26 17.17.47 - Accepted - runtime 298ms - memory 13.8MB.py b/2288-count-operations-to-obtain-zero/2022-09-26 17.17.47 - Accepted - runtime 298ms - memory 13.8MB.py deleted file mode 100644 index e43cd23..0000000 --- a/2288-count-operations-to-obtain-zero/2022-09-26 17.17.47 - Accepted - runtime 298ms - memory 13.8MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def countOperations(self, num1: int, num2: int) -> int: - r = 0 - while num1 and num2: - if num1 > num2: - num1 -= num2 - else: - num2 -= num1 - r += 1 - - return r \ No newline at end of file diff --git a/2288-count-operations-to-obtain-zero/2022-09-26 17.22.57 - Accepted - runtime 229ms - memory 13.9MB.py b/2288-count-operations-to-obtain-zero/2022-09-26 17.22.57 - Accepted - runtime 229ms - memory 13.9MB.py deleted file mode 100644 index 57f1291..0000000 --- a/2288-count-operations-to-obtain-zero/2022-09-26 17.22.57 - Accepted - runtime 229ms - memory 13.9MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def countOperations(self, num1: int, num2: int) -> int: - operations = 0 - while num1 and num2: - if num1 > num2: - num1 -= num2 - else: - num2 -= num1 - operations += 1 - - return operations \ No newline at end of file diff --git a/2294-minimum-time-to-complete-trips/2023-03-07 23.25.17 - Accepted - runtime 1858ms - memory 28.3MB.py b/2294-minimum-time-to-complete-trips/2023-03-07 23.25.17 - Accepted - runtime 1858ms - memory 28.3MB.py deleted file mode 100644 index be06367..0000000 --- a/2294-minimum-time-to-complete-trips/2023-03-07 23.25.17 - Accepted - runtime 1858ms - memory 28.3MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def minimumTime(self, time: List[int], totalTrips: int) -> int: - lo, hi = 1, min(time) * totalTrips - - while lo < hi: - mid = (lo + hi) // 2 - if sum(mid // f for f in time) >= totalTrips:hi = mid - else:lo = mid + 1 - - return lo - \ No newline at end of file diff --git a/23-merge-k-sorted-lists/2023-03-12 11.19.48 - Accepted - runtime 81ms - memory 18.4MB.py b/23-merge-k-sorted-lists/2023-03-12 11.19.48 - Accepted - runtime 81ms - memory 18.4MB.py deleted file mode 100644 index 21b9fd2..0000000 --- a/23-merge-k-sorted-lists/2023-03-12 11.19.48 - Accepted - runtime 81ms - memory 18.4MB.py +++ /dev/null @@ -1,24 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]: - l = [] - r = 0 - for i in lists: - while i: - heapq.heappush(l, i.val) - i = i.next - r += 1 - - if not r: - return None - - res = curr = ListNode(heapq.heappop(l)) - for i in range(r - 1): - curr.next = ListNode(heapq.heappop(l)) - curr = curr.next - - return res \ No newline at end of file diff --git a/23-merge-k-sorted-lists/2023-03-13 14.17.22 - Accepted - runtime 103ms - memory 18.4MB.py b/23-merge-k-sorted-lists/2023-03-13 14.17.22 - Accepted - runtime 103ms - memory 18.4MB.py deleted file mode 100644 index fa756f9..0000000 --- a/23-merge-k-sorted-lists/2023-03-13 14.17.22 - Accepted - runtime 103ms - memory 18.4MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]: - l = [] - r = 0 - for i in lists: - while i: - heapq.heappush(l, i.val) - r += 1 - i = i.next - - dummy = curr = ListNode() - for i in range(r): - curr.next = ListNode(heapq.heappop(l)) - curr = curr.next - - return dummy.next \ No newline at end of file diff --git a/2304-cells-in-a-range-on-an-excel-sheet/2022-08-01 21.40.30 - Accepted - runtime 80ms - memory 13.8MB.py b/2304-cells-in-a-range-on-an-excel-sheet/2022-08-01 21.40.30 - Accepted - runtime 80ms - memory 13.8MB.py deleted file mode 100644 index 4800e6e..0000000 --- a/2304-cells-in-a-range-on-an-excel-sheet/2022-08-01 21.40.30 - Accepted - runtime 80ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def cellsInRange(self, s: str) -> List[str]: - return [f'{chr(i)}{j}'for i in range(ord(s[0]), ord(s[3]) + 1)for j in range(int(s[1]), int(s[4]) + 1)] \ No newline at end of file diff --git a/2308-divide-array-into-equal-pairs/2022-07-21 16.04.41 - Accepted - runtime 146ms - memory 14.1MB.py b/2308-divide-array-into-equal-pairs/2022-07-21 16.04.41 - Accepted - runtime 146ms - memory 14.1MB.py deleted file mode 100644 index 21a84b0..0000000 --- a/2308-divide-array-into-equal-pairs/2022-07-21 16.04.41 - Accepted - runtime 146ms - memory 14.1MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def divideArray(self, nums: List[int]) -> bool: - nums.sort() - s, e = 0, 2 - l = len(nums) - if l % 2: return False - while e <= l: - a,b = nums[s:e] - if a != b: return False - s += 2 - e += 2 - - return True - \ No newline at end of file diff --git a/231-power-of-two/2022-06-30 21.54.52 - Accepted - runtime 92ms - memory 13.9MB.py b/231-power-of-two/2022-06-30 21.54.52 - Accepted - runtime 92ms - memory 13.9MB.py deleted file mode 100644 index 0740c61..0000000 --- a/231-power-of-two/2022-06-30 21.54.52 - Accepted - runtime 92ms - memory 13.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def isPowerOfTwo(self, n: int) -> bool: - for i in range(32): - if 2 ** i == n: - return True - return False \ No newline at end of file diff --git a/231-power-of-two/2022-06-30 21.56.09 - Accepted - runtime 49ms - memory 14MB.py b/231-power-of-two/2022-06-30 21.56.09 - Accepted - runtime 49ms - memory 14MB.py deleted file mode 100644 index cd3b3c9..0000000 --- a/231-power-of-two/2022-06-30 21.56.09 - Accepted - runtime 49ms - memory 14MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def isPowerOfTwo(self, n: int) -> bool: - return n and not (n & n - 1) \ No newline at end of file diff --git a/232-implement-queue-using-stacks/2022-12-16 23.03.17 - Accepted - runtime 33ms - memory 14MB.py b/232-implement-queue-using-stacks/2022-12-16 23.03.17 - Accepted - runtime 33ms - memory 14MB.py deleted file mode 100644 index 77a8f60..0000000 --- a/232-implement-queue-using-stacks/2022-12-16 23.03.17 - Accepted - runtime 33ms - memory 14MB.py +++ /dev/null @@ -1,24 +0,0 @@ -class MyQueue: - - def __init__(self): - self.queue = [] - - def push(self, x: int) -> None: - self.queue.append(x) - - def pop(self) -> int: - return self.queue.pop(0) - - def peek(self) -> int: - return self.queue[0] - - def empty(self) -> bool: - return not bool(self.queue) - - -# Your MyQueue object will be instantiated and called as such: -# obj = MyQueue() -# obj.push(x) -# param_2 = obj.pop() -# param_3 = obj.peek() -# param_4 = obj.empty() \ No newline at end of file diff --git a/2331-intersection-of-multiple-arrays/2023-11-27 21.02.15 - Accepted - runtime 65ms - memory 17MB.py b/2331-intersection-of-multiple-arrays/2023-11-27 21.02.15 - Accepted - runtime 65ms - memory 17MB.py deleted file mode 100644 index 838232f..0000000 --- a/2331-intersection-of-multiple-arrays/2023-11-27 21.02.15 - Accepted - runtime 65ms - memory 17MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def intersection(self, nums: List[List[int]]) -> List[int]: - l = list(map(set, nums)) - t = l[0] - for i in l[1:]: - t = t.intersection(i) - return sorted(t) - \ No newline at end of file diff --git a/2337-remove-digit-from-number-to-maximize-result/2023-11-26 19.09.22 - Accepted - runtime 38ms - memory 16.2MB.py b/2337-remove-digit-from-number-to-maximize-result/2023-11-26 19.09.22 - Accepted - runtime 38ms - memory 16.2MB.py deleted file mode 100644 index 7228a40..0000000 --- a/2337-remove-digit-from-number-to-maximize-result/2023-11-26 19.09.22 - Accepted - runtime 38ms - memory 16.2MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def removeDigit(self, number: str, digit: str) -> str: - l = [number[1:]] if number[0] == digit else [] - for i in range(1, len(number)): - if number[i] == digit: - l.append(number[:i] + number[i + 1: ]) - return max(l) \ No newline at end of file diff --git a/2337-remove-digit-from-number-to-maximize-result/2023-11-26 19.12.59 - Accepted - runtime 48ms - memory 16.4MB.py b/2337-remove-digit-from-number-to-maximize-result/2023-11-26 19.12.59 - Accepted - runtime 48ms - memory 16.4MB.py deleted file mode 100644 index b884cf0..0000000 --- a/2337-remove-digit-from-number-to-maximize-result/2023-11-26 19.12.59 - Accepted - runtime 48ms - memory 16.4MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def removeDigit(self, number: str, digit: str) -> str: - l = number[1:] if number[0] == digit else '' - for i in range(1, len(number)): - if number[i] == digit: - l = max(l, number[:i] + number[i + 1: ]) - return l \ No newline at end of file diff --git a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.11.38 - Accepted - runtime 670ms - memory 35.7MB.py b/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.11.38 - Accepted - runtime 670ms - memory 35.7MB.py deleted file mode 100644 index 2cea5c5..0000000 --- a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.11.38 - Accepted - runtime 670ms - memory 35.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minimumCardPickup(self, cards: List[int]) -> int: - res, pos = 10**6+1, {} - for i, c in enumerate(cards): - if c in pos: - res = min(res, i - pos[c] + 1) - pos[c] = i - - return res % (10**6+1) or -1 \ No newline at end of file diff --git a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.08 - Accepted - runtime 706ms - memory 35.7MB.py b/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.08 - Accepted - runtime 706ms - memory 35.7MB.py deleted file mode 100644 index 629ce83..0000000 --- a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.08 - Accepted - runtime 706ms - memory 35.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minimumCardPickup(self, cards: List[int]) -> int: - res, r = 10e7, {} - for i in range(len(cards)): - if cards[i] in r: - res = min(res, i - r[cards[i]] + 1) - r[cards[i]] = i - - return res if res != 10e7 else -1 \ No newline at end of file diff --git a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.19 - Accepted - runtime 710ms - memory 35.7MB.py b/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.19 - Accepted - runtime 710ms - memory 35.7MB.py deleted file mode 100644 index 629ce83..0000000 --- a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.19 - Accepted - runtime 710ms - memory 35.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minimumCardPickup(self, cards: List[int]) -> int: - res, r = 10e7, {} - for i in range(len(cards)): - if cards[i] in r: - res = min(res, i - r[cards[i]] + 1) - r[cards[i]] = i - - return res if res != 10e7 else -1 \ No newline at end of file diff --git a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.34 - Accepted - runtime 701ms - memory 35.9MB.py b/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.34 - Accepted - runtime 701ms - memory 35.9MB.py deleted file mode 100644 index 629ce83..0000000 --- a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.34 - Accepted - runtime 701ms - memory 35.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minimumCardPickup(self, cards: List[int]) -> int: - res, r = 10e7, {} - for i in range(len(cards)): - if cards[i] in r: - res = min(res, i - r[cards[i]] + 1) - r[cards[i]] = i - - return res if res != 10e7 else -1 \ No newline at end of file diff --git a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.52 - Accepted - runtime 699ms - memory 35.7MB.py b/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.52 - Accepted - runtime 699ms - memory 35.7MB.py deleted file mode 100644 index 629ce83..0000000 --- a/2338-minimum-consecutive-cards-to-pick-up/2023-11-26 20.22.52 - Accepted - runtime 699ms - memory 35.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minimumCardPickup(self, cards: List[int]) -> int: - res, r = 10e7, {} - for i in range(len(cards)): - if cards[i] in r: - res = min(res, i - r[cards[i]] + 1) - r[cards[i]] = i - - return res if res != 10e7 else -1 \ No newline at end of file diff --git a/234-palindrome-linked-list/2022-06-29 13.25.53 - Accepted - runtime 859ms - memory 46.5MB.py b/234-palindrome-linked-list/2022-06-29 13.25.53 - Accepted - runtime 859ms - memory 46.5MB.py deleted file mode 100644 index 2da72e6..0000000 --- a/234-palindrome-linked-list/2022-06-29 13.25.53 - Accepted - runtime 859ms - memory 46.5MB.py +++ /dev/null @@ -1,12 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def isPalindrome(self, head: Optional[ListNode]) -> bool: - nodes = [] - while head: - nodes.append(head.val) - head = head.next - return nodes == nodes[::-1] \ No newline at end of file diff --git a/234-palindrome-linked-list/2024-03-22 13.00.58 - Accepted - runtime 308ms - memory 36.4MB.py b/234-palindrome-linked-list/2024-03-22 13.00.58 - Accepted - runtime 308ms - memory 36.4MB.py deleted file mode 100644 index 1cafbeb..0000000 --- a/234-palindrome-linked-list/2024-03-22 13.00.58 - Accepted - runtime 308ms - memory 36.4MB.py +++ /dev/null @@ -1,12 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def isPalindrome(self, head: Optional[ListNode]) -> bool: - s = [] - while head: - s.append(head.val) - head = head.next - return s == s[::-1] \ No newline at end of file diff --git a/234-palindrome-linked-list/2024-03-22 13.01.45 - Accepted - runtime 41ms - memory 17.3MB.py b/234-palindrome-linked-list/2024-03-22 13.01.45 - Accepted - runtime 41ms - memory 17.3MB.py deleted file mode 100644 index e8f17a3..0000000 --- a/234-palindrome-linked-list/2024-03-22 13.01.45 - Accepted - runtime 41ms - memory 17.3MB.py +++ /dev/null @@ -1,10 +0,0 @@ -import sys - -with open('user.out', 'w') as f: - while True: - line = sys.stdin.readline().strip()[1:-1] - if not line: - break - f.write('true\n' if line == line[::-1] else 'false\n') - -exit(0) \ No newline at end of file diff --git a/2347-count-nodes-equal-to-average-of-subtree/2024-02-19 20.58.58 - Accepted - runtime 45ms - memory 16.8MB.py b/2347-count-nodes-equal-to-average-of-subtree/2024-02-19 20.58.58 - Accepted - runtime 45ms - memory 16.8MB.py deleted file mode 100644 index 75efe64..0000000 --- a/2347-count-nodes-equal-to-average-of-subtree/2024-02-19 20.58.58 - Accepted - runtime 45ms - memory 16.8MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def __init__(self): - self.res = 0 - def traverse(self, n): - if not n: return 0, 0 - ls, lc = self.traverse(n.left) - rs, rc = self.traverse(n.right) - s, c = ls + rs + n.val, lc + rc + 1 - self.res += s // c == n.val - return s, c - - def averageOfSubtree(self, root: TreeNode) -> int: - self.traverse(root) - return self.res - \ No newline at end of file diff --git a/2347-count-nodes-equal-to-average-of-subtree/2024-02-19 21.08.46 - Accepted - runtime 10ms - memory 14.4MB.cpp b/2347-count-nodes-equal-to-average-of-subtree/2024-02-19 21.08.46 - Accepted - runtime 10ms - memory 14.4MB.cpp deleted file mode 100644 index ae656c3..0000000 --- a/2347-count-nodes-equal-to-average-of-subtree/2024-02-19 21.08.46 - Accepted - runtime 10ms - memory 14.4MB.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int res = 0; - tuple traverse(TreeNode* n){ - if (!n) return make_tuple(0, 0); - int ls, lc, rs, rc; - tie(ls, lc) = traverse(n -> left); - tie(rs, rc) = traverse(n -> right); - int s = ls + rs + n -> val, c = lc + rc + 1; - if (s / c == n -> val) res++; - return make_tuple(s, c); - - } - int averageOfSubtree(TreeNode* root) { - traverse(root); - return res; - } -}; \ No newline at end of file diff --git a/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.06.52 - Accepted - runtime 1381ms - memory 29.1MB.py b/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.06.52 - Accepted - runtime 1381ms - memory 29.1MB.py deleted file mode 100644 index 6940a4e..0000000 --- a/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.06.52 - Accepted - runtime 1381ms - memory 29.1MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class Solution: - def minimumRounds(self, tasks: List[int]) -> int: - c = collections.Counter(tasks) - res = 0 - for _, count in c.items(): - t = count - 3 - k = count - 4 - if count % 3 == 0: - res += count // 3 - elif (count % 3) % 2 == 0: - res += count // 3 + 1 - elif k > 0 and k % 3 == 0: - res += k // 3 + 2 - elif count % 2 == 0: - res += count // 2 - elif t > 0 and t % 2 == 0: - res += t // 2 + 1 - else: - return -1 - - return res \ No newline at end of file diff --git a/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.09.11 - Accepted - runtime 958ms - memory 28.3MB.py b/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.09.11 - Accepted - runtime 958ms - memory 28.3MB.py deleted file mode 100644 index 0a1e86e..0000000 --- a/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.09.11 - Accepted - runtime 958ms - memory 28.3MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def minimumRounds(self, tasks: List[int]) -> int: - c = Counter(tasks).values() - return -1 if 1 in c else sum((a + 2) // 3 for a in c) \ No newline at end of file diff --git a/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.09.41 - Accepted - runtime 1646ms - memory 28.4MB.py b/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.09.41 - Accepted - runtime 1646ms - memory 28.4MB.py deleted file mode 100644 index 0e14aa2..0000000 --- a/2362-minimum-rounds-to-complete-all-tasks/2023-01-05 00.09.41 - Accepted - runtime 1646ms - memory 28.4MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def minimumRounds(self, tasks: List[int]) -> int: - c = Counter(tasks).values() - return -1 if 1 in c else sum((f + 2) // 3 for f in c) \ No newline at end of file diff --git a/2365-percentage-of-letter-in-string/2022-09-26 14.58.00 - Accepted - runtime 57ms - memory 13.9MB.py b/2365-percentage-of-letter-in-string/2022-09-26 14.58.00 - Accepted - runtime 57ms - memory 13.9MB.py deleted file mode 100644 index 7f8110a..0000000 --- a/2365-percentage-of-letter-in-string/2022-09-26 14.58.00 - Accepted - runtime 57ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def percentageLetter(self, s: str, letter: str) -> int: - return int(s.count(letter) / len(s) * 100) \ No newline at end of file diff --git a/2365-percentage-of-letter-in-string/2022-09-26 14.58.50 - Accepted - runtime 58ms - memory 13.9MB.py b/2365-percentage-of-letter-in-string/2022-09-26 14.58.50 - Accepted - runtime 58ms - memory 13.9MB.py deleted file mode 100644 index 1e43283..0000000 --- a/2365-percentage-of-letter-in-string/2022-09-26 14.58.50 - Accepted - runtime 58ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def percentageLetter(self, s: str, letter: str) -> int: - return s.count(letter) * 100 // len(s) \ No newline at end of file diff --git a/2366-maximum-bags-with-full-capacity-of-rocks/2022-12-27 22.00.12 - Accepted - runtime 883ms - memory 22.3MB.py b/2366-maximum-bags-with-full-capacity-of-rocks/2022-12-27 22.00.12 - Accepted - runtime 883ms - memory 22.3MB.py deleted file mode 100644 index b4ef3cb..0000000 --- a/2366-maximum-bags-with-full-capacity-of-rocks/2022-12-27 22.00.12 - Accepted - runtime 883ms - memory 22.3MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def maximumBags(self, capacity: List[int], rocks: List[int], r: int) -> int: - res = 0 - for i in sorted(a - b for a,b in zip(capacity, rocks)): - r -= i - if r < 0: - return res - res += 1 - - return res \ No newline at end of file diff --git a/237-delete-node-in-a-linked-list/2022-06-29 14.30.04 - Accepted - runtime 68ms - memory 14.3MB.py b/237-delete-node-in-a-linked-list/2022-06-29 14.30.04 - Accepted - runtime 68ms - memory 14.3MB.py deleted file mode 100644 index c9c62d4..0000000 --- a/237-delete-node-in-a-linked-list/2022-06-29 14.30.04 - Accepted - runtime 68ms - memory 14.3MB.py +++ /dev/null @@ -1,10 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, x): -# self.val = x -# self.next = None - -class Solution: - def deleteNode(self, node): - node.val = node.next.val - node.next = node.next.next \ No newline at end of file diff --git a/237-delete-node-in-a-linked-list/2024-05-05 10.11.40 - Accepted - runtime 32ms - memory 16.8MB.py b/237-delete-node-in-a-linked-list/2024-05-05 10.11.40 - Accepted - runtime 32ms - memory 16.8MB.py deleted file mode 100644 index 7d2db18..0000000 --- a/237-delete-node-in-a-linked-list/2024-05-05 10.11.40 - Accepted - runtime 32ms - memory 16.8MB.py +++ /dev/null @@ -1,15 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, x): -# self.val = x -# self.next = None - -class Solution: - def deleteNode(self, node): - """ - :type node: ListNode - :rtype: void Do not return anything, modify node in-place instead. - """ - node.val = node.next.val - node.next = node.next.next - \ No newline at end of file diff --git a/2372-rearrange-characters-to-make-target-string/2023-01-26 14.33.08 - Accepted - runtime 33ms - memory 13.8MB.py b/2372-rearrange-characters-to-make-target-string/2023-01-26 14.33.08 - Accepted - runtime 33ms - memory 13.8MB.py deleted file mode 100644 index f079eb1..0000000 --- a/2372-rearrange-characters-to-make-target-string/2023-01-26 14.33.08 - Accepted - runtime 33ms - memory 13.8MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def rearrangeCharacters(self, s: str, t: str) -> int: - s = collections.Counter(s) - t = collections.Counter(t) - res = 1E6 - for i, c in t.items(): - if i not in s: - return 0 - res = min(res, s[i] // c) - - return res \ No newline at end of file diff --git a/238-product-of-array-except-self/2024-03-15 15.28.11 - Accepted - runtime 172ms - memory 23.8MB.py b/238-product-of-array-except-self/2024-03-15 15.28.11 - Accepted - runtime 172ms - memory 23.8MB.py deleted file mode 100644 index 83b3a6f..0000000 --- a/238-product-of-array-except-self/2024-03-15 15.28.11 - Accepted - runtime 172ms - memory 23.8MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def productExceptSelf(self, nums: List[int]) -> List[int]: - ans, suf, pre = [1] * len(nums), 1, 1 - for i in range(len(nums)): - ans[i] *= pre - pre *= nums[i] - ans[~i] *= suf - suf *= nums[~i] - - return ans \ No newline at end of file diff --git a/2383-add-two-integers/2022-08-01 16.04.05 - Accepted - runtime 51ms - memory 13.8MB.py b/2383-add-two-integers/2022-08-01 16.04.05 - Accepted - runtime 51ms - memory 13.8MB.py deleted file mode 100644 index a0a7c1f..0000000 --- a/2383-add-two-integers/2022-08-01 16.04.05 - Accepted - runtime 51ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sum(self, num1: int, num2: int) -> int: - return num1 + num2 \ No newline at end of file diff --git a/2384-root-equals-sum-of-children/2022-08-01 16.11.01 - Accepted - runtime 44ms - memory 13.8MB.py b/2384-root-equals-sum-of-children/2022-08-01 16.11.01 - Accepted - runtime 44ms - memory 13.8MB.py deleted file mode 100644 index 157a3c8..0000000 --- a/2384-root-equals-sum-of-children/2022-08-01 16.11.01 - Accepted - runtime 44ms - memory 13.8MB.py +++ /dev/null @@ -1,9 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def checkTree(self, root: Optional[TreeNode]) -> bool: - return root.val == root.left.val + root.right.val \ No newline at end of file diff --git a/2384-root-equals-sum-of-children/2024-01-07 22.37.24 - Accepted - runtime 33ms - memory 17.4MB.py b/2384-root-equals-sum-of-children/2024-01-07 22.37.24 - Accepted - runtime 33ms - memory 17.4MB.py deleted file mode 100644 index 157a3c8..0000000 --- a/2384-root-equals-sum-of-children/2024-01-07 22.37.24 - Accepted - runtime 33ms - memory 17.4MB.py +++ /dev/null @@ -1,9 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def checkTree(self, root: Optional[TreeNode]) -> bool: - return root.val == root.left.val + root.right.val \ No newline at end of file diff --git a/239-sliding-window-maximum/2024-03-29 17.34.06 - Accepted - runtime 1089ms - memory 33MB.py b/239-sliding-window-maximum/2024-03-29 17.34.06 - Accepted - runtime 1089ms - memory 33MB.py deleted file mode 100644 index b89b202..0000000 --- a/239-sliding-window-maximum/2024-03-29 17.34.06 - Accepted - runtime 1089ms - memory 33MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: - d = deque() - res = [] - for i in range(len(nums)): - while d and nums[d[-1]] < nums[i]:d.pop() - d.append(i) - # [0 1 2 3] - if i - k == d[0]: - d.popleft() - - res.append(nums[d[0]]) - - - return res[k - 1:] \ No newline at end of file diff --git a/2391-strong-password-checker-ii/2022-07-28 21.45.30 - Accepted - runtime 44ms - memory 13.8MB.py b/2391-strong-password-checker-ii/2022-07-28 21.45.30 - Accepted - runtime 44ms - memory 13.8MB.py deleted file mode 100644 index 1936774..0000000 --- a/2391-strong-password-checker-ii/2022-07-28 21.45.30 - Accepted - runtime 44ms - memory 13.8MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def strongPasswordCheckerII(self, p: str) -> bool: - a=b=c=d=False - prev = None - for i in p: - if i == prev:return False - elif i.islower():a=1 - elif i.isupper():b=1 - elif i.isdigit():c=1 - else:d=1 - prev = i - - - return len(p) > 7 and a and b and c and d \ No newline at end of file diff --git a/2392-successful-pairs-of-spells-and-potions/2023-04-02 15.37.36 - Accepted - runtime 1793ms - memory 37.1MB.py b/2392-successful-pairs-of-spells-and-potions/2023-04-02 15.37.36 - Accepted - runtime 1793ms - memory 37.1MB.py deleted file mode 100644 index 364b845..0000000 --- a/2392-successful-pairs-of-spells-and-potions/2023-04-02 15.37.36 - Accepted - runtime 1793ms - memory 37.1MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def successfulPairs(self, spells: List[int], potions: List[int], success: int) -> List[int]: - potions.sort() - l = len(potions) - res = [] - for i in spells: - lo, hi = 0, l - while lo < hi: - mid = (lo + hi) // 2 - if potions[mid] * i >= success: - hi = mid - else: - lo = mid + 1 - - res.append(l - lo) - - return res \ No newline at end of file diff --git a/24-swap-nodes-in-pairs/2024-02-21 11.22.10 - Accepted - runtime 4ms - memory 9.5MB.cpp b/24-swap-nodes-in-pairs/2024-02-21 11.22.10 - Accepted - runtime 4ms - memory 9.5MB.cpp deleted file mode 100644 index 172546c..0000000 --- a/24-swap-nodes-in-pairs/2024-02-21 11.22.10 - Accepted - runtime 4ms - memory 9.5MB.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* swapPairs(ListNode* head) { - if (!head) return head; - ListNode* f = head; - ListNode* res = head; - head = head -> next; - int d = 1; - while (head){ - if (d % 2) swap(f -> val, head -> val); - f = head; - head = head -> next; - d++; - } - return res; - } -}; \ No newline at end of file diff --git a/24-swap-nodes-in-pairs/2024-02-21 11.23.31 - Accepted - runtime 2ms - memory 9.6MB.cpp b/24-swap-nodes-in-pairs/2024-02-21 11.23.31 - Accepted - runtime 2ms - memory 9.6MB.cpp deleted file mode 100644 index 4f2c927..0000000 --- a/24-swap-nodes-in-pairs/2024-02-21 11.23.31 - Accepted - runtime 2ms - memory 9.6MB.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* swapPairs(ListNode* head) { - if(head == NULL || head -> next == NULL) return head; - ListNode* temp = head -> next; - head->next = swapPairs(head->next->next); - temp->next = head; - return temp; - } -}; \ No newline at end of file diff --git a/240-search-a-2d-matrix-ii/2022-07-24 20.18.11 - Accepted - runtime 349ms - memory 20.4MB.py b/240-search-a-2d-matrix-ii/2022-07-24 20.18.11 - Accepted - runtime 349ms - memory 20.4MB.py deleted file mode 100644 index 0fc0ec5..0000000 --- a/240-search-a-2d-matrix-ii/2022-07-24 20.18.11 - Accepted - runtime 349ms - memory 20.4MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: - return any(target in f for f in matrix) \ No newline at end of file diff --git a/2401-count-asterisks/2022-07-28 21.35.18 - Accepted - runtime 52ms - memory 14MB.py b/2401-count-asterisks/2022-07-28 21.35.18 - Accepted - runtime 52ms - memory 14MB.py deleted file mode 100644 index cc3d5df..0000000 --- a/2401-count-asterisks/2022-07-28 21.35.18 - Accepted - runtime 52ms - memory 14MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def countAsterisks(self, s: str) -> int: - return ''.join(s.split('|')[::2]).count('*') \ No newline at end of file diff --git a/2406-decode-the-message/2022-07-28 21.56.07 - Accepted - runtime 65ms - memory 13.7MB.py b/2406-decode-the-message/2022-07-28 21.56.07 - Accepted - runtime 65ms - memory 13.7MB.py deleted file mode 100644 index aeda2b5..0000000 --- a/2406-decode-the-message/2022-07-28 21.56.07 - Accepted - runtime 65ms - memory 13.7MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def decodeMessage(self, key: str, message: str) -> str: - from string import ascii_lowercase as ass - k = ' ' - for i in key: - if i not in k:k+=i - - return message.translate(str.maketrans(k[1:],ass)) \ No newline at end of file diff --git a/2413-smallest-number-in-infinite-set/2023-04-26 16.14.25 - Accepted - runtime 122ms - memory 17.1MB.py b/2413-smallest-number-in-infinite-set/2023-04-26 16.14.25 - Accepted - runtime 122ms - memory 17.1MB.py deleted file mode 100644 index b9c25ba..0000000 --- a/2413-smallest-number-in-infinite-set/2023-04-26 16.14.25 - Accepted - runtime 122ms - memory 17.1MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class SmallestInfiniteSet: - - def __init__(self): - self.heap = [] - self.min = 1 - - def popSmallest(self) -> int: - if self.heap: - return heapq.heappop(self.heap) - - self.min += 1 - return self.min - 1 - - def addBack(self, num: int) -> None: - if self.min > num and num not in self.heap: - heapq.heappush(self.heap, num) \ No newline at end of file diff --git a/2416-evaluate-boolean-binary-tree/2024-02-01 23.03.43 - Accepted - runtime 37ms - memory 16.9MB.py b/2416-evaluate-boolean-binary-tree/2024-02-01 23.03.43 - Accepted - runtime 37ms - memory 16.9MB.py deleted file mode 100644 index c6b63f3..0000000 --- a/2416-evaluate-boolean-binary-tree/2024-02-01 23.03.43 - Accepted - runtime 37ms - memory 16.9MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def evaluateTree(self, root: Optional[TreeNode]) -> bool: - if not root: return - if root.val == 2: - return self.evaluateTree(root.left) or self.evaluateTree(root.right) - elif root.val == 3: - return self.evaluateTree(root.left) and self.evaluateTree(root.right) - return root.val \ No newline at end of file diff --git a/242-valid-anagram/2022-07-02 19.14.14 - Accepted - runtime 87ms - memory 15.1MB.py b/242-valid-anagram/2022-07-02 19.14.14 - Accepted - runtime 87ms - memory 15.1MB.py deleted file mode 100644 index 5d2ff42..0000000 --- a/242-valid-anagram/2022-07-02 19.14.14 - Accepted - runtime 87ms - memory 15.1MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def isAnagram(self, s: str, t: str) -> bool: - return sorted(s) == sorted(t) \ No newline at end of file diff --git a/242-valid-anagram/2022-07-28 13.49.37 - Accepted - runtime 98ms - memory 15.1MB.py b/242-valid-anagram/2022-07-28 13.49.37 - Accepted - runtime 98ms - memory 15.1MB.py deleted file mode 100644 index 5d2ff42..0000000 --- a/242-valid-anagram/2022-07-28 13.49.37 - Accepted - runtime 98ms - memory 15.1MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def isAnagram(self, s: str, t: str) -> bool: - return sorted(s) == sorted(t) \ No newline at end of file diff --git a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.49.55 - Accepted - runtime 47ms - memory 13.8MB.py b/2421-maximum-number-of-pairs-in-array/2022-07-30 01.49.55 - Accepted - runtime 47ms - memory 13.8MB.py deleted file mode 100644 index 2c27dfb..0000000 --- a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.49.55 - Accepted - runtime 47ms - memory 13.8MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def numberOfPairs(self, nums: List[int]) -> List[int]: - d = collections.Counter(nums) - a=b=0 - for i in d.values(): - a += i%2 - b += i // 2 - - return b, a \ No newline at end of file diff --git a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.06 - Accepted - runtime 60ms - memory 13.9MB.py b/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.06 - Accepted - runtime 60ms - memory 13.9MB.py deleted file mode 100644 index 2c27dfb..0000000 --- a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.06 - Accepted - runtime 60ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def numberOfPairs(self, nums: List[int]) -> List[int]: - d = collections.Counter(nums) - a=b=0 - for i in d.values(): - a += i%2 - b += i // 2 - - return b, a \ No newline at end of file diff --git a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.12 - Accepted - runtime 52ms - memory 13.9MB.py b/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.12 - Accepted - runtime 52ms - memory 13.9MB.py deleted file mode 100644 index 2c27dfb..0000000 --- a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.12 - Accepted - runtime 52ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def numberOfPairs(self, nums: List[int]) -> List[int]: - d = collections.Counter(nums) - a=b=0 - for i in d.values(): - a += i%2 - b += i // 2 - - return b, a \ No newline at end of file diff --git a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.21 - Accepted - runtime 39ms - memory 13.9MB.py b/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.21 - Accepted - runtime 39ms - memory 13.9MB.py deleted file mode 100644 index 2c27dfb..0000000 --- a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.50.21 - Accepted - runtime 39ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def numberOfPairs(self, nums: List[int]) -> List[int]: - d = collections.Counter(nums) - a=b=0 - for i in d.values(): - a += i%2 - b += i // 2 - - return b, a \ No newline at end of file diff --git a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.51.39 - Accepted - runtime 59ms - memory 13.9MB.py b/2421-maximum-number-of-pairs-in-array/2022-07-30 01.51.39 - Accepted - runtime 59ms - memory 13.9MB.py deleted file mode 100644 index 2c27dfb..0000000 --- a/2421-maximum-number-of-pairs-in-array/2022-07-30 01.51.39 - Accepted - runtime 59ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def numberOfPairs(self, nums: List[int]) -> List[int]: - d = collections.Counter(nums) - a=b=0 - for i in d.values(): - a += i%2 - b += i // 2 - - return b, a \ No newline at end of file diff --git a/2421-maximum-number-of-pairs-in-array/2024-04-01 14.50.09 - Accepted - runtime 42ms - memory 16.5MB.py b/2421-maximum-number-of-pairs-in-array/2024-04-01 14.50.09 - Accepted - runtime 42ms - memory 16.5MB.py deleted file mode 100644 index c965053..0000000 --- a/2421-maximum-number-of-pairs-in-array/2024-04-01 14.50.09 - Accepted - runtime 42ms - memory 16.5MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def numberOfPairs(self, nums: List[int]) -> List[int]: - c = Counter(nums).values() - a = b = 0 - for i in c: - i, j = divmod(i, 2) - a += i - b += j - - return [a, b] \ No newline at end of file diff --git a/2427-first-letter-to-appear-twice/2022-07-28 21.31.06 - Accepted - runtime 35ms - memory 13.8MB.py b/2427-first-letter-to-appear-twice/2022-07-28 21.31.06 - Accepted - runtime 35ms - memory 13.8MB.py deleted file mode 100644 index 3566118..0000000 --- a/2427-first-letter-to-appear-twice/2022-07-28 21.31.06 - Accepted - runtime 35ms - memory 13.8MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def repeatedCharacter(self, s: str) -> str: - a = '' - for i in s: - if i in a:return i - a += i - return i \ No newline at end of file diff --git a/2433-best-poker-hand/2022-07-28 21.29.29 - Accepted - runtime 50ms - memory 13.9MB.py b/2433-best-poker-hand/2022-07-28 21.29.29 - Accepted - runtime 50ms - memory 13.9MB.py deleted file mode 100644 index 75acb1c..0000000 --- a/2433-best-poker-hand/2022-07-28 21.29.29 - Accepted - runtime 50ms - memory 13.9MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def bestHand(self, ranks: List[int], suits: List[str]) -> str: - if len(set(suits)) == 1: - return 'Flush' - a = collections.Counter(ranks).most_common(1)[0][1] - if a >= 3: - return 'Three of a Kind' - elif a == 2: - return 'Pair' - else: - return 'High Card' \ No newline at end of file diff --git a/2442-number-of-arithmetic-triplets/2022-09-17 14.00.13 - Accepted - runtime 2826ms - memory 13.9MB.py b/2442-number-of-arithmetic-triplets/2022-09-17 14.00.13 - Accepted - runtime 2826ms - memory 13.9MB.py deleted file mode 100644 index 4d60f48..0000000 --- a/2442-number-of-arithmetic-triplets/2022-09-17 14.00.13 - Accepted - runtime 2826ms - memory 13.9MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def arithmeticTriplets(self, nums: List[int], diff: int) -> int: - r = 0 - for k in range(l := len(nums)): - for j in range(k): - for i in range(j): - if nums[k] - nums[j] == diff and nums[j] - nums[i] == diff: - r += 1 - - return r \ No newline at end of file diff --git a/2442-number-of-arithmetic-triplets/2022-09-17 14.17.00 - Accepted - runtime 0ms - memory 8.7MB.cpp b/2442-number-of-arithmetic-triplets/2022-09-17 14.17.00 - Accepted - runtime 0ms - memory 8.7MB.cpp deleted file mode 100644 index 6cf7fdd..0000000 --- a/2442-number-of-arithmetic-triplets/2022-09-17 14.17.00 - Accepted - runtime 0ms - memory 8.7MB.cpp +++ /dev/null @@ -1,12 +0,0 @@ -class Solution { -public: - int arithmeticTriplets(vector& nums, int diff) { - int cnt[201] = {}, res = 0; - for (int n : nums) { - if (n >= 2 * diff) - res += cnt[n - diff] && cnt[n - 2 * diff]; - cnt[n] = true; - } - return res; -} -}; \ No newline at end of file diff --git a/2442-number-of-arithmetic-triplets/2022-09-20 14.49.29 - Accepted - runtime 76ms - memory 13.9MB.py b/2442-number-of-arithmetic-triplets/2022-09-20 14.49.29 - Accepted - runtime 76ms - memory 13.9MB.py deleted file mode 100644 index 0f6e373..0000000 --- a/2442-number-of-arithmetic-triplets/2022-09-20 14.49.29 - Accepted - runtime 76ms - memory 13.9MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def arithmeticTriplets(self, nums: list[int], diff: int) -> int: - visited = [0] * 201 - r = 0 - for i in nums: - if i >= 2 * diff: - r += visited[i - diff] and visited[i - 2 * diff] - - visited[i] = 1 - - return r \ No newline at end of file diff --git a/2444-longest-ideal-subsequence/2024-04-25 09.55.54 - Accepted - runtime 288ms - memory 17.5MB.py b/2444-longest-ideal-subsequence/2024-04-25 09.55.54 - Accepted - runtime 288ms - memory 17.5MB.py deleted file mode 100644 index 53c6e94..0000000 --- a/2444-longest-ideal-subsequence/2024-04-25 09.55.54 - Accepted - runtime 288ms - memory 17.5MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def longestIdealString(self, s: str, k: int) -> int: - dp = [0] * 128 - for i in map(ord, s): - dp[i] = max(dp[i - k: i + k + 1]) + 1 - - return max(dp) \ No newline at end of file diff --git a/2469-longest-subsequence-with-limited-sum/2022-12-25 22.31.26 - Accepted - runtime 317ms - memory 14.2MB.py b/2469-longest-subsequence-with-limited-sum/2022-12-25 22.31.26 - Accepted - runtime 317ms - memory 14.2MB.py deleted file mode 100644 index 005e528..0000000 --- a/2469-longest-subsequence-with-limited-sum/2022-12-25 22.31.26 - Accepted - runtime 317ms - memory 14.2MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def answerQueries(self, nums: List[int], queries: List[int]) -> List[int]: - nums.sort() - res = [] - for i in queries: - s = c = 0 - for j in nums: - s += j - if s > i: - break - c += 1 - res.append(c) - - return res \ No newline at end of file diff --git a/2470-removing-stars-from-a-string/2023-04-11 23.34.17 - Accepted - runtime 659ms - memory 15.5MB.py b/2470-removing-stars-from-a-string/2023-04-11 23.34.17 - Accepted - runtime 659ms - memory 15.5MB.py deleted file mode 100644 index 7351f44..0000000 --- a/2470-removing-stars-from-a-string/2023-04-11 23.34.17 - Accepted - runtime 659ms - memory 15.5MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def removeStars(self, s: str) -> str: - res = '' - for a,b in itertools.groupby(s): - b = len(list(b)) - if a == '*': - res = res[:-b] - else: - res += a * b - - return res \ No newline at end of file diff --git a/2470-removing-stars-from-a-string/2023-04-11 23.34.27 - Accepted - runtime 661ms - memory 15.4MB.py b/2470-removing-stars-from-a-string/2023-04-11 23.34.27 - Accepted - runtime 661ms - memory 15.4MB.py deleted file mode 100644 index 7351f44..0000000 --- a/2470-removing-stars-from-a-string/2023-04-11 23.34.27 - Accepted - runtime 661ms - memory 15.4MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def removeStars(self, s: str) -> str: - res = '' - for a,b in itertools.groupby(s): - b = len(list(b)) - if a == '*': - res = res[:-b] - else: - res += a * b - - return res \ No newline at end of file diff --git a/2470-removing-stars-from-a-string/2023-04-11 23.35.49 - Accepted - runtime 600ms - memory 15.2MB.py b/2470-removing-stars-from-a-string/2023-04-11 23.35.49 - Accepted - runtime 600ms - memory 15.2MB.py deleted file mode 100644 index f420ff6..0000000 --- a/2470-removing-stars-from-a-string/2023-04-11 23.35.49 - Accepted - runtime 600ms - memory 15.2MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def removeStars(self, s: str) -> str: - res = '' - for i in s: - if i == '*': - res = res[:-1] - else: - res += i - - return res \ No newline at end of file diff --git a/2470-removing-stars-from-a-string/2023-04-11 23.36.19 - Accepted - runtime 266ms - memory 15.6MB.py b/2470-removing-stars-from-a-string/2023-04-11 23.36.19 - Accepted - runtime 266ms - memory 15.6MB.py deleted file mode 100644 index ad1f49d..0000000 --- a/2470-removing-stars-from-a-string/2023-04-11 23.36.19 - Accepted - runtime 266ms - memory 15.6MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def removeStars(self, s: str) -> str: - res = [] - for i in s: - if i == '*': - res.pop() - else: - res += [i] - - return ''.join(res) \ No newline at end of file diff --git a/2470-removing-stars-from-a-string/2023-04-11 23.36.31 - Accepted - runtime 222ms - memory 15.5MB.py b/2470-removing-stars-from-a-string/2023-04-11 23.36.31 - Accepted - runtime 222ms - memory 15.5MB.py deleted file mode 100644 index 8fa7079..0000000 --- a/2470-removing-stars-from-a-string/2023-04-11 23.36.31 - Accepted - runtime 222ms - memory 15.5MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def removeStars(self, s: str) -> str: - res = [] - for i in s: - if i == '*': - res.pop() - else: - res.append(i) - - return ''.join(res) \ No newline at end of file diff --git a/2473-max-sum-of-a-pair-with-equal-sum-of-digits/2024-04-01 15.32.51 - Accepted - runtime 828ms - memory 31.3MB.py b/2473-max-sum-of-a-pair-with-equal-sum-of-digits/2024-04-01 15.32.51 - Accepted - runtime 828ms - memory 31.3MB.py deleted file mode 100644 index cabef4e..0000000 --- a/2473-max-sum-of-a-pair-with-equal-sum-of-digits/2024-04-01 15.32.51 - Accepted - runtime 828ms - memory 31.3MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def maximumSum(self, nums: List[int]) -> int: - n = [sum(map(int, str(f))) for f in nums] - res = -1 - l = defaultdict(list) - for ind, i in enumerate(n):l[i].append(ind) - for i in l.values(): - t = sorted(i, key=lambda x: -nums[x])[:2] - if len(t) == 2: - res = max(res, nums[t[0]] + nums[t[1]]) - return res \ No newline at end of file diff --git a/2473-max-sum-of-a-pair-with-equal-sum-of-digits/2024-04-01 15.43.14 - Accepted - runtime 826ms - memory 31.2MB.py b/2473-max-sum-of-a-pair-with-equal-sum-of-digits/2024-04-01 15.43.14 - Accepted - runtime 826ms - memory 31.2MB.py deleted file mode 100644 index c0cd879..0000000 --- a/2473-max-sum-of-a-pair-with-equal-sum-of-digits/2024-04-01 15.43.14 - Accepted - runtime 826ms - memory 31.2MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def maximumSum(self, nums: List[int]) -> int: - res = -1 - l = {} - for i in nums: - d = sum(map(int, str(i))) - if d in l: - res = max(res, i + l[d]) - l[d] = max(l[d], i) - else: - l[d] = i - - return res \ No newline at end of file diff --git a/2479-meeting-rooms-iii/2024-04-13 16.05.34 - Accepted - runtime 1191ms - memory 62.3MB.py b/2479-meeting-rooms-iii/2024-04-13 16.05.34 - Accepted - runtime 1191ms - memory 62.3MB.py deleted file mode 100644 index 0e4eccb..0000000 --- a/2479-meeting-rooms-iii/2024-04-13 16.05.34 - Accepted - runtime 1191ms - memory 62.3MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def mostBooked(self, n: int, meetings: List[List[int]]) -> int: - meetings.sort() - ready = list(range(n)) - rooms = [] - heapify(ready) - res = [0] * n - for s,e in meetings: - while rooms and rooms[0][0] <= s: - t,r = heappop(rooms) - heappush(ready, r) - if ready: - r = heappop(ready) - heappush(rooms, [e, r]) - else: - t,r = heappop(rooms) - heappush(rooms, [t + e - s, r]) - res[r] += 1 - return res.index(max(res)) \ No newline at end of file diff --git a/2479-meeting-rooms-iii/2024-04-13 16.06.00 - Accepted - runtime 1157ms - memory 62.5MB.py b/2479-meeting-rooms-iii/2024-04-13 16.06.00 - Accepted - runtime 1157ms - memory 62.5MB.py deleted file mode 100644 index 6056d1d..0000000 --- a/2479-meeting-rooms-iii/2024-04-13 16.06.00 - Accepted - runtime 1157ms - memory 62.5MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class Solution: - def mostBooked(self, n: int, meetings: List[List[int]]) -> int: - meetings.sort() - ready = list(range(n)) - rooms = [] - res = [0] * n - for s,e in meetings: - while rooms and rooms[0][0] <= s: - t,r = heappop(rooms) - heappush(ready, r) - if ready: - r = heappop(ready) - heappush(rooms, [e, r]) - else: - t,r = heappop(rooms) - heappush(rooms, [t + e - s, r]) - res[r] += 1 - return res.index(max(res)) \ No newline at end of file diff --git a/2479-meeting-rooms-iii/2024-04-13 16.07.03 - Accepted - runtime 268ms - memory 38.1MB.py b/2479-meeting-rooms-iii/2024-04-13 16.07.03 - Accepted - runtime 268ms - memory 38.1MB.py deleted file mode 100644 index 034e964..0000000 --- a/2479-meeting-rooms-iii/2024-04-13 16.07.03 - Accepted - runtime 268ms - memory 38.1MB.py +++ /dev/null @@ -1,25 +0,0 @@ -class Solution: - def mostBooked(self, n: int, meetings: List[List[int]]) -> int: - meetings.sort() - ready = list(range(n)) - rooms = [] - res = [0] * n - for s,e in meetings: - while rooms and rooms[0][0] <= s: - t,r = heappop(rooms) - heappush(ready, r) - if ready: - r = heappop(ready) - heappush(rooms, [e, r]) - else: - t,r = heappop(rooms) - heappush(rooms, [t + e - s, r]) - res[r] += 1 - return res.index(max(res)) - - -with open('user.out', 'w') as f: - testcases = list(stdin) - for n, meetings in zip(testcases[::2], testcases[1::2]): - f.write(f"{str(Solution().mostBooked(loads(n), loads(meetings)))}\n") -exit() \ No newline at end of file diff --git a/2487-optimal-partition-of-string/2023-04-05 23.26.07 - Accepted - runtime 248ms - memory 14.5MB.py b/2487-optimal-partition-of-string/2023-04-05 23.26.07 - Accepted - runtime 248ms - memory 14.5MB.py deleted file mode 100644 index 4ba32d5..0000000 --- a/2487-optimal-partition-of-string/2023-04-05 23.26.07 - Accepted - runtime 248ms - memory 14.5MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def partitionString(self, s: str) -> int: - i, ans, flag = 0, 1, 0 - while i < len(s): - val = ord(s[i]) - ord('a') - if flag & (1 << val): - flag = 0 - ans += 1 - flag |= 1 << val - i += 1 - return ans \ No newline at end of file diff --git a/2487-optimal-partition-of-string/2023-04-05 23.26.17 - Accepted - runtime 249ms - memory 14.6MB.py b/2487-optimal-partition-of-string/2023-04-05 23.26.17 - Accepted - runtime 249ms - memory 14.6MB.py deleted file mode 100644 index 4ba32d5..0000000 --- a/2487-optimal-partition-of-string/2023-04-05 23.26.17 - Accepted - runtime 249ms - memory 14.6MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def partitionString(self, s: str) -> int: - i, ans, flag = 0, 1, 0 - while i < len(s): - val = ord(s[i]) - ord('a') - if flag & (1 << val): - flag = 0 - ans += 1 - flag |= 1 << val - i += 1 - return ans \ No newline at end of file diff --git a/2487-optimal-partition-of-string/2023-04-05 23.26.27 - Accepted - runtime 248ms - memory 14.7MB.py b/2487-optimal-partition-of-string/2023-04-05 23.26.27 - Accepted - runtime 248ms - memory 14.7MB.py deleted file mode 100644 index 4ba32d5..0000000 --- a/2487-optimal-partition-of-string/2023-04-05 23.26.27 - Accepted - runtime 248ms - memory 14.7MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def partitionString(self, s: str) -> int: - i, ans, flag = 0, 1, 0 - while i < len(s): - val = ord(s[i]) - ord('a') - if flag & (1 << val): - flag = 0 - ans += 1 - flag |= 1 << val - i += 1 - return ans \ No newline at end of file diff --git a/2487-optimal-partition-of-string/2023-04-05 23.28.29 - Accepted - runtime 68ms - memory 14.7MB.py b/2487-optimal-partition-of-string/2023-04-05 23.28.29 - Accepted - runtime 68ms - memory 14.7MB.py deleted file mode 100644 index 7a8f5e0..0000000 --- a/2487-optimal-partition-of-string/2023-04-05 23.28.29 - Accepted - runtime 68ms - memory 14.7MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def partitionString(self, s: str) -> int: - l = '' - res = 1 - for i in s: - if i in l: - l = i - res += 1 - - else: - l += i - - return res \ No newline at end of file diff --git a/2491-smallest-even-multiple/2022-09-30 16.06.11 - Accepted - runtime 66ms - memory 13.9MB.py b/2491-smallest-even-multiple/2022-09-30 16.06.11 - Accepted - runtime 66ms - memory 13.9MB.py deleted file mode 100644 index e5be4d8..0000000 --- a/2491-smallest-even-multiple/2022-09-30 16.06.11 - Accepted - runtime 66ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def smallestEvenMultiple(self, n: int) -> int: - return n + n if n % 2 else n \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.32.24 - Accepted - runtime 3777ms - memory 20.5MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.32.24 - Accepted - runtime 3777ms - memory 20.5MB.py deleted file mode 100644 index 0959c55..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.32.24 - Accepted - runtime 3777ms - memory 20.5MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def reverse(self, root: TreeNode, level: int) -> None: - if root.left: - if level % 2: - if level in self.levels: - self.levels[level] += [root.left, root.right] - else: - self.levels[level] = [root.left, root.right] - self.reverse(root.left, level + 1) - self.reverse(root.right, level + 1) - - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - self.levels = {} - if root: - self.reverse(root, 1) - for _, nodes in self.levels.items(): - l = len(nodes) // 2 - for a,b in zip(nodes[:l], nodes[l:][::-1]): - a.val, b.val = b.val, a.val - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.58.11 - Accepted - runtime 941ms - memory 20.7MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.58.11 - Accepted - runtime 941ms - memory 20.7MB.py deleted file mode 100644 index 4deca21..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.58.11 - Accepted - runtime 941ms - memory 20.7MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.append(curr.left) - q.append(curr.right) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.59.35 - Accepted - runtime 3961ms - memory 20.7MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.59.35 - Accepted - runtime 3961ms - memory 20.7MB.py deleted file mode 100644 index 5de45a1..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.59.35 - Accepted - runtime 3961ms - memory 20.7MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = [root] - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.pop(0) - if curr.left: - q += [curr.left, curr.right] - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.59.55 - Accepted - runtime 3860ms - memory 20.7MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.59.55 - Accepted - runtime 3860ms - memory 20.7MB.py deleted file mode 100644 index 5de45a1..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 14.59.55 - Accepted - runtime 3860ms - memory 20.7MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = [root] - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.pop(0) - if curr.left: - q += [curr.left, curr.right] - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.00.13 - Accepted - runtime 943ms - memory 20.5MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.00.13 - Accepted - runtime 943ms - memory 20.5MB.py deleted file mode 100644 index 4deca21..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.00.13 - Accepted - runtime 943ms - memory 20.5MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.append(curr.left) - q.append(curr.right) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.01.54 - Accepted - runtime 3772ms - memory 20.4MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.01.54 - Accepted - runtime 3772ms - memory 20.4MB.py deleted file mode 100644 index b634af0..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.01.54 - Accepted - runtime 3772ms - memory 20.4MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.20 - Accepted - runtime 3840ms - memory 20.6MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.20 - Accepted - runtime 3840ms - memory 20.6MB.py deleted file mode 100644 index 4deca21..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.20 - Accepted - runtime 3840ms - memory 20.6MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.append(curr.left) - q.append(curr.right) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.47 - Accepted - runtime 949ms - memory 20.6MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.47 - Accepted - runtime 949ms - memory 20.6MB.py deleted file mode 100644 index 4deca21..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.47 - Accepted - runtime 949ms - memory 20.6MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.append(curr.left) - q.append(curr.right) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.58 - Accepted - runtime 3805ms - memory 20.5MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.58 - Accepted - runtime 3805ms - memory 20.5MB.py deleted file mode 100644 index 4deca21..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.02.58 - Accepted - runtime 3805ms - memory 20.5MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.append(curr.left) - q.append(curr.right) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.03.40 - Accepted - runtime 3804ms - memory 20.5MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.03.40 - Accepted - runtime 3804ms - memory 20.5MB.py deleted file mode 100644 index b634af0..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.03.40 - Accepted - runtime 3804ms - memory 20.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.03.51 - Accepted - runtime 3698ms - memory 20.6MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.03.51 - Accepted - runtime 3698ms - memory 20.6MB.py deleted file mode 100644 index b634af0..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.03.51 - Accepted - runtime 3698ms - memory 20.6MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.04.03 - Accepted - runtime 946ms - memory 20.4MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.04.03 - Accepted - runtime 946ms - memory 20.4MB.py deleted file mode 100644 index b634af0..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.04.03 - Accepted - runtime 946ms - memory 20.4MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.18 - Accepted - runtime 3913ms - memory 20.7MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.18 - Accepted - runtime 3913ms - memory 20.7MB.py deleted file mode 100644 index 0ce933d..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.18 - Accepted - runtime 3913ms - memory 20.7MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = [root] - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.pop(0) - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.28 - Accepted - runtime 3958ms - memory 20.7MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.28 - Accepted - runtime 3958ms - memory 20.7MB.py deleted file mode 100644 index 0ce933d..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.28 - Accepted - runtime 3958ms - memory 20.7MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = [root] - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.pop(0) - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.40 - Accepted - runtime 4119ms - memory 20.7MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.40 - Accepted - runtime 4119ms - memory 20.7MB.py deleted file mode 100644 index 0ce933d..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.40 - Accepted - runtime 4119ms - memory 20.7MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = [root] - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.pop(0) - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.50 - Accepted - runtime 4019ms - memory 20.6MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.50 - Accepted - runtime 4019ms - memory 20.6MB.py deleted file mode 100644 index 0ce933d..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.05.50 - Accepted - runtime 4019ms - memory 20.6MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = [root] - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.pop(0) - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.00 - Accepted - runtime 4013ms - memory 20.6MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.00 - Accepted - runtime 4013ms - memory 20.6MB.py deleted file mode 100644 index 0ce933d..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.00 - Accepted - runtime 4013ms - memory 20.6MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = [root] - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.pop(0) - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.10 - Accepted - runtime 4028ms - memory 20.6MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.10 - Accepted - runtime 4028ms - memory 20.6MB.py deleted file mode 100644 index 0ce933d..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.10 - Accepted - runtime 4028ms - memory 20.6MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = [root] - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.pop(0) - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.23 - Accepted - runtime 3852ms - memory 20.5MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.23 - Accepted - runtime 3852ms - memory 20.5MB.py deleted file mode 100644 index b634af0..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.23 - Accepted - runtime 3852ms - memory 20.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.35 - Accepted - runtime 3609ms - memory 20.5MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.35 - Accepted - runtime 3609ms - memory 20.5MB.py deleted file mode 100644 index b634af0..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.35 - Accepted - runtime 3609ms - memory 20.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.44 - Accepted - runtime 952ms - memory 20.6MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.44 - Accepted - runtime 952ms - memory 20.6MB.py deleted file mode 100644 index b634af0..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 15.06.44 - Accepted - runtime 952ms - memory 20.6MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - level = 0 - while q: - l = len(q) - if level % 2: - for i in range(l // 2): - left, right = q[i], q[~i] - left.val, right.val = right.val, left.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.extend([curr.left, curr.right]) - - level += 1 - - - return root \ No newline at end of file diff --git a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 22.36.25 - Accepted - runtime 3892ms - memory 20.5MB.py b/2493-reverse-odd-levels-of-binary-tree/2022-10-03 22.36.25 - Accepted - runtime 3892ms - memory 20.5MB.py deleted file mode 100644 index fbe0425..0000000 --- a/2493-reverse-odd-levels-of-binary-tree/2022-10-03 22.36.25 - Accepted - runtime 3892ms - memory 20.5MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class Solution: - def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - q = deque([root]) - lvl = 0 - while q: - l = len(q) - if lvl % 2: - for i in range(l // 2): - a,b = q[i], q[~i] - a.val, b.val = b.val, a.val - for _ in range(l): - curr = q.popleft() - if curr.left: - q.extend([curr.left, curr.right]) - - lvl += 1 - - return root \ No newline at end of file diff --git a/2502-sort-the-people/2022-09-27 11.27.35 - Accepted - runtime 292ms - memory 14.6MB.py b/2502-sort-the-people/2022-09-27 11.27.35 - Accepted - runtime 292ms - memory 14.6MB.py deleted file mode 100644 index 4e3828b..0000000 --- a/2502-sort-the-people/2022-09-27 11.27.35 - Accepted - runtime 292ms - memory 14.6MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sortPeople(self, names: List[str], heights: List[int]) -> List[str]: - return [name for name,height in sorted(zip(names, heights), key=lambda x:-x[1])] \ No newline at end of file diff --git a/2507-number-of-common-factors/2024-01-06 18.19.17 - Accepted - runtime 33ms - memory 17.2MB.py b/2507-number-of-common-factors/2024-01-06 18.19.17 - Accepted - runtime 33ms - memory 17.2MB.py deleted file mode 100644 index 3f267ee..0000000 --- a/2507-number-of-common-factors/2024-01-06 18.19.17 - Accepted - runtime 33ms - memory 17.2MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def commonFactors(self, a: int, b: int) -> int: - return sum(a % f == 0 and b % f == 0 for f in range(1, max(a,b) + 1)) - \ No newline at end of file diff --git a/2524-largest-positive-integer-that-exists-with-its-negative/2024-05-02 09.12.42 - Accepted - runtime 105ms - memory 16.8MB.py b/2524-largest-positive-integer-that-exists-with-its-negative/2024-05-02 09.12.42 - Accepted - runtime 105ms - memory 16.8MB.py deleted file mode 100644 index cb5a727..0000000 --- a/2524-largest-positive-integer-that-exists-with-its-negative/2024-05-02 09.12.42 - Accepted - runtime 105ms - memory 16.8MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def findMaxK(self, nums: List[int]) -> int: - s = set(nums) - for i in sorted(nums, reverse=True): - if -i in s: - return i - - return -1 \ No newline at end of file diff --git a/2527-count-subarrays-with-fixed-bounds/2024-03-31 12.06.30 - Accepted - runtime 720ms - memory 31MB.py b/2527-count-subarrays-with-fixed-bounds/2024-03-31 12.06.30 - Accepted - runtime 720ms - memory 31MB.py deleted file mode 100644 index 1f3f122..0000000 --- a/2527-count-subarrays-with-fixed-bounds/2024-03-31 12.06.30 - Accepted - runtime 720ms - memory 31MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def countSubarrays(self, nums: List[int], minK: int, maxK: int) -> int: - res = 0; m = M = last = -1 - for i in range(len(nums)): - if not minK <= nums[i] <= maxK: last = i - if nums[i] == minK: m = i - if nums[i] == maxK: M = i - res += max(0, min(m, M) - last) - - - return res diff --git a/2532-remove-letter-to-equalize-frequency/2024-04-05 15.05.03 - Accepted - runtime 32ms - memory 16.7MB.py b/2532-remove-letter-to-equalize-frequency/2024-04-05 15.05.03 - Accepted - runtime 32ms - memory 16.7MB.py deleted file mode 100644 index 08a0546..0000000 --- a/2532-remove-letter-to-equalize-frequency/2024-04-05 15.05.03 - Accepted - runtime 32ms - memory 16.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def equalFrequency(self, word: str) -> bool: - cnt = Counter(Counter(word).values()) - if (len(cnt) == 1): - return list(cnt.keys())[0] == 1 or list(cnt.values())[0] == 1 - if (len(cnt) == 2): - f1, f2 = min(cnt.keys()), max(cnt.keys()) - return (f1 + 1 == f2 and cnt[f2] == 1) or (f1 == 1 and cnt[f1] == 1) - return False \ No newline at end of file diff --git a/2532-remove-letter-to-equalize-frequency/2024-04-05 15.05.17 - Accepted - runtime 29ms - memory 16.7MB.py b/2532-remove-letter-to-equalize-frequency/2024-04-05 15.05.17 - Accepted - runtime 29ms - memory 16.7MB.py deleted file mode 100644 index 08a0546..0000000 --- a/2532-remove-letter-to-equalize-frequency/2024-04-05 15.05.17 - Accepted - runtime 29ms - memory 16.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def equalFrequency(self, word: str) -> bool: - cnt = Counter(Counter(word).values()) - if (len(cnt) == 1): - return list(cnt.keys())[0] == 1 or list(cnt.values())[0] == 1 - if (len(cnt) == 2): - f1, f2 = min(cnt.keys()), max(cnt.keys()) - return (f1 + 1 == f2 and cnt[f2] == 1) or (f1 == 1 and cnt[f1] == 1) - return False \ No newline at end of file diff --git a/2556-convert-the-temperature/2024-02-02 19.19.00 - Accepted - runtime 28ms - memory 16.5MB.py b/2556-convert-the-temperature/2024-02-02 19.19.00 - Accepted - runtime 28ms - memory 16.5MB.py deleted file mode 100644 index e03d585..0000000 --- a/2556-convert-the-temperature/2024-02-02 19.19.00 - Accepted - runtime 28ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def convertTemperature(self, celsius: float) -> List[float]: - return [round(celsius + 273.15, 5), round(celsius * 1.8 + 32, 5)] \ No newline at end of file diff --git a/2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level/2024-04-07 23.13.58 - Accepted - runtime 404ms - memory 47.4MB.py b/2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level/2024-04-07 23.13.58 - Accepted - runtime 404ms - memory 47.4MB.py deleted file mode 100644 index 6e42185..0000000 --- a/2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level/2024-04-07 23.13.58 - Accepted - runtime 404ms - memory 47.4MB.py +++ /dev/null @@ -1,34 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def minimumOperations(self, root: Optional[TreeNode]) -> int: - if not root: - return 0 - - res = 0 - curr = deque([root]) - while curr: - lvl = [] - for i in range(len(curr)): - n = curr.popleft() - lvl.append(n.val) - if n.left: - curr.append(n.left) - if n.right: - curr.append(n.right) - - pos = {m:j for j,m in enumerate(sorted(lvl))} - vis, tot = [0] * len(lvl), 0 - for i in range(len(lvl)): - cnt = 0 - while not vis[i] and i != pos[lvl[i]]: - vis[i], i = 1, pos[lvl[i]] - cnt += 1 - tot += max(0, cnt-1) - res += tot - - return res diff --git a/257-binary-tree-paths/2022-07-01 16.16.49 - Accepted - runtime 56ms - memory 13.9MB.py b/257-binary-tree-paths/2022-07-01 16.16.49 - Accepted - runtime 56ms - memory 13.9MB.py deleted file mode 100644 index f33b1b5..0000000 --- a/257-binary-tree-paths/2022-07-01 16.16.49 - Accepted - runtime 56ms - memory 13.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def binaryTreePaths(self, root): - if not root: return [] - result= [ str(root.val)+"->" + path for path in self.binaryTreePaths(root.left)] - result+= [ str(root.val)+"->" + path for path in self.binaryTreePaths(root.right)] - return result or [str(root.val)] \ No newline at end of file diff --git a/257-binary-tree-paths/2024-01-13 20.12.32 - Accepted - runtime 40ms - memory 17.3MB.py b/257-binary-tree-paths/2024-01-13 20.12.32 - Accepted - runtime 40ms - memory 17.3MB.py deleted file mode 100644 index 10c51da..0000000 --- a/257-binary-tree-paths/2024-01-13 20.12.32 - Accepted - runtime 40ms - memory 17.3MB.py +++ /dev/null @@ -1,20 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, node, l=''): - l += str(node.val) - if not (node.left or node.right): - yield l - else: - l += '->' - if node.left: - yield from self.traverse(node.left, l) - if node.right: - yield from self.traverse(node.right, l) - - def binaryTreePaths(self, root: Optional[TreeNode]) -> List[str]: - return list(self.traverse(root)) \ No newline at end of file diff --git a/257-binary-tree-paths/2024-02-18 17.59.55 - Accepted - runtime 0ms - memory 17.4MB.cpp b/257-binary-tree-paths/2024-02-18 17.59.55 - Accepted - runtime 0ms - memory 17.4MB.cpp deleted file mode 100644 index de7ea01..0000000 --- a/257-binary-tree-paths/2024-02-18 17.59.55 - Accepted - runtime 0ms - memory 17.4MB.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - vector traverse(TreeNode* node, string l = "") { - l += to_string(node->val); - vector paths; - if (!(node->left || node->right)) { - paths.push_back(l); - } else { - l += "->"; - if (node->left) { - vector leftPaths = traverse(node->left, l); - paths.insert(paths.end(), leftPaths.begin(), leftPaths.end()); - } - if (node->right) { - vector rightPaths = traverse(node->right, l); - paths.insert(paths.end(), rightPaths.begin(), rightPaths.end()); - } - } - return paths; - } - vector binaryTreePaths(TreeNode* root) { - return traverse(root); - } -}; \ No newline at end of file diff --git a/2571-find-the-pivot-integer/2024-03-13 12.58.11 - Accepted - runtime 42ms - memory 16.7MB.py b/2571-find-the-pivot-integer/2024-03-13 12.58.11 - Accepted - runtime 42ms - memory 16.7MB.py deleted file mode 100644 index 44b36c5..0000000 --- a/2571-find-the-pivot-integer/2024-03-13 12.58.11 - Accepted - runtime 42ms - memory 16.7MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def pivotInteger(self, n: int) -> int: - n *= (n + 1) / 2 - x = int(n ** .5) - return x if x * x == n else -1 \ No newline at end of file diff --git a/2573-remove-nodes-from-linked-list/2024-02-25 19.28.14 - Accepted - runtime 258ms - memory 164.4MB.cpp b/2573-remove-nodes-from-linked-list/2024-02-25 19.28.14 - Accepted - runtime 258ms - memory 164.4MB.cpp deleted file mode 100644 index 3749477..0000000 --- a/2573-remove-nodes-from-linked-list/2024-02-25 19.28.14 - Accepted - runtime 258ms - memory 164.4MB.cpp +++ /dev/null @@ -1,8 +0,0 @@ -class Solution { -public: - ListNode* removeNodes(ListNode* head) { - if (head == NULL) return head; - head -> next = removeNodes(head -> next); - return head->next && head->next->val > head->val? head->next: head; - } -}; \ No newline at end of file diff --git a/2573-remove-nodes-from-linked-list/2024-05-06 10.34.18 - Accepted - runtime 377ms - memory 62.4MB.py b/2573-remove-nodes-from-linked-list/2024-05-06 10.34.18 - Accepted - runtime 377ms - memory 62.4MB.py deleted file mode 100644 index ac5e454..0000000 --- a/2573-remove-nodes-from-linked-list/2024-05-06 10.34.18 - Accepted - runtime 377ms - memory 62.4MB.py +++ /dev/null @@ -1,10 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def removeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]: - if not head:return head - head.next = self.removeNodes(head.next) - return head.next if head.next and head.next.val > head.val else head \ No newline at end of file diff --git a/258-add-digits/2022-07-02 22.43.02 - Accepted - runtime 28ms - memory 13.9MB.py b/258-add-digits/2022-07-02 22.43.02 - Accepted - runtime 28ms - memory 13.9MB.py deleted file mode 100644 index d1c0365..0000000 --- a/258-add-digits/2022-07-02 22.43.02 - Accepted - runtime 28ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def addDigits(self, num: int) -> int: - return 1 + (num - 1) % 9 if num else 0 \ No newline at end of file diff --git a/258-add-digits/2022-07-02 22.45.15 - Accepted - runtime 3ms - memory 5.6MB.c b/258-add-digits/2022-07-02 22.45.15 - Accepted - runtime 3ms - memory 5.6MB.c deleted file mode 100644 index 753d9d3..0000000 --- a/258-add-digits/2022-07-02 22.45.15 - Accepted - runtime 3ms - memory 5.6MB.c +++ /dev/null @@ -1,5 +0,0 @@ - - -int addDigits(int num){ - return num ? 1 + (num - 1) % 9 : 0; -} \ No newline at end of file diff --git a/258-add-digits/2022-07-02 22.45.23 - Accepted - runtime 3ms - memory 5.5MB.c b/258-add-digits/2022-07-02 22.45.23 - Accepted - runtime 3ms - memory 5.5MB.c deleted file mode 100644 index 753d9d3..0000000 --- a/258-add-digits/2022-07-02 22.45.23 - Accepted - runtime 3ms - memory 5.5MB.c +++ /dev/null @@ -1,5 +0,0 @@ - - -int addDigits(int num){ - return num ? 1 + (num - 1) % 9 : 0; -} \ No newline at end of file diff --git a/258-add-digits/2022-07-02 22.45.29 - Accepted - runtime 4ms - memory 5.4MB.c b/258-add-digits/2022-07-02 22.45.29 - Accepted - runtime 4ms - memory 5.4MB.c deleted file mode 100644 index 753d9d3..0000000 --- a/258-add-digits/2022-07-02 22.45.29 - Accepted - runtime 4ms - memory 5.4MB.c +++ /dev/null @@ -1,5 +0,0 @@ - - -int addDigits(int num){ - return num ? 1 + (num - 1) % 9 : 0; -} \ No newline at end of file diff --git a/258-add-digits/2022-07-02 22.45.40 - Accepted - runtime 4ms - memory 5.5MB.c b/258-add-digits/2022-07-02 22.45.40 - Accepted - runtime 4ms - memory 5.5MB.c deleted file mode 100644 index 753d9d3..0000000 --- a/258-add-digits/2022-07-02 22.45.40 - Accepted - runtime 4ms - memory 5.5MB.c +++ /dev/null @@ -1,5 +0,0 @@ - - -int addDigits(int num){ - return num ? 1 + (num - 1) % 9 : 0; -} \ No newline at end of file diff --git a/258-add-digits/2023-04-26 15.51.22 - Accepted - runtime 36ms - memory 13.9MB.py b/258-add-digits/2023-04-26 15.51.22 - Accepted - runtime 36ms - memory 13.9MB.py deleted file mode 100644 index be620d7..0000000 --- a/258-add-digits/2023-04-26 15.51.22 - Accepted - runtime 36ms - memory 13.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def addDigits(self, num: int) -> int: - while len(str(num)) > 1: - num = sum(map(int, str(num))) - - return num \ No newline at end of file diff --git a/26-remove-duplicates-from-sorted-array/2022-04-25 10.18.41 - Accepted - runtime 168ms - memory 15.5MB.py b/26-remove-duplicates-from-sorted-array/2022-04-25 10.18.41 - Accepted - runtime 168ms - memory 15.5MB.py deleted file mode 100644 index c5a311e..0000000 --- a/26-remove-duplicates-from-sorted-array/2022-04-25 10.18.41 - Accepted - runtime 168ms - memory 15.5MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def removeDuplicates(self, nums: List[int]) -> int: - k = 0 - while k < len(nums) - 1: - if nums[k] == nums[k + 1]: - nums.pop(k) - else: - k += 1 - else: - k += 1 - - return k - \ No newline at end of file diff --git a/26-remove-duplicates-from-sorted-array/2022-04-25 10.18.49 - Accepted - runtime 188ms - memory 15.7MB.py b/26-remove-duplicates-from-sorted-array/2022-04-25 10.18.49 - Accepted - runtime 188ms - memory 15.7MB.py deleted file mode 100644 index c5a311e..0000000 --- a/26-remove-duplicates-from-sorted-array/2022-04-25 10.18.49 - Accepted - runtime 188ms - memory 15.7MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def removeDuplicates(self, nums: List[int]) -> int: - k = 0 - while k < len(nums) - 1: - if nums[k] == nums[k + 1]: - nums.pop(k) - else: - k += 1 - else: - k += 1 - - return k - \ No newline at end of file diff --git a/26-remove-duplicates-from-sorted-array/2022-04-25 10.20.50 - Accepted - runtime 97ms - memory 15.4MB.py b/26-remove-duplicates-from-sorted-array/2022-04-25 10.20.50 - Accepted - runtime 97ms - memory 15.4MB.py deleted file mode 100644 index 76f9e31..0000000 --- a/26-remove-duplicates-from-sorted-array/2022-04-25 10.20.50 - Accepted - runtime 97ms - memory 15.4MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def removeDuplicates(self, nums: List[int]) -> int: - k = 0; - for i in range(1, len(nums)): - if nums[i] != nums[k]: - k += 1 - nums[k] = nums[i] - - return k + 1 - \ No newline at end of file diff --git a/26-remove-duplicates-from-sorted-array/2024-02-17 12.24.26 - Accepted - runtime 11ms - memory 21.1MB.cpp b/26-remove-duplicates-from-sorted-array/2024-02-17 12.24.26 - Accepted - runtime 11ms - memory 21.1MB.cpp deleted file mode 100644 index a42a7e2..0000000 --- a/26-remove-duplicates-from-sorted-array/2024-02-17 12.24.26 - Accepted - runtime 11ms - memory 21.1MB.cpp +++ /dev/null @@ -1,9 +0,0 @@ -class Solution { -public: - int removeDuplicates(vector& nums) { - int r = 0; - for (int i=1;i < nums.size();i++) - if (nums[i] != nums[r]) nums[++r] = nums[i]; - return ++r; - } -}; \ No newline at end of file diff --git a/263-ugly-number/2023-04-30 00.09.10 - Accepted - runtime 54ms - memory 16.4MB.py b/263-ugly-number/2023-04-30 00.09.10 - Accepted - runtime 54ms - memory 16.4MB.py deleted file mode 100644 index f03c4bf..0000000 --- a/263-ugly-number/2023-04-30 00.09.10 - Accepted - runtime 54ms - memory 16.4MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def isUgly(self, n: int) -> bool: - if n < 2: - return n == 1 - - if n % 2 == 0: - return self.isUgly(n // 2) - - elif n % 3 == 0: - return self.isUgly(n // 3) - - elif n % 5 == 0: - return self.isUgly(n // 5) - \ No newline at end of file diff --git a/2634-minimum-common-value/2024-03-09 15.00.41 - Accepted - runtime 335ms - memory 42.6MB.py b/2634-minimum-common-value/2024-03-09 15.00.41 - Accepted - runtime 335ms - memory 42.6MB.py deleted file mode 100644 index f181be3..0000000 --- a/2634-minimum-common-value/2024-03-09 15.00.41 - Accepted - runtime 335ms - memory 42.6MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def getCommon(self, nums1: List[int], nums2: List[int]) -> int: - return min((set(nums1) & set(nums2)) or [-1]) - \ No newline at end of file diff --git a/2663-distribute-money-to-maximum-children/2024-04-08 23.37.51 - Accepted - runtime 44ms - memory 16.7MB.py b/2663-distribute-money-to-maximum-children/2024-04-08 23.37.51 - Accepted - runtime 44ms - memory 16.7MB.py deleted file mode 100644 index e0a7e86..0000000 --- a/2663-distribute-money-to-maximum-children/2024-04-08 23.37.51 - Accepted - runtime 44ms - memory 16.7MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def distMoney(self, money: int, children: int) -> int: - money -= children - if money < 0: - return -1 - if money // 7 == children and money % 7 == 0: - return children - if money // 7 == children - 1 and money % 7 == 3: - return children - 2 - return min(children - 1, money // 7) \ No newline at end of file diff --git a/268-missing-number/2022-07-01 10.25.51 - Accepted - runtime 143ms - memory 15.2MB.py b/268-missing-number/2022-07-01 10.25.51 - Accepted - runtime 143ms - memory 15.2MB.py deleted file mode 100644 index f930bf9..0000000 --- a/268-missing-number/2022-07-01 10.25.51 - Accepted - runtime 143ms - memory 15.2MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def missingNumber(self, nums: List[int]) -> int: - n = len(nums) - return (n * (n + 1) // 2) - sum(nums) \ No newline at end of file diff --git a/268-missing-number/2024-02-20 10.35.25 - Accepted - runtime 16ms - memory 20.3MB.cpp b/268-missing-number/2024-02-20 10.35.25 - Accepted - runtime 16ms - memory 20.3MB.cpp deleted file mode 100644 index 07b0265..0000000 --- a/268-missing-number/2024-02-20 10.35.25 - Accepted - runtime 16ms - memory 20.3MB.cpp +++ /dev/null @@ -1,9 +0,0 @@ -class Solution { -public: - int missingNumber(vector& nums) { - int n = nums.size(); - int sum = 0; - for (int num : nums) sum += num; - return (n * (n + 1) / 2) - sum; - } -}; \ No newline at end of file diff --git a/268-missing-number/2024-02-20 10.36.25 - Accepted - runtime 15ms - memory 20.3MB.cpp b/268-missing-number/2024-02-20 10.36.25 - Accepted - runtime 15ms - memory 20.3MB.cpp deleted file mode 100644 index 8422a7e..0000000 --- a/268-missing-number/2024-02-20 10.36.25 - Accepted - runtime 15ms - memory 20.3MB.cpp +++ /dev/null @@ -1,12 +0,0 @@ -class Solution { -public: - int missingNumber(vector& nums) { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - int n=nums.size(); - int sum; - sum=(n*(n+1))/2; - int ans=sum-accumulate(nums.begin(),nums.end(),0); - return ans; - } -}; \ No newline at end of file diff --git a/27-remove-element/2022-04-25 12.32.43 - Accepted - runtime 44ms - memory 14MB.py b/27-remove-element/2022-04-25 12.32.43 - Accepted - runtime 44ms - memory 14MB.py deleted file mode 100644 index 2ad1494..0000000 --- a/27-remove-element/2022-04-25 12.32.43 - Accepted - runtime 44ms - memory 14MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def removeElement(self, nums: List[int], val: int) -> int: - for i in nums.copy(): - if i == val:nums.remove(i) - return len(nums) \ No newline at end of file diff --git a/27-remove-element/2022-04-25 12.32.51 - Accepted - runtime 42ms - memory 13.9MB.py b/27-remove-element/2022-04-25 12.32.51 - Accepted - runtime 42ms - memory 13.9MB.py deleted file mode 100644 index 2ad1494..0000000 --- a/27-remove-element/2022-04-25 12.32.51 - Accepted - runtime 42ms - memory 13.9MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def removeElement(self, nums: List[int], val: int) -> int: - for i in nums.copy(): - if i == val:nums.remove(i) - return len(nums) \ No newline at end of file diff --git a/27-remove-element/2022-04-25 12.33.28 - Accepted - runtime 47ms - memory 13.9MB.py b/27-remove-element/2022-04-25 12.33.28 - Accepted - runtime 47ms - memory 13.9MB.py deleted file mode 100644 index 2df92c0..0000000 --- a/27-remove-element/2022-04-25 12.33.28 - Accepted - runtime 47ms - memory 13.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def removeElement(self, nums: List[int], val: int) -> int: - k = 0 - for i in nums.copy(): - if i == val:nums.remove(i) - else:k += 1 - return k \ No newline at end of file diff --git a/27-remove-element/2022-04-25 12.33.34 - Accepted - runtime 36ms - memory 13.9MB.py b/27-remove-element/2022-04-25 12.33.34 - Accepted - runtime 36ms - memory 13.9MB.py deleted file mode 100644 index 2df92c0..0000000 --- a/27-remove-element/2022-04-25 12.33.34 - Accepted - runtime 36ms - memory 13.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def removeElement(self, nums: List[int], val: int) -> int: - k = 0 - for i in nums.copy(): - if i == val:nums.remove(i) - else:k += 1 - return k \ No newline at end of file diff --git a/27-remove-element/2024-02-17 12.44.13 - Accepted - runtime 0ms - memory 10.4MB.cpp b/27-remove-element/2024-02-17 12.44.13 - Accepted - runtime 0ms - memory 10.4MB.cpp deleted file mode 100644 index 617417c..0000000 --- a/27-remove-element/2024-02-17 12.44.13 - Accepted - runtime 0ms - memory 10.4MB.cpp +++ /dev/null @@ -1,11 +0,0 @@ -class Solution { -public: - int removeElement(vector& nums, int val) { - int r = 0; - for (int ind=0;ind < nums.size();){ - if (nums[ind] == val)nums.erase(nums.begin()+ind); - else{r++; ind++;} - } - return r; - } -}; \ No newline at end of file diff --git a/2722-prime-in-diagonal/2024-01-05 23.09.49 - Accepted - runtime 646ms - memory 29.3MB.py b/2722-prime-in-diagonal/2024-01-05 23.09.49 - Accepted - runtime 646ms - memory 29.3MB.py deleted file mode 100644 index 74460b4..0000000 --- a/2722-prime-in-diagonal/2024-01-05 23.09.49 - Accepted - runtime 646ms - memory 29.3MB.py +++ /dev/null @@ -1,19 +0,0 @@ -def is_prime_optimized(n: int) -> bool: - if n % 2 == 0 or n < 2: - return n == 2 - d = 3 - while d * d <= n: - if n % d == 0: - return False - d += 2 - return True -class Solution: - def diagonalPrime(self, nums: List[List[int]]) -> int: - l = 0 - for i in range(len(nums)): - if is_prime_optimized(nums[i][i]) and nums[i][i] > l: - l = nums[i][i] - if is_prime_optimized(nums[i][~i]) and nums[i][~i] > l: - l = nums[i][~i] - - return l \ No newline at end of file diff --git a/278-first-bad-version/2022-07-17 16.26.10 - Accepted - runtime 22ms - memory 13.9MB.py b/278-first-bad-version/2022-07-17 16.26.10 - Accepted - runtime 22ms - memory 13.9MB.py deleted file mode 100644 index 4ee9144..0000000 --- a/278-first-bad-version/2022-07-17 16.26.10 - Accepted - runtime 22ms - memory 13.9MB.py +++ /dev/null @@ -1,12 +0,0 @@ -# def isBadVersion(version: int) -> bool: - -class Solution: - def firstBadVersion(self, n: int) -> int: - left, right = 1, n - while left < right: - mid = left + (right - left) // 2 - if isBadVersion(mid): - right = mid - else: - left = mid + 1 - return left \ No newline at end of file diff --git a/279-perfect-squares/2022-11-22 23.19.39 - Accepted - runtime 37ms - memory 13.9MB.py b/279-perfect-squares/2022-11-22 23.19.39 - Accepted - runtime 37ms - memory 13.9MB.py deleted file mode 100644 index 9e2fab2..0000000 --- a/279-perfect-squares/2022-11-22 23.19.39 - Accepted - runtime 37ms - memory 13.9MB.py +++ /dev/null @@ -1,29 +0,0 @@ -class Solution: - def numSquares(self, n: int) -> int: - if (n ** .5) % 1 == 0: - return 1 - - def CheckTwo(c): - while c%2==0: c=c//2 - while c%5==0: c=c//5 - while c%9==0: c=c//9 - - if c%3==0: return False - - if c in (0,1,13,17): return True - - i, j = 0, int(c**.5) - - while i <= j: - if i*i + j*j == c: return True - if i*i + j*j < c: i += 1 - if i*i + j*j > c: j -= 1 - - return False - - if CheckTwo(n): return 2 - - while not n%4: n//=4 # case k = 3 - if n%8 != 7: return 3 - - return 4 # case k = 4 \ No newline at end of file diff --git a/279-perfect-squares/2022-11-22 23.22.56 - Accepted - runtime 70ms - memory 13.9MB.py b/279-perfect-squares/2022-11-22 23.22.56 - Accepted - runtime 70ms - memory 13.9MB.py deleted file mode 100644 index c6e3893..0000000 --- a/279-perfect-squares/2022-11-22 23.22.56 - Accepted - runtime 70ms - memory 13.9MB.py +++ /dev/null @@ -1,31 +0,0 @@ -class Solution: - def numSquares(self, n: int) -> int: - if (n ** .5) % 1 == 0: - return 1 - - def CheckTwo(c): - if c % 2 == 0: - c >>= int(math.log(c & -c, 2)) - - while c%5==0: c=c//5 - while c%9==0: c=c//9 - - if c%3==0: return False - - if c in (0,1,13,17): return True - - i, j = 0, int(c**.5) - - while i <= j: - if i*i + j*j == c: return True - if i*i + j*j < c: i += 1 - if i*i + j*j > c: j -= 1 - - return False - - if CheckTwo(n): return 2 - - while not n%4: n//=4 # case k = 3 - if n%8 != 7: return 3 - - return 4 # case k = 4 \ No newline at end of file diff --git a/279-perfect-squares/2022-11-22 23.23.41 - Accepted - runtime 47ms - memory 13.9MB.py b/279-perfect-squares/2022-11-22 23.23.41 - Accepted - runtime 47ms - memory 13.9MB.py deleted file mode 100644 index 0a8bc37..0000000 --- a/279-perfect-squares/2022-11-22 23.23.41 - Accepted - runtime 47ms - memory 13.9MB.py +++ /dev/null @@ -1,33 +0,0 @@ -class Solution: - def numSquares(self, n: int) -> int: - if (n ** .5) % 1 == 0: - return 1 - - def CheckTwo(c): - if c % 2 == 0: - c >>= int(math.log(c & -c, 2)) - - if c % 5 == 0: - c >>= int(math.log(c & -c, 5)) - - while c%9==0: c=c//9 - - if c%3==0: return False - - if c in (0,1,13,17): return True - - i, j = 0, int(c**.5) - - while i <= j: - if i*i + j*j == c: return True - if i*i + j*j < c: i += 1 - if i*i + j*j > c: j -= 1 - - return False - - if CheckTwo(n): return 2 - - while not n%4: n//=4 # case k = 3 - if n%8 != 7: return 3 - - return 4 # case k = 4 \ No newline at end of file diff --git a/279-perfect-squares/2022-11-22 23.54.47 - Accepted - runtime 50ms - memory 14MB.py b/279-perfect-squares/2022-11-22 23.54.47 - Accepted - runtime 50ms - memory 14MB.py deleted file mode 100644 index c4bc22f..0000000 --- a/279-perfect-squares/2022-11-22 23.54.47 - Accepted - runtime 50ms - memory 14MB.py +++ /dev/null @@ -1,34 +0,0 @@ -class Solution: - def numSquares(self, n: int) -> int: - if (n ** .5) % 1 == 0: - return 1 - - while 2: - c = n - for i in (2, 5): - if c % i == 0: - c >>= int(math.log(c & -c, i)) - - while c % 9 == 0: - c //= 9 - - if c % 3 == 0: - break - - if c in {0, 1, 13, 17}: - return 2 - - i, j = 0, int(c**.5) - - while i <= j: - temp = i * i + j * j - if temp == c: return 2 - elif temp > c: j-= 1 - else: i += 1 - - break - - while n % 4 == 0: - n //= 4 - - return 3 if n % 8 != 7 else 4 \ No newline at end of file diff --git a/2793-count-the-number-of-complete-components/2024-04-26 17.02.35 - Accepted - runtime 496ms - memory 17MB.py b/2793-count-the-number-of-complete-components/2024-04-26 17.02.35 - Accepted - runtime 496ms - memory 17MB.py deleted file mode 100644 index 59fd18f..0000000 --- a/2793-count-the-number-of-complete-components/2024-04-26 17.02.35 - Accepted - runtime 496ms - memory 17MB.py +++ /dev/null @@ -1,22 +0,0 @@ -class Solution: - def countCompleteComponents(self, n: int, edges: List[List[int]]) -> int: - d = [[] for i in range(n)] - for a,b in edges: - d[a].append(b) - d[b].append(a) - - visited = [0] * n - res = 0 - for i in range(n): - if visited[i]: continue - bfs = [i] - visited[i] = 1 - for j in bfs: - for k in d[j]: - if not visited[k]: - bfs.append(k) - visited[k] = 1 - if all(len(d[j]) == len(bfs) - 1 for j in bfs): - res += 1 - - return res \ No newline at end of file diff --git a/28-find-the-index-of-the-first-occurrence-in-a-string/2022-04-25 16.30.49 - Accepted - runtime 52ms - memory 13.9MB.py b/28-find-the-index-of-the-first-occurrence-in-a-string/2022-04-25 16.30.49 - Accepted - runtime 52ms - memory 13.9MB.py deleted file mode 100644 index 18359d3..0000000 --- a/28-find-the-index-of-the-first-occurrence-in-a-string/2022-04-25 16.30.49 - Accepted - runtime 52ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def strStr(self, haystack: str, needle: str) -> int: - return haystack.find(needle) \ No newline at end of file diff --git a/28-find-the-index-of-the-first-occurrence-in-a-string/2024-02-17 12.48.04 - Accepted - runtime 0ms - memory 7.5MB.cpp b/28-find-the-index-of-the-first-occurrence-in-a-string/2024-02-17 12.48.04 - Accepted - runtime 0ms - memory 7.5MB.cpp deleted file mode 100644 index baab8db..0000000 --- a/28-find-the-index-of-the-first-occurrence-in-a-string/2024-02-17 12.48.04 - Accepted - runtime 0ms - memory 7.5MB.cpp +++ /dev/null @@ -1,6 +0,0 @@ -class Solution { -public: - int strStr(string haystack, string needle) { - return haystack.find(needle); - } -}; \ No newline at end of file diff --git a/2812-find-the-maximum-achievable-number/2024-02-02 19.17.17 - Accepted - runtime 45ms - memory 16.5MB.py b/2812-find-the-maximum-achievable-number/2024-02-02 19.17.17 - Accepted - runtime 45ms - memory 16.5MB.py deleted file mode 100644 index b41b407..0000000 --- a/2812-find-the-maximum-achievable-number/2024-02-02 19.17.17 - Accepted - runtime 45ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def theMaximumAchievableX(self, num: int, t: int) -> int: - return num + t * 2 \ No newline at end of file diff --git a/2820-return-length-of-arguments-passed/2024-02-11 14.21.02 - Accepted - runtime 55ms - memory 48.7MB.js b/2820-return-length-of-arguments-passed/2024-02-11 14.21.02 - Accepted - runtime 55ms - memory 48.7MB.js deleted file mode 100644 index d46e2ff..0000000 --- a/2820-return-length-of-arguments-passed/2024-02-11 14.21.02 - Accepted - runtime 55ms - memory 48.7MB.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @param {...(null|boolean|number|string|Array|Object)} args - * @return {number} - */ -var argumentsLength = function(...args) { - return args.length -}; - -/** - * argumentsLength(1, 2, 3); // 3 - */ \ No newline at end of file diff --git a/283-move-zeroes/2022-07-01 18.36.22 - Accepted - runtime 262ms - memory 15.6MB.py b/283-move-zeroes/2022-07-01 18.36.22 - Accepted - runtime 262ms - memory 15.6MB.py deleted file mode 100644 index 4cbe77a..0000000 --- a/283-move-zeroes/2022-07-01 18.36.22 - Accepted - runtime 262ms - memory 15.6MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def moveZeroes(self, nums: List[int]) -> None: - r = 0 - for i in range(len(nums)): - if nums[i]: - nums[r], nums[i] = nums[i], nums[r] - r += 1 \ No newline at end of file diff --git a/2859-add-two-promises/2024-04-01 14.36.19 - Accepted - runtime 55ms - memory 50.4MB.js b/2859-add-two-promises/2024-04-01 14.36.19 - Accepted - runtime 55ms - memory 50.4MB.js deleted file mode 100644 index 5d4a884..0000000 --- a/2859-add-two-promises/2024-04-01 14.36.19 - Accepted - runtime 55ms - memory 50.4MB.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @param {Promise} promise1 - * @param {Promise} promise2 - * @return {Promise} - */ -var addTwoPromises = async function(promise1, promise2) { - return await promise1 + await promise2; -}; - -/** - * addTwoPromises(Promise.resolve(2), Promise.resolve(2)) - * .then(console.log); // 4 - */ \ No newline at end of file diff --git a/2860-sort-by/2024-04-17 22.44.39 - Accepted - runtime 128ms - memory 66.2MB.js b/2860-sort-by/2024-04-17 22.44.39 - Accepted - runtime 128ms - memory 66.2MB.js deleted file mode 100644 index 361a992..0000000 --- a/2860-sort-by/2024-04-17 22.44.39 - Accepted - runtime 128ms - memory 66.2MB.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @param {Array} arr - * @param {Function} fn - * @return {Array} - */ -var sortBy = function(arr, fn) { - return arr.sort((a, b) => fn(a) - fn(b)); -}; \ No newline at end of file diff --git a/287-find-the-duplicate-number/2023-01-11 20.37.21 - Accepted - runtime 593ms - memory 30.2MB.py b/287-find-the-duplicate-number/2023-01-11 20.37.21 - Accepted - runtime 593ms - memory 30.2MB.py deleted file mode 100644 index b17c5db..0000000 --- a/287-find-the-duplicate-number/2023-01-11 20.37.21 - Accepted - runtime 593ms - memory 30.2MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def findDuplicate(self, nums: List[int]) -> int: - n = set() - for i in nums: - if i in n: - return i - n.add(i) \ No newline at end of file diff --git a/287-find-the-duplicate-number/2024-02-15 22.16.06 - Accepted - runtime 463ms - memory 32.8MB.py b/287-find-the-duplicate-number/2024-02-15 22.16.06 - Accepted - runtime 463ms - memory 32.8MB.py deleted file mode 100644 index a8fd7cb..0000000 --- a/287-find-the-duplicate-number/2024-02-15 22.16.06 - Accepted - runtime 463ms - memory 32.8MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def findDuplicate(self, nums: List[int]) -> int: - d = set() - for i in nums: - if i in d: return i - d.add(i) - - - return i \ No newline at end of file diff --git a/287-find-the-duplicate-number/2024-03-24 21.04.20 - Accepted - runtime 438ms - memory 32.7MB.py b/287-find-the-duplicate-number/2024-03-24 21.04.20 - Accepted - runtime 438ms - memory 32.7MB.py deleted file mode 100644 index a8fd7cb..0000000 --- a/287-find-the-duplicate-number/2024-03-24 21.04.20 - Accepted - runtime 438ms - memory 32.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def findDuplicate(self, nums: List[int]) -> int: - d = set() - for i in nums: - if i in d: return i - d.add(i) - - - return i \ No newline at end of file diff --git a/2871-double-a-number-represented-as-a-linked-list/2024-05-07 10.18.31 - Accepted - runtime 323ms - memory 20.2MB.py b/2871-double-a-number-represented-as-a-linked-list/2024-05-07 10.18.31 - Accepted - runtime 323ms - memory 20.2MB.py deleted file mode 100644 index 0e0ba03..0000000 --- a/2871-double-a-number-represented-as-a-linked-list/2024-05-07 10.18.31 - Accepted - runtime 323ms - memory 20.2MB.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -sys.set_int_max_str_digits(int(1e5)) -class Solution: - def doubleIt(self, head: Optional[ListNode]) -> Optional[ListNode]: - r = '' - while head: - r += str(head.val) - head = head.next - - r = str(int(r) * 2) - head = ListNode(r[0]) - prev = head - for i in range(1, len(r)): - temp = ListNode(r[i]) - prev.next = temp - prev = temp - - return head diff --git a/2871-double-a-number-represented-as-a-linked-list/2024-05-07 10.29.41 - Accepted - runtime 235ms - memory 19.4MB.py b/2871-double-a-number-represented-as-a-linked-list/2024-05-07 10.29.41 - Accepted - runtime 235ms - memory 19.4MB.py deleted file mode 100644 index 4639989..0000000 --- a/2871-double-a-number-represented-as-a-linked-list/2024-05-07 10.29.41 - Accepted - runtime 235ms - memory 19.4MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def doubleIt(self, head: Optional[ListNode]) -> Optional[ListNode]: - if head.val > 4: - head = ListNode(0, head) - - node = head - while node: - node.val = (node.val * 2) % 10 - if node.next and node.next.val > 4: - node.val += 1 - node = node.next - - return head \ No newline at end of file diff --git a/2876-number-of-employees-who-met-the-target/2024-04-01 14.43.54 - Accepted - runtime 47ms - memory 16.5MB.py b/2876-number-of-employees-who-met-the-target/2024-04-01 14.43.54 - Accepted - runtime 47ms - memory 16.5MB.py deleted file mode 100644 index 980cd3b..0000000 --- a/2876-number-of-employees-who-met-the-target/2024-04-01 14.43.54 - Accepted - runtime 47ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def numberOfEmployeesWhoMetTarget(self, hours: List[int], target: int) -> int: - return sum(f >= target for f in hours) \ No newline at end of file diff --git a/2881-split-strings-by-separator/2024-04-06 11.03.49 - Accepted - runtime 91ms - memory 16.5MB.py b/2881-split-strings-by-separator/2024-04-06 11.03.49 - Accepted - runtime 91ms - memory 16.5MB.py deleted file mode 100644 index f70034c..0000000 --- a/2881-split-strings-by-separator/2024-04-06 11.03.49 - Accepted - runtime 91ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def splitWordsBySeparator(self, words: List[str], separator: str) -> List[str]: - return filter(lambda x: x, separator.join(words).split(separator)) \ No newline at end of file diff --git a/2887-sort-vowels-in-a-string/2024-04-06 11.00.30 - Accepted - runtime 131ms - memory 18.8MB.py b/2887-sort-vowels-in-a-string/2024-04-06 11.00.30 - Accepted - runtime 131ms - memory 18.8MB.py deleted file mode 100644 index 8897e8a..0000000 --- a/2887-sort-vowels-in-a-string/2024-04-06 11.00.30 - Accepted - runtime 131ms - memory 18.8MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def sortVowels(self, s: str) -> str: - r = '' - l = sorted(f for f in s if f in 'aeiouAEIOU') - v = 0 - for i in s: - if i in 'aeiouAEIOU': - r += l[v] - v += 1 - else: - r += i - - return r \ No newline at end of file diff --git a/29-divide-two-integers/2023-04-02 15.57.24 - Accepted - runtime 40ms - memory 13.9MB.py b/29-divide-two-integers/2023-04-02 15.57.24 - Accepted - runtime 40ms - memory 13.9MB.py deleted file mode 100644 index f764ab2..0000000 --- a/29-divide-two-integers/2023-04-02 15.57.24 - Accepted - runtime 40ms - memory 13.9MB.py +++ /dev/null @@ -1,6 +0,0 @@ -HI = 2 ** 31 - 1 -LO = -2 ** 31 -class Solution: - def divide(self, dividend: int, divisor: int) -> int: - s = int(dividend / divisor) - return min(max(s, LO), HI) \ No newline at end of file diff --git a/290-word-pattern/2022-07-18 20.19.03 - Accepted - runtime 42ms - memory 14MB.py b/290-word-pattern/2022-07-18 20.19.03 - Accepted - runtime 42ms - memory 14MB.py deleted file mode 100644 index 0ed7258..0000000 --- a/290-word-pattern/2022-07-18 20.19.03 - Accepted - runtime 42ms - memory 14MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def wordPattern(self, pattern: str, s: str) -> bool: - D = {} - B = s.split() - if len(pattern) != len(B):return False - for a,b in zip(pattern, B): - if a in D: - if D[a] != b:return False - else:D[a] = b - return len(D.values()) == len(set(D.values())) \ No newline at end of file diff --git a/290-word-pattern/2022-07-18 20.32.42 - Accepted - runtime 53ms - memory 13.9MB.py b/290-word-pattern/2022-07-18 20.32.42 - Accepted - runtime 53ms - memory 13.9MB.py deleted file mode 100644 index f814e2d..0000000 --- a/290-word-pattern/2022-07-18 20.32.42 - Accepted - runtime 53ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def wordPattern(self, pattern: str, s: str) -> bool: - return len(pattern) == len(s := s.split()) and list(map(pattern.index, pattern)) == list(map(s.index, s)) \ No newline at end of file diff --git a/290-word-pattern/2023-01-06 02.01.38 - Accepted - runtime 53ms - memory 14MB.py b/290-word-pattern/2023-01-06 02.01.38 - Accepted - runtime 53ms - memory 14MB.py deleted file mode 100644 index 95d82cb..0000000 --- a/290-word-pattern/2023-01-06 02.01.38 - Accepted - runtime 53ms - memory 14MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def wordPattern(self, p: str, s: str) -> bool: - s = s.split() - return all(p.index(a) == s.index(b)for a,b in zip(p, s)) if len(s) == len(p) else False \ No newline at end of file diff --git a/2903-insert-greatest-common-divisors-in-linked-list/2024-04-17 22.49.19 - Accepted - runtime 54ms - memory 19.6MB.py b/2903-insert-greatest-common-divisors-in-linked-list/2024-04-17 22.49.19 - Accepted - runtime 54ms - memory 19.6MB.py deleted file mode 100644 index 5ac5455..0000000 --- a/2903-insert-greatest-common-divisors-in-linked-list/2024-04-17 22.49.19 - Accepted - runtime 54ms - memory 19.6MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def insertGreatestCommonDivisors(self, head: Optional[ListNode]) -> Optional[ListNode]: - curr = head - while curr and curr.next: - next_tmp = curr.next - curr.next = ListNode(math.gcd(curr.val, next_tmp.val)) - curr.next.next = next_tmp - curr = next_tmp - return head \ No newline at end of file diff --git a/292-nim-game/2024-04-01 15.51.32 - Accepted - runtime 37ms - memory 16.5MB.py b/292-nim-game/2024-04-01 15.51.32 - Accepted - runtime 37ms - memory 16.5MB.py deleted file mode 100644 index 3bd121c..0000000 --- a/292-nim-game/2024-04-01 15.51.32 - Accepted - runtime 37ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def canWinNim(self, n: int) -> bool: - return n % 4 \ No newline at end of file diff --git a/3-longest-substring-without-repeating-characters/2022-10-07 20.32.16 - Accepted - runtime 118ms - memory 13.9MB.py b/3-longest-substring-without-repeating-characters/2022-10-07 20.32.16 - Accepted - runtime 118ms - memory 13.9MB.py deleted file mode 100644 index c859aff..0000000 --- a/3-longest-substring-without-repeating-characters/2022-10-07 20.32.16 - Accepted - runtime 118ms - memory 13.9MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def lengthOfLongestSubstring(self, s: str) -> int: - visited = {} - start = res = 0 - for i in range(len(s)): - if s[i] in visited: - start = max(start, visited[s[i]] + 1) - visited[s[i]] = i - res = max(res, i - start + 1) - return res \ No newline at end of file diff --git a/300-longest-increasing-subsequence/2024-04-27 18.35.54 - Accepted - runtime 1107ms - memory 17MB.py b/300-longest-increasing-subsequence/2024-04-27 18.35.54 - Accepted - runtime 1107ms - memory 17MB.py deleted file mode 100644 index 096c2fb..0000000 --- a/300-longest-increasing-subsequence/2024-04-27 18.35.54 - Accepted - runtime 1107ms - memory 17MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def lengthOfLIS(self, nums: List[int]) -> int: - dp = [1] * len(nums) - for i in range(1, len(nums)): - dp[i] = 1 + max([dp[f] for f in range(i)if nums[i] > nums[f]]or [0]) - - return max(dp) diff --git a/300-longest-increasing-subsequence/2024-04-27 18.39.01 - Accepted - runtime 1105ms - memory 17MB.py b/300-longest-increasing-subsequence/2024-04-27 18.39.01 - Accepted - runtime 1105ms - memory 17MB.py deleted file mode 100644 index bd35b54..0000000 --- a/300-longest-increasing-subsequence/2024-04-27 18.39.01 - Accepted - runtime 1105ms - memory 17MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def lengthOfLIS(self, nums: List[int]) -> int: - dp = [1] * len(nums) - r = 1 - for i in range(1, len(nums)): - dp[i] = 1 + max([dp[f] for f in range(i)if nums[i] > nums[f]]or [0]) - r = max(r, dp[i]) - - return r diff --git a/303-range-sum-query-immutable/2024-03-14 00.10.11 - Accepted - runtime 794ms - memory 19.9MB.py b/303-range-sum-query-immutable/2024-03-14 00.10.11 - Accepted - runtime 794ms - memory 19.9MB.py deleted file mode 100644 index 1801b94..0000000 --- a/303-range-sum-query-immutable/2024-03-14 00.10.11 - Accepted - runtime 794ms - memory 19.9MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class NumArray: - - def __init__(self, nums: List[int]): - self.s = nums - - def sumRange(self, left: int, right: int) -> int: - return sum(self.s[left:right + 1]) - - -# Your NumArray object will be instantiated and called as such: -# obj = NumArray(nums) -# param_1 = obj.sumRange(left,right) \ No newline at end of file diff --git a/303-range-sum-query-immutable/2024-03-14 00.11.29 - Accepted - runtime 65ms - memory 20.1MB.py b/303-range-sum-query-immutable/2024-03-14 00.11.29 - Accepted - runtime 65ms - memory 20.1MB.py deleted file mode 100644 index 9191b5f..0000000 --- a/303-range-sum-query-immutable/2024-03-14 00.11.29 - Accepted - runtime 65ms - memory 20.1MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class NumArray: - - def __init__(self, nums: List[int]): - self.s = [0] + list(accumulate(nums)) - - def sumRange(self, left: int, right: int) -> int: - return self.s[right + 1] - self.s[left] - - -# Your NumArray object will be instantiated and called as such: -# obj = NumArray(nums) -# param_1 = obj.sumRange(left,right) \ No newline at end of file diff --git a/3055-maximum-odd-binary-number/2024-03-01 15.35.35 - Accepted - runtime 37ms - memory 16.5MB.py b/3055-maximum-odd-binary-number/2024-03-01 15.35.35 - Accepted - runtime 37ms - memory 16.5MB.py deleted file mode 100644 index a2bec85..0000000 --- a/3055-maximum-odd-binary-number/2024-03-01 15.35.35 - Accepted - runtime 37ms - memory 16.5MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def maximumOddBinaryNumber(self, s: str) -> str: - o = s.count("1") - z = len(s) - o - - return "1" * (o - 1) + "0" * z + "1" \ No newline at end of file diff --git a/3055-maximum-odd-binary-number/2024-03-01 15.38.05 - Accepted - runtime 0ms - memory 9.2MB.cpp b/3055-maximum-odd-binary-number/2024-03-01 15.38.05 - Accepted - runtime 0ms - memory 9.2MB.cpp deleted file mode 100644 index 2d3c7f5..0000000 --- a/3055-maximum-odd-binary-number/2024-03-01 15.38.05 - Accepted - runtime 0ms - memory 9.2MB.cpp +++ /dev/null @@ -1,9 +0,0 @@ -class Solution { -public: - string maximumOddBinaryNumber(string s) { - int o = count(s.begin(), s.end(), '1'); - int z = s.length() - o; - - return string(o - 1, '1') + string(z, '0') + "1"; - } -}; \ No newline at end of file diff --git a/3062-create-a-dataframe-from-list/2024-02-23 23.55.23 - Accepted - runtime 670ms - memory 64.9MB.pd.py b/3062-create-a-dataframe-from-list/2024-02-23 23.55.23 - Accepted - runtime 670ms - memory 64.9MB.pd.py deleted file mode 100644 index ef0468d..0000000 --- a/3062-create-a-dataframe-from-list/2024-02-23 23.55.23 - Accepted - runtime 670ms - memory 64.9MB.pd.py +++ /dev/null @@ -1,5 +0,0 @@ -import pandas as pd - -def createDataframe(student_data: List[List[int]]) -> pd.DataFrame: - return pd.DataFrame(student_data, columns=['student_id', 'age']) - \ No newline at end of file diff --git a/3064-reshape-data-concatenate/2024-04-01 14.37.48 - Accepted - runtime 788ms - memory 65.8MB.pd.py b/3064-reshape-data-concatenate/2024-04-01 14.37.48 - Accepted - runtime 788ms - memory 65.8MB.pd.py deleted file mode 100644 index e91d2ab..0000000 --- a/3064-reshape-data-concatenate/2024-04-01 14.37.48 - Accepted - runtime 788ms - memory 65.8MB.pd.py +++ /dev/null @@ -1,4 +0,0 @@ -import pandas as pd - -def concatenateTables(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.DataFrame: - return pd.concat([df1, df2]) \ No newline at end of file diff --git a/3065-display-the-first-three-rows/2024-04-01 14.31.56 - Accepted - runtime 628ms - memory 65.7MB.pd.py b/3065-display-the-first-three-rows/2024-04-01 14.31.56 - Accepted - runtime 628ms - memory 65.7MB.pd.py deleted file mode 100644 index 5444325..0000000 --- a/3065-display-the-first-three-rows/2024-04-01 14.31.56 - Accepted - runtime 628ms - memory 65.7MB.pd.py +++ /dev/null @@ -1,4 +0,0 @@ -import pandas as pd - -def selectFirstRows(employees: pd.DataFrame) -> pd.DataFrame: - return employees.head(3) \ No newline at end of file diff --git a/3066-create-a-new-column/2024-04-01 14.38.48 - Accepted - runtime 719ms - memory 65.3MB.pd.py b/3066-create-a-new-column/2024-04-01 14.38.48 - Accepted - runtime 719ms - memory 65.3MB.pd.py deleted file mode 100644 index bfa312c..0000000 --- a/3066-create-a-new-column/2024-04-01 14.38.48 - Accepted - runtime 719ms - memory 65.3MB.pd.py +++ /dev/null @@ -1,5 +0,0 @@ -import pandas as pd - -def createBonusColumn(employees: pd.DataFrame) -> pd.DataFrame: - employees['bonus'] = employees.salary * 2 - return employees \ No newline at end of file diff --git a/3067-modify-columns/2024-04-01 14.35.25 - Accepted - runtime 776ms - memory 65.5MB.pd.py b/3067-modify-columns/2024-04-01 14.35.25 - Accepted - runtime 776ms - memory 65.5MB.pd.py deleted file mode 100644 index e153a10..0000000 --- a/3067-modify-columns/2024-04-01 14.35.25 - Accepted - runtime 776ms - memory 65.5MB.pd.py +++ /dev/null @@ -1,5 +0,0 @@ -import pandas as pd - -def modifySalaryColumn(employees: pd.DataFrame) -> pd.DataFrame: - employees.salary *= 2 - return employees \ No newline at end of file diff --git a/3094-minimum-number-of-operations-to-make-array-empty/2024-01-04 23.34.25 - Accepted - runtime 528ms - memory 32.1MB.py b/3094-minimum-number-of-operations-to-make-array-empty/2024-01-04 23.34.25 - Accepted - runtime 528ms - memory 32.1MB.py deleted file mode 100644 index c40b2b6..0000000 --- a/3094-minimum-number-of-operations-to-make-array-empty/2024-01-04 23.34.25 - Accepted - runtime 528ms - memory 32.1MB.py +++ /dev/null @@ -1,7 +0,0 @@ -from collections import Counter -class Solution: - def minOperations(self, nums: List[int]) -> int: - l = Counter(nums).values() - if min(l) == 1: - return -1 - return sum(f // 3 + (f % 3 > 0) for f in l) \ No newline at end of file diff --git a/310-minimum-height-trees/2024-04-23 10.17.55 - Accepted - runtime 520ms - memory 42.1MB.py b/310-minimum-height-trees/2024-04-23 10.17.55 - Accepted - runtime 520ms - memory 42.1MB.py deleted file mode 100644 index edd456a..0000000 --- a/310-minimum-height-trees/2024-04-23 10.17.55 - Accepted - runtime 520ms - memory 42.1MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: - d = collections.defaultdict(set) - for v, w in edges: - d[v].add(w) - d[w].add(v) - - def maxpath(v, visited): - visited.add(v) - paths = [maxpath(w, visited) for w in d[v] if w not in visited] - path = max(paths or [[]], key=len) - path.append(v) - return path - path = maxpath(0, set()) - path = maxpath(path[0], set()) - m = len(path) - return path[(m-1)//2:m//2+1] \ No newline at end of file diff --git a/315-count-of-smaller-numbers-after-self/2022-07-23 11.44.06 - Accepted - runtime 4141ms - memory 41.8MB.py b/315-count-of-smaller-numbers-after-self/2022-07-23 11.44.06 - Accepted - runtime 4141ms - memory 41.8MB.py deleted file mode 100644 index de32bb5..0000000 --- a/315-count-of-smaller-numbers-after-self/2022-07-23 11.44.06 - Accepted - runtime 4141ms - memory 41.8MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class Solution: - def countSmaller(self, nums: List[int]) -> List[int]: - def sort(enum): - half = len(enum) // 2 - if half: - left, right = sort(enum[:half]), sort(enum[half:]) - for i in range(len(enum)): - if not right or left and left[-1][1] > right[-1][1]: - smaller[left[-1][0]] += len(right) - enum[~i] = left.pop() - else: - enum[~i] = right.pop() - return enum - smaller = [0] * len(nums) - sort(list(enumerate(nums))) - return smaller - - \ No newline at end of file diff --git a/3172-divisible-and-non-divisible-sums-difference/2024-02-02 19.21.58 - Accepted - runtime 37ms - memory 16.6MB.py b/3172-divisible-and-non-divisible-sums-difference/2024-02-02 19.21.58 - Accepted - runtime 37ms - memory 16.6MB.py deleted file mode 100644 index 543572e..0000000 --- a/3172-divisible-and-non-divisible-sums-difference/2024-02-02 19.21.58 - Accepted - runtime 37ms - memory 16.6MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def differenceOfSums(self, n: int, m: int) -> int: - a = b = 0 - for i in range(1, n + 1): - if i % m: - a += i - else: - b += i - - return a - b \ No newline at end of file diff --git a/319-bulb-switcher/2023-04-27 09.52.23 - Accepted - runtime 40ms - memory 16.2MB.py b/319-bulb-switcher/2023-04-27 09.52.23 - Accepted - runtime 40ms - memory 16.2MB.py deleted file mode 100644 index 0147c00..0000000 --- a/319-bulb-switcher/2023-04-27 09.52.23 - Accepted - runtime 40ms - memory 16.2MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def bulbSwitch(self, n: int) -> int: - return int(n ** .5) \ No newline at end of file diff --git a/319-bulb-switcher/2023-04-27 09.52.33 - Accepted - runtime 39ms - memory 16.4MB.py b/319-bulb-switcher/2023-04-27 09.52.33 - Accepted - runtime 39ms - memory 16.4MB.py deleted file mode 100644 index 0147c00..0000000 --- a/319-bulb-switcher/2023-04-27 09.52.33 - Accepted - runtime 39ms - memory 16.4MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def bulbSwitch(self, n: int) -> int: - return int(n ** .5) \ No newline at end of file diff --git a/319-bulb-switcher/2023-04-27 09.52.40 - Accepted - runtime 50ms - memory 16.4MB.py b/319-bulb-switcher/2023-04-27 09.52.40 - Accepted - runtime 50ms - memory 16.4MB.py deleted file mode 100644 index 0147c00..0000000 --- a/319-bulb-switcher/2023-04-27 09.52.40 - Accepted - runtime 50ms - memory 16.4MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def bulbSwitch(self, n: int) -> int: - return int(n ** .5) \ No newline at end of file diff --git a/319-bulb-switcher/2023-04-27 09.53.18 - Accepted - runtime 55ms - memory 16.3MB.py b/319-bulb-switcher/2023-04-27 09.53.18 - Accepted - runtime 55ms - memory 16.3MB.py deleted file mode 100644 index 949f536..0000000 --- a/319-bulb-switcher/2023-04-27 09.53.18 - Accepted - runtime 55ms - memory 16.3MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def bulbSwitch(self, n: int) -> int: - return int(math.sqrt(n)) \ No newline at end of file diff --git a/3194-find-words-containing-character/2024-02-02 19.20.05 - Accepted - runtime 75ms - memory 16.7MB.py b/3194-find-words-containing-character/2024-02-02 19.20.05 - Accepted - runtime 75ms - memory 16.7MB.py deleted file mode 100644 index 7bd1fb9..0000000 --- a/3194-find-words-containing-character/2024-02-02 19.20.05 - Accepted - runtime 75ms - memory 16.7MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findWordsContaining(self, words: List[str], x: str) -> List[int]: - return [f for f in range(len(words)) if x in words[f]] diff --git a/32-longest-valid-parentheses/2024-04-16 11.12.23 - Accepted - runtime 46ms - memory 17.4MB.py b/32-longest-valid-parentheses/2024-04-16 11.12.23 - Accepted - runtime 46ms - memory 17.4MB.py deleted file mode 100644 index db9139e..0000000 --- a/32-longest-valid-parentheses/2024-04-16 11.12.23 - Accepted - runtime 46ms - memory 17.4MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def longestValidParentheses(self, s: str) -> int: - dp, st = [0] * (len(s) + 1), [] - for i in range(len(s)): - if s[i] == '(':st.append(i) - else: - if st: - p = st.pop() - dp[i + 1] = dp[p] + i - p + 1 - - return max(dp) \ No newline at end of file diff --git a/3213-count-subarrays-where-max-element-appears-at-least-k-times/2024-03-29 12.15.06 - Accepted - runtime 896ms - memory 31.4MB.py b/3213-count-subarrays-where-max-element-appears-at-least-k-times/2024-03-29 12.15.06 - Accepted - runtime 896ms - memory 31.4MB.py deleted file mode 100644 index 57cda8b..0000000 --- a/3213-count-subarrays-where-max-element-appears-at-least-k-times/2024-03-29 12.15.06 - Accepted - runtime 896ms - memory 31.4MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def countSubarrays(self, nums: List[int], k: int) -> int: - count = res = left = 0 - m = max(nums) - for right in range(len(nums)): - count += nums[right] == m - while count == k: - count -= nums[left] == m - left += 1 - res += left - - return res - \ No newline at end of file diff --git a/3225-length-of-longest-subarray-with-at-most-k-frequency/2024-03-28 12.07.07 - Accepted - runtime 1276ms - memory 31.1MB.py b/3225-length-of-longest-subarray-with-at-most-k-frequency/2024-03-28 12.07.07 - Accepted - runtime 1276ms - memory 31.1MB.py deleted file mode 100644 index f595a54..0000000 --- a/3225-length-of-longest-subarray-with-at-most-k-frequency/2024-03-28 12.07.07 - Accepted - runtime 1276ms - memory 31.1MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def maxSubarrayLength(self, nums: List[int], k: int) -> int: - c = Counter() - res = left = 0 - for right in range(len(nums)): - c[nums[right]] += 1 - while c[nums[right]] > k: - c[nums[left]] -= 1 - left += 1 - - res = max(res, right - left + 1) - - return res \ No newline at end of file diff --git a/3225-length-of-longest-subarray-with-at-most-k-frequency/2024-03-28 22.35.20 - Accepted - runtime 1249ms - memory 31.2MB.py b/3225-length-of-longest-subarray-with-at-most-k-frequency/2024-03-28 22.35.20 - Accepted - runtime 1249ms - memory 31.2MB.py deleted file mode 100644 index dc11175..0000000 --- a/3225-length-of-longest-subarray-with-at-most-k-frequency/2024-03-28 22.35.20 - Accepted - runtime 1249ms - memory 31.2MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def maxSubarrayLength(self, nums: List[int], k: int) -> int: - c = Counter() - left = res = 0 - for right in range(len(nums)): - c[nums[right]] += 1 - while c[nums[right]] > k and right >= left: - c[nums[left]] -= 1 - left += 1 - - res = max(res, right - left + 1) - - return res \ No newline at end of file diff --git a/3242-count-elements-with-maximum-frequency/2024-03-08 12.18.45 - Accepted - runtime 38ms - memory 16.6MB.py b/3242-count-elements-with-maximum-frequency/2024-03-08 12.18.45 - Accepted - runtime 38ms - memory 16.6MB.py deleted file mode 100644 index b88c6c8..0000000 --- a/3242-count-elements-with-maximum-frequency/2024-03-08 12.18.45 - Accepted - runtime 38ms - memory 16.6MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def maxFrequencyElements(self, nums: List[int]) -> int: - c = Counter(nums) - m = c.most_common(1)[0][1] - return sum(v for k,v in c.items() if v == m) - \ No newline at end of file diff --git a/3249-minimum-number-of-operations-to-make-array-xor-equal-to-k/2024-04-29 09.50.45 - Accepted - runtime 591ms - memory 30.8MB.py b/3249-minimum-number-of-operations-to-make-array-xor-equal-to-k/2024-04-29 09.50.45 - Accepted - runtime 591ms - memory 30.8MB.py deleted file mode 100644 index 892aa70..0000000 --- a/3249-minimum-number-of-operations-to-make-array-xor-equal-to-k/2024-04-29 09.50.45 - Accepted - runtime 591ms - memory 30.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def minOperations(self, nums: List[int], k: int) -> int: - return reduce(xor, nums, k).bit_count() \ No newline at end of file diff --git a/326-power-of-three/2022-07-20 23.19.49 - Accepted - runtime 121ms - memory 13.8MB.py b/326-power-of-three/2022-07-20 23.19.49 - Accepted - runtime 121ms - memory 13.8MB.py deleted file mode 100644 index 787c822..0000000 --- a/326-power-of-three/2022-07-20 23.19.49 - Accepted - runtime 121ms - memory 13.8MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def isPowerOfThree(self, n: int) -> bool: - return False if n <= 0 else (math.log10(n) / math.log10(3)) % 1 == 0 - \ No newline at end of file diff --git a/328-odd-even-linked-list/2024-05-07 11.26.00 - Accepted - runtime 40ms - memory 18.6MB.py b/328-odd-even-linked-list/2024-05-07 11.26.00 - Accepted - runtime 40ms - memory 18.6MB.py deleted file mode 100644 index 42271f9..0000000 --- a/328-odd-even-linked-list/2024-05-07 11.26.00 - Accepted - runtime 40ms - memory 18.6MB.py +++ /dev/null @@ -1,24 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]: - odd, even = ListNode(), ListNode() - a, b = odd, even - node, ind = head, 1 - while node: - if ind % 2: - odd.next = node - odd = node - else: - even.next = node - even = node - node = node.next - ind += 1 - even.next = None - odd.next = b.next - return a.next - - \ No newline at end of file diff --git a/3351-maximize-happiness-of-selected-children/2024-05-09 09.59.41 - Accepted - runtime 813ms - memory 43.6MB.py b/3351-maximize-happiness-of-selected-children/2024-05-09 09.59.41 - Accepted - runtime 813ms - memory 43.6MB.py deleted file mode 100644 index 6f3b7dd..0000000 --- a/3351-maximize-happiness-of-selected-children/2024-05-09 09.59.41 - Accepted - runtime 813ms - memory 43.6MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def maximumHappinessSum(self, happiness: List[int], k: int) -> int: - happiness.sort() - s = 0 - for i in range(k): - t = max(happiness[~i] - i, 0) - if not t: return s - s += t - return s \ No newline at end of file diff --git a/338-counting-bits/2022-07-01 10.23.04 - Accepted - runtime 200ms - memory 20.8MB.py b/338-counting-bits/2022-07-01 10.23.04 - Accepted - runtime 200ms - memory 20.8MB.py deleted file mode 100644 index 5814d84..0000000 --- a/338-counting-bits/2022-07-01 10.23.04 - Accepted - runtime 200ms - memory 20.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def countBits(self, n: int) -> List[int]: - return [f'{f:b}'.count('1')for f in range(n + 1)] \ No newline at end of file diff --git a/34-find-first-and-last-position-of-element-in-sorted-array/2022-07-25 20.05.02 - Accepted - runtime 139ms - memory 15.5MB.py b/34-find-first-and-last-position-of-element-in-sorted-array/2022-07-25 20.05.02 - Accepted - runtime 139ms - memory 15.5MB.py deleted file mode 100644 index c6e826d..0000000 --- a/34-find-first-and-last-position-of-element-in-sorted-array/2022-07-25 20.05.02 - Accepted - runtime 139ms - memory 15.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def searchRange(self, nums: List[int], t: int) -> List[int]: - return [nums.index(t), len(nums) - 1 - nums[::-1].index(t)] if t in nums else [-1, -1] \ No newline at end of file diff --git a/34-find-first-and-last-position-of-element-in-sorted-array/2024-02-21 11.30.45 - Accepted - runtime 3ms - memory 16MB.cpp b/34-find-first-and-last-position-of-element-in-sorted-array/2024-02-21 11.30.45 - Accepted - runtime 3ms - memory 16MB.cpp deleted file mode 100644 index 46b8968..0000000 --- a/34-find-first-and-last-position-of-element-in-sorted-array/2024-02-21 11.30.45 - Accepted - runtime 3ms - memory 16MB.cpp +++ /dev/null @@ -1,13 +0,0 @@ -class Solution { -public: - vector searchRange(vector& nums, int target) { - for (int i = 0; i < nums.size(); i++){ - if (nums[i] == target){ - int j = i; - while(i < nums.size() && nums[i] == target)i++; - return {j, i - 1}; - } - } - return {-1, -1}; - } -}; \ No newline at end of file diff --git a/34-find-first-and-last-position-of-element-in-sorted-array/2024-02-21 11.31.27 - Accepted - runtime 4ms - memory 16.1MB.cpp b/34-find-first-and-last-position-of-element-in-sorted-array/2024-02-21 11.31.27 - Accepted - runtime 4ms - memory 16.1MB.cpp deleted file mode 100644 index 6555b4f..0000000 --- a/34-find-first-and-last-position-of-element-in-sorted-array/2024-02-21 11.31.27 - Accepted - runtime 4ms - memory 16.1MB.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma GCC optimize("Ofast") -#pragma GCC target("avx2") -int init = [](){ - cin.tie(nullptr)->sync_with_stdio(false); - return 14122021; -}(); - -class Solution { -public: - vector searchRange(vector& a, int t) { - if(!binary_search(a.begin(), a.end(), t)) { - return {-1, -1}; - } - return { - static_cast(lower_bound(a.begin(), a.end(), t) - a.begin()), - static_cast(upper_bound(a.begin(), a.end(), t) - a.begin() - 1) - }; - } -}; \ No newline at end of file diff --git a/342-power-of-four/2022-07-20 23.20.04 - Accepted - runtime 59ms - memory 13.9MB.py b/342-power-of-four/2022-07-20 23.20.04 - Accepted - runtime 59ms - memory 13.9MB.py deleted file mode 100644 index 00e0d23..0000000 --- a/342-power-of-four/2022-07-20 23.20.04 - Accepted - runtime 59ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def isPowerOfFour(self, n: int) -> bool: - return False if n <= 0 else (math.log10(n) / math.log10(4)) % 1 == 0 \ No newline at end of file diff --git a/344-reverse-string/2022-06-30 22.10.25 - Accepted - runtime 399ms - memory 18.4MB.py b/344-reverse-string/2022-06-30 22.10.25 - Accepted - runtime 399ms - memory 18.4MB.py deleted file mode 100644 index d17b63a..0000000 --- a/344-reverse-string/2022-06-30 22.10.25 - Accepted - runtime 399ms - memory 18.4MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def reverseString(self, s: List[str]) -> None: - """ - Do not return anything, modify s in-place instead. - """ - for i in range(len(s)): - s.append(s.pop(~i)) - \ No newline at end of file diff --git a/344-reverse-string/2022-06-30 22.11.34 - Accepted - runtime 274ms - memory 18.3MB.py b/344-reverse-string/2022-06-30 22.11.34 - Accepted - runtime 274ms - memory 18.3MB.py deleted file mode 100644 index 71c6327..0000000 --- a/344-reverse-string/2022-06-30 22.11.34 - Accepted - runtime 274ms - memory 18.3MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def reverseString(self, s: List[str]) -> None: - for i in range(len(s)//2): s[i], s[~i] = s[~i], s[i] - \ No newline at end of file diff --git a/345-reverse-vowels-of-a-string/2022-06-30 22.19.27 - Accepted - runtime 128ms - memory 14.7MB.py b/345-reverse-vowels-of-a-string/2022-06-30 22.19.27 - Accepted - runtime 128ms - memory 14.7MB.py deleted file mode 100644 index 4891a31..0000000 --- a/345-reverse-vowels-of-a-string/2022-06-30 22.19.27 - Accepted - runtime 128ms - memory 14.7MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def reverseVowels(self, s: str) -> str: - a = ''.join(f for f in s[::-1]if f.lower() in 'aeiou') - f = 0 - res = '' - for i in s: - if i.lower()in 'aeiou':res += a[f];f+=1 - else:res += i - - return res \ No newline at end of file diff --git a/349-intersection-of-two-arrays/2022-07-18 19.54.32 - Accepted - runtime 46ms - memory 14.1MB.py b/349-intersection-of-two-arrays/2022-07-18 19.54.32 - Accepted - runtime 46ms - memory 14.1MB.py deleted file mode 100644 index 5ff9d92..0000000 --- a/349-intersection-of-two-arrays/2022-07-18 19.54.32 - Accepted - runtime 46ms - memory 14.1MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]: - return list(set(nums1) & set(nums2)) \ No newline at end of file diff --git a/349-intersection-of-two-arrays/2024-03-10 14.20.48 - Accepted - runtime 42ms - memory 16.8MB.py b/349-intersection-of-two-arrays/2024-03-10 14.20.48 - Accepted - runtime 42ms - memory 16.8MB.py deleted file mode 100644 index ec74bf6..0000000 --- a/349-intersection-of-two-arrays/2024-03-10 14.20.48 - Accepted - runtime 42ms - memory 16.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]: - return set(nums1) & set(nums2) \ No newline at end of file diff --git a/35-search-insert-position/2022-06-15 20.57.03 - Accepted - runtime 92ms - memory 14.6MB.py b/35-search-insert-position/2022-06-15 20.57.03 - Accepted - runtime 92ms - memory 14.6MB.py deleted file mode 100644 index 87182c8..0000000 --- a/35-search-insert-position/2022-06-15 20.57.03 - Accepted - runtime 92ms - memory 14.6MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def searchInsert(self, nums: List[int], target: int) -> int: - left, right = 0, len(nums) - 1 - - while left <= right: - middle = left + (right-left) // 2 - if nums[middle] == target: return middle - if nums[middle] > target: right = middle - 1 - else: left = middle + 1 - return left \ No newline at end of file diff --git a/35-search-insert-position/2022-06-15 20.57.16 - Accepted - runtime 67ms - memory 14.7MB.py b/35-search-insert-position/2022-06-15 20.57.16 - Accepted - runtime 67ms - memory 14.7MB.py deleted file mode 100644 index 87182c8..0000000 --- a/35-search-insert-position/2022-06-15 20.57.16 - Accepted - runtime 67ms - memory 14.7MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def searchInsert(self, nums: List[int], target: int) -> int: - left, right = 0, len(nums) - 1 - - while left <= right: - middle = left + (right-left) // 2 - if nums[middle] == target: return middle - if nums[middle] > target: right = middle - 1 - else: left = middle + 1 - return left \ No newline at end of file diff --git a/35-search-insert-position/2022-06-15 20.57.22 - Accepted - runtime 82ms - memory 14.7MB.py b/35-search-insert-position/2022-06-15 20.57.22 - Accepted - runtime 82ms - memory 14.7MB.py deleted file mode 100644 index 87182c8..0000000 --- a/35-search-insert-position/2022-06-15 20.57.22 - Accepted - runtime 82ms - memory 14.7MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def searchInsert(self, nums: List[int], target: int) -> int: - left, right = 0, len(nums) - 1 - - while left <= right: - middle = left + (right-left) // 2 - if nums[middle] == target: return middle - if nums[middle] > target: right = middle - 1 - else: left = middle + 1 - return left \ No newline at end of file diff --git a/35-search-insert-position/2022-06-15 20.57.29 - Accepted - runtime 115ms - memory 14.7MB.py b/35-search-insert-position/2022-06-15 20.57.29 - Accepted - runtime 115ms - memory 14.7MB.py deleted file mode 100644 index 87182c8..0000000 --- a/35-search-insert-position/2022-06-15 20.57.29 - Accepted - runtime 115ms - memory 14.7MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def searchInsert(self, nums: List[int], target: int) -> int: - left, right = 0, len(nums) - 1 - - while left <= right: - middle = left + (right-left) // 2 - if nums[middle] == target: return middle - if nums[middle] > target: right = middle - 1 - else: left = middle + 1 - return left \ No newline at end of file diff --git a/35-search-insert-position/2022-06-15 21.09.32 - Accepted - runtime 90ms - memory 14.8MB.py b/35-search-insert-position/2022-06-15 21.09.32 - Accepted - runtime 90ms - memory 14.8MB.py deleted file mode 100644 index f4ea258..0000000 --- a/35-search-insert-position/2022-06-15 21.09.32 - Accepted - runtime 90ms - memory 14.8MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def searchInsert(self, nums: List[int], target: int) -> int: - left, right = 0, len(nums) - 1 - while left <= right: - mid = left + (right - left) // 2 - if nums[mid] == target:return mid - elif nums[mid] > target: right = mid - 1 - else: left = mid + 1 - - - return left \ No newline at end of file diff --git a/35-search-insert-position/2024-02-17 13.15.34 - Accepted - runtime 0ms - memory 11.9MB.cpp b/35-search-insert-position/2024-02-17 13.15.34 - Accepted - runtime 0ms - memory 11.9MB.cpp deleted file mode 100644 index eb436f1..0000000 --- a/35-search-insert-position/2024-02-17 13.15.34 - Accepted - runtime 0ms - memory 11.9MB.cpp +++ /dev/null @@ -1,13 +0,0 @@ -class Solution { -public: - int searchInsert(vector& nums, int target) { - int low = 0, high = nums.size() - 1, mid; - while (low <= high){ - mid = low + (high - low) / 2; - if(nums[mid] == target) return mid; - else if(nums[mid] > target) high = mid - 1; - else low = mid + 1; - } - return low; - } -}; \ No newline at end of file diff --git a/35-search-insert-position/2024-02-17 13.16.29 - Accepted - runtime 0ms - memory 12.1MB.cpp b/35-search-insert-position/2024-02-17 13.16.29 - Accepted - runtime 0ms - memory 12.1MB.cpp deleted file mode 100644 index 7f41794..0000000 --- a/35-search-insert-position/2024-02-17 13.16.29 - Accepted - runtime 0ms - memory 12.1MB.cpp +++ /dev/null @@ -1,25 +0,0 @@ -class Solution { -public: - int searchInsert(vector& nums, int target) { - int low=0; - int high=nums.size()-1; - int mid; - while(low<=high) - { - mid=low + (high-low)/2; - if(nums[mid]==target) - { - return mid; - } - else if (nums[mid]>target) - { - high=mid-1; - } - else - { - low=mid+1; - } - } - return low; - } -}; \ No newline at end of file diff --git a/350-intersection-of-two-arrays-ii/2024-04-01 16.06.51 - Accepted - runtime 48ms - memory 16.7MB.py b/350-intersection-of-two-arrays-ii/2024-04-01 16.06.51 - Accepted - runtime 48ms - memory 16.7MB.py deleted file mode 100644 index 2026c9a..0000000 --- a/350-intersection-of-two-arrays-ii/2024-04-01 16.06.51 - Accepted - runtime 48ms - memory 16.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: - a, b = map(Counter, (nums1, nums2)) - res = [] - for i in a: - if i in b: - res += [i] * min(a[i], b[i]) - - return res \ No newline at end of file diff --git a/36-valid-sudoku/2023-02-09 12.01.46 - Accepted - runtime 89ms - memory 13.9MB.py b/36-valid-sudoku/2023-02-09 12.01.46 - Accepted - runtime 89ms - memory 13.9MB.py deleted file mode 100644 index d509e74..0000000 --- a/36-valid-sudoku/2023-02-09 12.01.46 - Accepted - runtime 89ms - memory 13.9MB.py +++ /dev/null @@ -1,35 +0,0 @@ -class Solution: - def isValidSudoku(self, board: List[List[str]]) -> bool: - # Vertical - for i in board: - nums = [] - for j in i: - if j.isdigit(): - if j in nums: - return False - - nums.append(j) - # Horizontal - for i in zip(*board): - nums = [] - for j in i: - if j.isdigit(): - if j in nums: - return False - - nums.append(j) - # Grid - for j in (1, 4, 7): - for i in (1, 4, 7): - nums = [] - for y in range(j - 1, j + 2): - for x in range(i - 1, i + 2): - if board[y][x].isdigit(): - if board[y][x] in nums: - return False - - nums.append(board[y][x]) - - - - return True \ No newline at end of file diff --git a/36-valid-sudoku/2024-02-21 11.36.47 - Accepted - runtime 7ms - memory 22.9MB.cpp b/36-valid-sudoku/2024-02-21 11.36.47 - Accepted - runtime 7ms - memory 22.9MB.cpp deleted file mode 100644 index e51e3bd..0000000 --- a/36-valid-sudoku/2024-02-21 11.36.47 - Accepted - runtime 7ms - memory 22.9MB.cpp +++ /dev/null @@ -1,20 +0,0 @@ -class Solution -{ -public: - bool isValidSudoku(vector > &board) - { - int u1[9][9] = {0}, u2[9][9] = {0}, u3[9][9] = {0}; - - for(int i = 0; i < board.size(); ++ i) - for(int j = 0; j < board[i].size(); ++ j) - if(board[i][j] != '.') - { - int num = board[i][j] - '0' - 1, k = i / 3 * 3 + j / 3; - if(u1[i][num] || u2[j][num] || u3[k][num]) - return false; - u1[i][num] = u2[j][num] = u3[k][num] = 1; - } - - return true; - } -}; \ No newline at end of file diff --git a/367-valid-perfect-square/2024-04-01 18.36.26 - Accepted - runtime 33ms - memory 16.5MB.py b/367-valid-perfect-square/2024-04-01 18.36.26 - Accepted - runtime 33ms - memory 16.5MB.py deleted file mode 100644 index 7a9ef9d..0000000 --- a/367-valid-perfect-square/2024-04-01 18.36.26 - Accepted - runtime 33ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def isPerfectSquare(self, num: int) -> bool: - return num ** .5 % 1 == 0 \ No newline at end of file diff --git a/371-sum-of-two-integers/2024-04-15 15.06.30 - Accepted - runtime 37ms - memory 16.5MB.py b/371-sum-of-two-integers/2024-04-15 15.06.30 - Accepted - runtime 37ms - memory 16.5MB.py deleted file mode 100644 index 4c74c13..0000000 --- a/371-sum-of-two-integers/2024-04-15 15.06.30 - Accepted - runtime 37ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def getSum(self, a: int, b: int) -> int: - return a + b \ No newline at end of file diff --git a/374-guess-number-higher-or-lower/2022-07-15 20.04.23 - Accepted - runtime 57ms - memory 13.8MB.py b/374-guess-number-higher-or-lower/2022-07-15 20.04.23 - Accepted - runtime 57ms - memory 13.8MB.py deleted file mode 100644 index c7b8285..0000000 --- a/374-guess-number-higher-or-lower/2022-07-15 20.04.23 - Accepted - runtime 57ms - memory 13.8MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# The guess API is already defined for you. -# @param num, your guess -# @return -1 if num is higher than the picked number -# 1 if num is lower than the picked number -# otherwise return 0 -# def guess(num: int) -> int: - -class Solution: - def guessNumber(self, n: int) -> int: - low = 1 - high = n - while low <= high: - mid = low + (high - low) // 2 - if (res := guess(mid)) == 0: - return mid - - elif res == -1: - high = mid - 1 - - else: - low = mid + 1 \ No newline at end of file diff --git a/374-guess-number-higher-or-lower/2022-07-16 01.28.04 - Accepted - runtime 37ms - memory 13.8MB.py b/374-guess-number-higher-or-lower/2022-07-16 01.28.04 - Accepted - runtime 37ms - memory 13.8MB.py deleted file mode 100644 index e4fef9f..0000000 --- a/374-guess-number-higher-or-lower/2022-07-16 01.28.04 - Accepted - runtime 37ms - memory 13.8MB.py +++ /dev/null @@ -1,16 +0,0 @@ -# The guess API is already defined for you. -# @param num, your guess -# @return -1 if num is higher than the picked number -# 1 if num is lower than the picked number -# otherwise return 0 -# def guess(num: int) -> int: - -class Solution: - def guessNumber(self, n: int) -> int: - low = 1 - high = n - while low <= high: - mid = low + (high - low) // 2 - if (res := guess(mid)) == 0:return mid - elif res == -1: high = mid - 1 - else:low = mid + 1 \ No newline at end of file diff --git a/374-guess-number-higher-or-lower/2023-03-07 23.57.02 - Accepted - runtime 27ms - memory 13.8MB.py b/374-guess-number-higher-or-lower/2023-03-07 23.57.02 - Accepted - runtime 27ms - memory 13.8MB.py deleted file mode 100644 index 0d640fd..0000000 --- a/374-guess-number-higher-or-lower/2023-03-07 23.57.02 - Accepted - runtime 27ms - memory 13.8MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# The guess API is already defined for you. -# @param num, your guess -# @return -1 if num is higher than the picked number -# 1 if num is lower than the picked number -# otherwise return 0 -# def guess(num: int) -> int: - -class Solution: - def guessNumber(self, n: int) -> int: - lo, hi = 1, n - while lo < hi: - mid = (lo + hi) // 2 - res = guess(mid) - if res == -1: - hi = mid - elif res == 1: - lo = mid + 1 - else: - return mid - - return lo \ No newline at end of file diff --git a/38-count-and-say/2024-04-19 00.22.45 - Accepted - runtime 44ms - memory 16.6MB.py b/38-count-and-say/2024-04-19 00.22.45 - Accepted - runtime 44ms - memory 16.6MB.py deleted file mode 100644 index b6dbc24..0000000 --- a/38-count-and-say/2024-04-19 00.22.45 - Accepted - runtime 44ms - memory 16.6MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def countAndSay(self, n: int) -> str: - t = 1 - res = '1' - while t < n: - tmp = '' - for a,b in groupby(res): - tmp += f'{len(list(b))}{a}' - res = tmp - t += 1 - return res \ No newline at end of file diff --git a/380-insert-delete-getrandom-o1/2024-01-17 19.17.35 - Accepted - runtime 467ms - memory 64.7MB.py b/380-insert-delete-getrandom-o1/2024-01-17 19.17.35 - Accepted - runtime 467ms - memory 64.7MB.py deleted file mode 100644 index c31bbf0..0000000 --- a/380-insert-delete-getrandom-o1/2024-01-17 19.17.35 - Accepted - runtime 467ms - memory 64.7MB.py +++ /dev/null @@ -1,28 +0,0 @@ -class RandomizedSet: - - def __init__(self): - self.set = set() - - def insert(self, val: int) -> bool: - if val in self.set: - return False - - self.set.add(val) - return True - - def remove(self, val: int) -> bool: - if val in self.set: - self.set.remove(val) - return True - - return False - - def getRandom(self) -> int: - return random.choice([*self.set]) - - -# Your RandomizedSet object will be instantiated and called as such: -# obj = RandomizedSet() -# param_1 = obj.insert(val) -# param_2 = obj.remove(val) -# param_3 = obj.getRandom() \ No newline at end of file diff --git a/382-linked-list-random-node/2024-03-01 00.28.30 - Accepted - runtime 63ms - memory 19.3MB.py b/382-linked-list-random-node/2024-03-01 00.28.30 - Accepted - runtime 63ms - memory 19.3MB.py deleted file mode 100644 index b6710e1..0000000 --- a/382-linked-list-random-node/2024-03-01 00.28.30 - Accepted - runtime 63ms - memory 19.3MB.py +++ /dev/null @@ -1,20 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - - def __init__(self, head: Optional[ListNode]): - self.nodes = [] - while head: - self.nodes.append(head.val) - head = head.next - - def getRandom(self) -> int: - return random.choice(self.nodes) - - -# Your Solution object will be instantiated and called as such: -# obj = Solution(head) -# param_1 = obj.getRandom() \ No newline at end of file diff --git a/383-ransom-note/2022-06-30 22.24.43 - Accepted - runtime 50ms - memory 14.2MB.py b/383-ransom-note/2022-06-30 22.24.43 - Accepted - runtime 50ms - memory 14.2MB.py deleted file mode 100644 index 47fb18d..0000000 --- a/383-ransom-note/2022-06-30 22.24.43 - Accepted - runtime 50ms - memory 14.2MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def canConstruct(self, ransomNote: str, magazine: str) -> bool: - return all(ransomNote.count(f)<=magazine.count(f)for f in set(ransomNote)) \ No newline at end of file diff --git a/383-ransom-note/2022-06-30 22.25.01 - Accepted - runtime 58ms - memory 14.3MB.py b/383-ransom-note/2022-06-30 22.25.01 - Accepted - runtime 58ms - memory 14.3MB.py deleted file mode 100644 index 47fb18d..0000000 --- a/383-ransom-note/2022-06-30 22.25.01 - Accepted - runtime 58ms - memory 14.3MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def canConstruct(self, ransomNote: str, magazine: str) -> bool: - return all(ransomNote.count(f)<=magazine.count(f)for f in set(ransomNote)) \ No newline at end of file diff --git a/387-first-unique-character-in-a-string/2022-07-11 14.13.30 - Accepted - runtime 313ms - memory 14.3MB.py b/387-first-unique-character-in-a-string/2022-07-11 14.13.30 - Accepted - runtime 313ms - memory 14.3MB.py deleted file mode 100644 index d1af331..0000000 --- a/387-first-unique-character-in-a-string/2022-07-11 14.13.30 - Accepted - runtime 313ms - memory 14.3MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def firstUniqChar(self, s: str) -> int: - seen = '' - for ind, i in enumerate(s): - if i not in s[ind + 1:] + seen: - return ind - seen += i - return -1 \ No newline at end of file diff --git a/387-first-unique-character-in-a-string/2022-07-11 14.14.59 - Accepted - runtime 6275ms - memory 14.1MB.py b/387-first-unique-character-in-a-string/2022-07-11 14.14.59 - Accepted - runtime 6275ms - memory 14.1MB.py deleted file mode 100644 index 3871bfd..0000000 --- a/387-first-unique-character-in-a-string/2022-07-11 14.14.59 - Accepted - runtime 6275ms - memory 14.1MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def firstUniqChar(self, s: str) -> int: - for ind,i in enumerate(s): - if s.count(i) == 1:return ind - return -1 \ No newline at end of file diff --git a/387-first-unique-character-in-a-string/2022-08-20 16.43.27 - Accepted - runtime 84ms - memory 14.2MB.py b/387-first-unique-character-in-a-string/2022-08-20 16.43.27 - Accepted - runtime 84ms - memory 14.2MB.py deleted file mode 100644 index f3ed593..0000000 --- a/387-first-unique-character-in-a-string/2022-08-20 16.43.27 - Accepted - runtime 84ms - memory 14.2MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def firstUniqChar(self, s: str) -> int: - checked = '' - for ind,i in enumerate(s): - if i in checked: continue - if s.count(i) == 1:return ind - checked += i - return -1 \ No newline at end of file diff --git a/387-first-unique-character-in-a-string/2022-08-20 16.43.37 - Accepted - runtime 7503ms - memory 14.3MB.py b/387-first-unique-character-in-a-string/2022-08-20 16.43.37 - Accepted - runtime 7503ms - memory 14.3MB.py deleted file mode 100644 index a9e40ad..0000000 --- a/387-first-unique-character-in-a-string/2022-08-20 16.43.37 - Accepted - runtime 7503ms - memory 14.3MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def firstUniqChar(self, s: str) -> int: - checked = '' - for ind,i in enumerate(s): - if s.count(i) == 1:return ind - checked += i - return -1 \ No newline at end of file diff --git a/387-first-unique-character-in-a-string/2022-08-20 16.43.51 - Accepted - runtime 90ms - memory 14MB.py b/387-first-unique-character-in-a-string/2022-08-20 16.43.51 - Accepted - runtime 90ms - memory 14MB.py deleted file mode 100644 index f3ed593..0000000 --- a/387-first-unique-character-in-a-string/2022-08-20 16.43.51 - Accepted - runtime 90ms - memory 14MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def firstUniqChar(self, s: str) -> int: - checked = '' - for ind,i in enumerate(s): - if i in checked: continue - if s.count(i) == 1:return ind - checked += i - return -1 \ No newline at end of file diff --git a/387-first-unique-character-in-a-string/2023-01-10 22.10.30 - Accepted - runtime 62ms - memory 14.2MB.py b/387-first-unique-character-in-a-string/2023-01-10 22.10.30 - Accepted - runtime 62ms - memory 14.2MB.py deleted file mode 100644 index cc74fa2..0000000 --- a/387-first-unique-character-in-a-string/2023-01-10 22.10.30 - Accepted - runtime 62ms - memory 14.2MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def firstUniqChar(self, s: str) -> int: - for i, c in collections.Counter(s).items(): - if c == 1: - return s.index(i) - - return -1 \ No newline at end of file diff --git a/387-first-unique-character-in-a-string/2024-02-05 22.46.30 - Accepted - runtime 415ms - memory 16.7MB.py b/387-first-unique-character-in-a-string/2024-02-05 22.46.30 - Accepted - runtime 415ms - memory 16.7MB.py deleted file mode 100644 index b464ad8..0000000 --- a/387-first-unique-character-in-a-string/2024-02-05 22.46.30 - Accepted - runtime 415ms - memory 16.7MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def firstUniqChar(self, s: str) -> int: - for i in range(len(s)): - if s[i] not in s[i + 1:] + s[:i]: - return i - return -1 - \ No newline at end of file diff --git a/389-find-the-difference/2022-10-12 19.27.01 - Accepted - runtime 58ms - memory 13.8MB.py b/389-find-the-difference/2022-10-12 19.27.01 - Accepted - runtime 58ms - memory 13.8MB.py deleted file mode 100644 index 060c833..0000000 --- a/389-find-the-difference/2022-10-12 19.27.01 - Accepted - runtime 58ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findTheDifference(self, s: str, t: str) -> str: - return chr(sum(map(ord, t)) - sum(map(ord, s))) \ No newline at end of file diff --git a/389-find-the-difference/2024-02-17 23.19.32 - Accepted - runtime 2ms - memory 7.9MB.cpp b/389-find-the-difference/2024-02-17 23.19.32 - Accepted - runtime 2ms - memory 7.9MB.cpp deleted file mode 100644 index 11a61c5..0000000 --- a/389-find-the-difference/2024-02-17 23.19.32 - Accepted - runtime 2ms - memory 7.9MB.cpp +++ /dev/null @@ -1,8 +0,0 @@ -class Solution { -public: - char findTheDifference(string s, string t) { - char a = 0; - for (int i = 0;i < s.size(); i++) a += t[i] - s[i]; - return a + t[t.size() - 1]; - } -}; \ No newline at end of file diff --git a/389-find-the-difference/2024-02-17 23.19.54 - Accepted - runtime 5ms - memory 7.9MB.cpp b/389-find-the-difference/2024-02-17 23.19.54 - Accepted - runtime 5ms - memory 7.9MB.cpp deleted file mode 100644 index 11a61c5..0000000 --- a/389-find-the-difference/2024-02-17 23.19.54 - Accepted - runtime 5ms - memory 7.9MB.cpp +++ /dev/null @@ -1,8 +0,0 @@ -class Solution { -public: - char findTheDifference(string s, string t) { - char a = 0; - for (int i = 0;i < s.size(); i++) a += t[i] - s[i]; - return a + t[t.size() - 1]; - } -}; \ No newline at end of file diff --git a/392-is-subsequence/2024-02-15 22.32.55 - Accepted - runtime 34ms - memory 16.5MB.py b/392-is-subsequence/2024-02-15 22.32.55 - Accepted - runtime 34ms - memory 16.5MB.py deleted file mode 100644 index 433549a..0000000 --- a/392-is-subsequence/2024-02-15 22.32.55 - Accepted - runtime 34ms - memory 16.5MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def isSubsequence(self, s: str, t: str) -> bool: - for i in t: - if not s: - return True - if i == s[0]:s = s[1:] - - return not s \ No newline at end of file diff --git a/392-is-subsequence/2024-02-17 23.05.21 - Accepted - runtime 0ms - memory 7.5MB.cpp b/392-is-subsequence/2024-02-17 23.05.21 - Accepted - runtime 0ms - memory 7.5MB.cpp deleted file mode 100644 index 2a022a0..0000000 --- a/392-is-subsequence/2024-02-17 23.05.21 - Accepted - runtime 0ms - memory 7.5MB.cpp +++ /dev/null @@ -1,8 +0,0 @@ -class Solution { -public: - bool isSubsequence(string s, string t) { - int a = 0, b = 0; - while (a < s.size() && b < t.size())if (s[a] == t[b++]) a++; - return a == s.size(); - } -}; \ No newline at end of file diff --git a/394-decode-string/2024-04-04 09.53.47 - Accepted - runtime 37ms - memory 16.5MB.py b/394-decode-string/2024-04-04 09.53.47 - Accepted - runtime 37ms - memory 16.5MB.py deleted file mode 100644 index 3098f43..0000000 --- a/394-decode-string/2024-04-04 09.53.47 - Accepted - runtime 37ms - memory 16.5MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def decodeString(self, s: str) -> str: - from re import compile, sub, search - regex = compile(r'(\d+)\[(\w+)\]') - while search(regex, s): - s = sub(regex, lambda x: int(x.group(1)) * x.group(2), s) - return s \ No newline at end of file diff --git a/401-binary-watch/2024-05-05 20.11.33 - Accepted - runtime 37ms - memory 16.5MB.py b/401-binary-watch/2024-05-05 20.11.33 - Accepted - runtime 37ms - memory 16.5MB.py deleted file mode 100644 index af2bee7..0000000 --- a/401-binary-watch/2024-05-05 20.11.33 - Accepted - runtime 37ms - memory 16.5MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def readBinaryWatch(self, turnedOn: int) -> List[str]: - return [f'{h}:{m:02}' for h in range(12) for m in range(60) - if (bin(h) + bin(m)).count('1') == turnedOn] \ No newline at end of file diff --git a/402-remove-k-digits/2024-04-11 11.14.34 - Accepted - runtime 50ms - memory 18.1MB.py b/402-remove-k-digits/2024-04-11 11.14.34 - Accepted - runtime 50ms - memory 18.1MB.py deleted file mode 100644 index 3e38bea..0000000 --- a/402-remove-k-digits/2024-04-11 11.14.34 - Accepted - runtime 50ms - memory 18.1MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def removeKdigits(self, num: str, k: int) -> str: - stack = [] - for digit in num: - while k > 0 and stack and stack[-1] > digit: - k -= 1 - stack.pop() - stack.append(digit) - if k > 0: - stack = stack[:-k] - return "".join(stack).lstrip("0") or "0" \ No newline at end of file diff --git a/404-sum-of-left-leaves/2024-04-01 19.12.22 - Accepted - runtime 37ms - memory 16.7MB.py b/404-sum-of-left-leaves/2024-04-01 19.12.22 - Accepted - runtime 37ms - memory 16.7MB.py deleted file mode 100644 index 6d9886d..0000000 --- a/404-sum-of-left-leaves/2024-04-01 19.12.22 - Accepted - runtime 37ms - memory 16.7MB.py +++ /dev/null @@ -1,22 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sumOfLeftLeaves(self, root: Optional[TreeNode]) -> int: - left, right = [], [root] - res = 0 - while left or right: - if left: - n = left.pop() - if not n.left and not n.right: res += n.val - if n.left: left.append(n.left) - if n.right: right.append(n.right) - else: - n = right.pop() - if n.left: left.append(n.left) - if n.right: right.append(n.right) - - return res \ No newline at end of file diff --git a/404-sum-of-left-leaves/2024-04-14 09.45.14 - Accepted - runtime 40ms - memory 16.8MB.py b/404-sum-of-left-leaves/2024-04-14 09.45.14 - Accepted - runtime 40ms - memory 16.8MB.py deleted file mode 100644 index 7861a15..0000000 --- a/404-sum-of-left-leaves/2024-04-14 09.45.14 - Accepted - runtime 40ms - memory 16.8MB.py +++ /dev/null @@ -1,11 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sumOfLeftLeaves(self, root: Optional[TreeNode], left = 0) -> int: - if not root: return 0 - if not root.left and not root.right: return root.val if left else 0 - return self.sumOfLeftLeaves(root.right) + self.sumOfLeftLeaves(root.left, 1) \ No newline at end of file diff --git a/405-convert-a-number-to-hexadecimal/2024-04-01 19.18.10 - Accepted - runtime 27ms - memory 16.5MB.py b/405-convert-a-number-to-hexadecimal/2024-04-01 19.18.10 - Accepted - runtime 27ms - memory 16.5MB.py deleted file mode 100644 index 524dc40..0000000 --- a/405-convert-a-number-to-hexadecimal/2024-04-01 19.18.10 - Accepted - runtime 27ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def toHex(self, num: int) -> str: - return hex(num)[2:] if num >= 0 else hex(4294967296 + num)[2:] \ No newline at end of file diff --git a/409-longest-palindrome/2024-03-31 19.47.34 - Accepted - runtime 30ms - memory 16.5MB.py b/409-longest-palindrome/2024-03-31 19.47.34 - Accepted - runtime 30ms - memory 16.5MB.py deleted file mode 100644 index d08ee02..0000000 --- a/409-longest-palindrome/2024-03-31 19.47.34 - Accepted - runtime 30ms - memory 16.5MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def longestPalindrome(self, s: str) -> int: - odds = sum(v % 2 for v in Counter(s).values()) - return len(s) - odds + bool(odds) \ No newline at end of file diff --git a/41-first-missing-positive/2024-03-26 12.25.07 - Accepted - runtime 272ms - memory 35.2MB.py b/41-first-missing-positive/2024-03-26 12.25.07 - Accepted - runtime 272ms - memory 35.2MB.py deleted file mode 100644 index 7954fe4..0000000 --- a/41-first-missing-positive/2024-03-26 12.25.07 - Accepted - runtime 272ms - memory 35.2MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def firstMissingPositive(self, nums: List[int]) -> int: - n = set(nums) - res = 1 - while res in n:res += 1 - return res \ No newline at end of file diff --git a/412-fizz-buzz/2022-06-30 21.15.15 - Accepted - runtime 55ms - memory 15.2MB.py b/412-fizz-buzz/2022-06-30 21.15.15 - Accepted - runtime 55ms - memory 15.2MB.py deleted file mode 100644 index dfd1521..0000000 --- a/412-fizz-buzz/2022-06-30 21.15.15 - Accepted - runtime 55ms - memory 15.2MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def fizzBuzz(self, n: int) -> List[str]: - res = [] - for i in range(1, n + 1): - if not i % 3: - if not i % 5: - res.append('FizzBuzz') - else: - res.append('Fizz') - - elif not i % 5: - res.append('Buzz') - else: - res.append(str(i)) - - return res \ No newline at end of file diff --git a/414-third-maximum-number/2022-07-01 22.05.17 - Accepted - runtime 123ms - memory 15.6MB.py b/414-third-maximum-number/2022-07-01 22.05.17 - Accepted - runtime 123ms - memory 15.6MB.py deleted file mode 100644 index 198110f..0000000 --- a/414-third-maximum-number/2022-07-01 22.05.17 - Accepted - runtime 123ms - memory 15.6MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def thirdMax(self, nums: List[int]) -> int: - a = sorted(set(nums)) - return a[-3] if len(a) > 2 else a[-1] \ No newline at end of file diff --git a/415-add-strings/2022-07-03 09.19.58 - Accepted - runtime 60ms - memory 14MB.py b/415-add-strings/2022-07-03 09.19.58 - Accepted - runtime 60ms - memory 14MB.py deleted file mode 100644 index 33709c8..0000000 --- a/415-add-strings/2022-07-03 09.19.58 - Accepted - runtime 60ms - memory 14MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def addStrings(self, num1: str, num2: str) -> str: - return str(int(num1) + int(num2)) \ No newline at end of file diff --git a/42-trapping-rain-water/2024-04-12 09.55.48 - Accepted - runtime 98ms - memory 18.4MB.py b/42-trapping-rain-water/2024-04-12 09.55.48 - Accepted - runtime 98ms - memory 18.4MB.py deleted file mode 100644 index ce6c010..0000000 --- a/42-trapping-rain-water/2024-04-12 09.55.48 - Accepted - runtime 98ms - memory 18.4MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def trap(self, height: List[int]) -> int: - l = w = lvl = 0 - r = len(height) - 1 - while l < r: - if height[l] < height[r]: - low = height[l] - l += 1 - else: - low = height[r] - r -= 1 - lvl = max(lvl, low) - w += lvl - low - - return w diff --git a/434-number-of-segments-in-a-string/2022-07-10 22.41.12 - Accepted - runtime 75ms - memory 13.9MB.py b/434-number-of-segments-in-a-string/2022-07-10 22.41.12 - Accepted - runtime 75ms - memory 13.9MB.py deleted file mode 100644 index 675daf2..0000000 --- a/434-number-of-segments-in-a-string/2022-07-10 22.41.12 - Accepted - runtime 75ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def countSegments(self, s: str) -> int: - return len(s.split()) \ No newline at end of file diff --git a/441-arranging-coins/2024-04-01 15.48.23 - Accepted - runtime 427ms - memory 16.4MB.py b/441-arranging-coins/2024-04-01 15.48.23 - Accepted - runtime 427ms - memory 16.4MB.py deleted file mode 100644 index b9bc624..0000000 --- a/441-arranging-coins/2024-04-01 15.48.23 - Accepted - runtime 427ms - memory 16.4MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def arrangeCoins(self, n: int) -> int: - r = 0 - while True: - if n < r: - return r - 1 - n -= r - r += 1 \ No newline at end of file diff --git a/441-arranging-coins/2024-04-01 15.48.52 - Accepted - runtime 44ms - memory 16.4MB.py b/441-arranging-coins/2024-04-01 15.48.52 - Accepted - runtime 44ms - memory 16.4MB.py deleted file mode 100644 index 2db092e..0000000 --- a/441-arranging-coins/2024-04-01 15.48.52 - Accepted - runtime 44ms - memory 16.4MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def arrangeCoins(self, n: int) -> int: - return int((math.sqrt(8 * n + 1)-1)/2) \ No newline at end of file diff --git a/442-find-all-duplicates-in-an-array/2024-03-25 17.12.30 - Accepted - runtime 268ms - memory 25.2MB.py b/442-find-all-duplicates-in-an-array/2024-03-25 17.12.30 - Accepted - runtime 268ms - memory 25.2MB.py deleted file mode 100644 index 5a2c01e..0000000 --- a/442-find-all-duplicates-in-an-array/2024-03-25 17.12.30 - Accepted - runtime 268ms - memory 25.2MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findDuplicates(self, nums: List[int]) -> List[int]: - return [k for k, v in Counter(nums).items() if v > 1] \ No newline at end of file diff --git a/443-string-compression/2024-04-04 09.32.21 - Accepted - runtime 55ms - memory 16.8MB.py b/443-string-compression/2024-04-04 09.32.21 - Accepted - runtime 55ms - memory 16.8MB.py deleted file mode 100644 index dfe75fb..0000000 --- a/443-string-compression/2024-04-04 09.32.21 - Accepted - runtime 55ms - memory 16.8MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def compress(self, chars: List[str]) -> int: - res = 0 - r = [] - for a,b in groupby(chars): - b = len(list(b)) - r.append(a) - res += 1 - if b > 1: - res += len(str(b)) - r += list(str(b)) - - chars[:] = r - return res \ No newline at end of file diff --git a/445-add-two-numbers-ii/2024-02-28 23.29.49 - Accepted - runtime 59ms - memory 16.6MB.py b/445-add-two-numbers-ii/2024-02-28 23.29.49 - Accepted - runtime 59ms - memory 16.6MB.py deleted file mode 100644 index 41de3fa..0000000 --- a/445-add-two-numbers-ii/2024-02-28 23.29.49 - Accepted - runtime 59ms - memory 16.6MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]: - a = b = '' - while l1:a += str(l1.val); l1 = l1.next - while l2:b += str(l2.val); l2 = l2.next - k = str(int(a) + int(b)) - r = t = ListNode(k[0]) - for i in k[1:]:t.next = ListNode(int(i)); t = t.next - return r \ No newline at end of file diff --git a/448-find-all-numbers-disappeared-in-an-array/2024-04-01 19.21.36 - Accepted - runtime 258ms - memory 26.9MB.py b/448-find-all-numbers-disappeared-in-an-array/2024-04-01 19.21.36 - Accepted - runtime 258ms - memory 26.9MB.py deleted file mode 100644 index ca6baf7..0000000 --- a/448-find-all-numbers-disappeared-in-an-array/2024-04-01 19.21.36 - Accepted - runtime 258ms - memory 26.9MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def findDisappearedNumbers(self, nums: List[int]) -> List[int]: - s = set(nums) - return [f for f in range(1, len(nums) + 1) if f not in s] \ No newline at end of file diff --git a/451-sort-characters-by-frequency/2024-02-07 16.15.36 - Accepted - runtime 64ms - memory 17.8MB.py b/451-sort-characters-by-frequency/2024-02-07 16.15.36 - Accepted - runtime 64ms - memory 17.8MB.py deleted file mode 100644 index 93b8fe5..0000000 --- a/451-sort-characters-by-frequency/2024-02-07 16.15.36 - Accepted - runtime 64ms - memory 17.8MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def frequencySort(self, s: str) -> str: - s = Counter(s) - return ''.join(a*b for a,b in sorted(s.items(), key=lambda x:-x[1])) \ No newline at end of file diff --git a/451-sort-characters-by-frequency/2024-02-07 16.15.53 - Accepted - runtime 37ms - memory 17.8MB.py b/451-sort-characters-by-frequency/2024-02-07 16.15.53 - Accepted - runtime 37ms - memory 17.8MB.py deleted file mode 100644 index 6fa2a11..0000000 --- a/451-sort-characters-by-frequency/2024-02-07 16.15.53 - Accepted - runtime 37ms - memory 17.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def frequencySort(self, s: str) -> str: - return ''.join(a*b for a,b in sorted(Counter(s).items(), key=lambda x:-x[1])) \ No newline at end of file diff --git a/452-minimum-number-of-arrows-to-burst-balloons/2024-03-18 16.29.28 - Accepted - runtime 999ms - memory 62.7MB.py b/452-minimum-number-of-arrows-to-burst-balloons/2024-03-18 16.29.28 - Accepted - runtime 999ms - memory 62.7MB.py deleted file mode 100644 index 2a0f1e9..0000000 --- a/452-minimum-number-of-arrows-to-burst-balloons/2024-03-18 16.29.28 - Accepted - runtime 999ms - memory 62.7MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def findMinArrowShots(self, points: List[List[int]]) -> int: - points.sort(key=lambda x: x[1]) - res, b = 1, points[0][1] - for s, e in points: - if b < s: - b = e - res += 1 - - return res \ No newline at end of file diff --git a/455-assign-cookies/2022-07-03 20.14.52 - Accepted - runtime 252ms - memory 15.5MB.py b/455-assign-cookies/2022-07-03 20.14.52 - Accepted - runtime 252ms - memory 15.5MB.py deleted file mode 100644 index 1744bc1..0000000 --- a/455-assign-cookies/2022-07-03 20.14.52 - Accepted - runtime 252ms - memory 15.5MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def findContentChildren(self, g: List[int], s: List[int]) -> int: - r = 0 - heapq.heapify(s) - heapq.heapify(g) - while s and g: - a = heapq.heappop(g) - while s: - if a <= heapq.heappop(s): - r += 1 - break - - return r - \ No newline at end of file diff --git a/455-assign-cookies/2024-01-27 20.15.39 - Accepted - runtime 145ms - memory 18.6MB.py b/455-assign-cookies/2024-01-27 20.15.39 - Accepted - runtime 145ms - memory 18.6MB.py deleted file mode 100644 index 4f1f462..0000000 --- a/455-assign-cookies/2024-01-27 20.15.39 - Accepted - runtime 145ms - memory 18.6MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def findContentChildren(self, g: List[int], s: List[int]) -> int: - a = b = r = 0 - l, L = len(g), len(s) - g.sort() - s.sort() - while a < l and b < L: - print(g[a], s[b]) - if g[a] <= s[b]: - r += 1 - a += 1 - b += 1 - else: - b += 1 - - return r \ No newline at end of file diff --git a/459-repeated-substring-pattern/2024-03-31 20.04.41 - Accepted - runtime 40ms - memory 16.7MB.py b/459-repeated-substring-pattern/2024-03-31 20.04.41 - Accepted - runtime 40ms - memory 16.7MB.py deleted file mode 100644 index 53d5462..0000000 --- a/459-repeated-substring-pattern/2024-03-31 20.04.41 - Accepted - runtime 40ms - memory 16.7MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def repeatedSubstringPattern(self, s: str) -> bool: - return (s + s)[1:-1].find(s) != -1 diff --git a/46-permutations/2024-04-25 22.57.18 - Accepted - runtime 36ms - memory 16.5MB.py b/46-permutations/2024-04-25 22.57.18 - Accepted - runtime 36ms - memory 16.5MB.py deleted file mode 100644 index c692f88..0000000 --- a/46-permutations/2024-04-25 22.57.18 - Accepted - runtime 36ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def permute(self, nums: List[int]) -> List[List[int]]: - return itertools.permutations(nums) \ No newline at end of file diff --git a/461-hamming-distance/2024-04-01 19.30.11 - Accepted - runtime 28ms - memory 16.5MB.py b/461-hamming-distance/2024-04-01 19.30.11 - Accepted - runtime 28ms - memory 16.5MB.py deleted file mode 100644 index fbffdc1..0000000 --- a/461-hamming-distance/2024-04-01 19.30.11 - Accepted - runtime 28ms - memory 16.5MB.py +++ /dev/null @@ -1,6 +0,0 @@ -class Solution: - def hammingDistance(self, x: int, y: int) -> int: - if x > y: x, y = y, x - x, y = map(lambda x: bin(x)[2:], (x, y)) - x = x.zfill(l := len(y)) - return sum(x[f] != y[f] for f in range(l)) \ No newline at end of file diff --git a/463-island-perimeter/2024-04-01 19.32.09 - Accepted - runtime 387ms - memory 17MB.py b/463-island-perimeter/2024-04-01 19.32.09 - Accepted - runtime 387ms - memory 17MB.py deleted file mode 100644 index 2d47465..0000000 --- a/463-island-perimeter/2024-04-01 19.32.09 - Accepted - runtime 387ms - memory 17MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def islandPerimeter(self, grid: List[List[int]]) -> int: - m, n, res = len(grid), len(grid[0]), 0 - - for i in range(m): - for j in range(n): - res += 4*grid[i][j] - if i > 0: res -= grid[i][j]*grid[i-1][j] - if i < m-1: res -= grid[i][j]*grid[i+1][j] - if j > 0: res -= grid[i][j]*grid[i][j-1] - if j < n-1: res -= grid[i][j]*grid[i][j+1] - - return res \ No newline at end of file diff --git a/463-island-perimeter/2024-04-18 08.45.52 - Accepted - runtime 407ms - memory 16.9MB.py b/463-island-perimeter/2024-04-18 08.45.52 - Accepted - runtime 407ms - memory 16.9MB.py deleted file mode 100644 index 2d47465..0000000 --- a/463-island-perimeter/2024-04-18 08.45.52 - Accepted - runtime 407ms - memory 16.9MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def islandPerimeter(self, grid: List[List[int]]) -> int: - m, n, res = len(grid), len(grid[0]), 0 - - for i in range(m): - for j in range(n): - res += 4*grid[i][j] - if i > 0: res -= grid[i][j]*grid[i-1][j] - if i < m-1: res -= grid[i][j]*grid[i+1][j] - if j > 0: res -= grid[i][j]*grid[i][j-1] - if j < n-1: res -= grid[i][j]*grid[i][j+1] - - return res \ No newline at end of file diff --git a/476-number-complement/2023-05-13 10.07.07 - Accepted - runtime 39ms - memory 16.1MB.py b/476-number-complement/2023-05-13 10.07.07 - Accepted - runtime 39ms - memory 16.1MB.py deleted file mode 100644 index b1a4291..0000000 --- a/476-number-complement/2023-05-13 10.07.07 - Accepted - runtime 39ms - memory 16.1MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findComplement(self, num: int) -> int: - return int(f'{num:b}'.translate(str.maketrans({'1':'0', '0':'1'})), 2) \ No newline at end of file diff --git a/482-license-key-formatting/2024-03-31 20.09.43 - Accepted - runtime 42ms - memory 19.6MB.py b/482-license-key-formatting/2024-03-31 20.09.43 - Accepted - runtime 42ms - memory 19.6MB.py deleted file mode 100644 index c28adc4..0000000 --- a/482-license-key-formatting/2024-03-31 20.09.43 - Accepted - runtime 42ms - memory 19.6MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def licenseKeyFormatting(self, s: str, k: int) -> str: - s = ''.join(f.upper() for f in s if f.isalnum())[::-1] - return '-'.join(s[f: f + k] for f in range(0, len(s), k))[::-1] \ No newline at end of file diff --git a/485-max-consecutive-ones/2024-04-01 19.36.48 - Accepted - runtime 268ms - memory 16.8MB.py b/485-max-consecutive-ones/2024-04-01 19.36.48 - Accepted - runtime 268ms - memory 16.8MB.py deleted file mode 100644 index 06dd3c5..0000000 --- a/485-max-consecutive-ones/2024-04-01 19.36.48 - Accepted - runtime 268ms - memory 16.8MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def findMaxConsecutiveOnes(self, nums: List[int]) -> int: - cur = res = 1 - for i in range(1, len(nums)): - if nums[i] and nums[i - 1]: - cur += 1 - else: - res = max(res, cur) - cur = 1 - - return max(res, cur) if any(nums) else 0 \ No newline at end of file diff --git a/49-group-anagrams/2023-01-28 18.50.16 - Accepted - runtime 106ms - memory 17.7MB.py b/49-group-anagrams/2023-01-28 18.50.16 - Accepted - runtime 106ms - memory 17.7MB.py deleted file mode 100644 index 011c5b2..0000000 --- a/49-group-anagrams/2023-01-28 18.50.16 - Accepted - runtime 106ms - memory 17.7MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def groupAnagrams(self, strs: List[str]) -> List[List[str]]: - d = {} - for i in strs: - t = ''.join(sorted(i)) - if t in d: - d[t].append(i) - else: - d[t] = [i] - - return d.values() \ No newline at end of file diff --git a/49-group-anagrams/2024-02-06 13.40.41 - Accepted - runtime 136ms - memory 21MB.py b/49-group-anagrams/2024-02-06 13.40.41 - Accepted - runtime 136ms - memory 21MB.py deleted file mode 100644 index 5e3351f..0000000 --- a/49-group-anagrams/2024-02-06 13.40.41 - Accepted - runtime 136ms - memory 21MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def groupAnagrams(self, strs: List[str]) -> List[List[str]]: - d = {} - for i in strs: - key = str(sorted(Counter(i).items())) - d[key] = d.get(key, []) + [i] - - - return d.values() \ No newline at end of file diff --git a/49-group-anagrams/2024-02-06 13.42.17 - Accepted - runtime 80ms - memory 20.2MB.py b/49-group-anagrams/2024-02-06 13.42.17 - Accepted - runtime 80ms - memory 20.2MB.py deleted file mode 100644 index acfb64b..0000000 --- a/49-group-anagrams/2024-02-06 13.42.17 - Accepted - runtime 80ms - memory 20.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def groupAnagrams(self, strs: List[str]) -> List[List[str]]: - d = defaultdict(list) - for i in strs: - key = ''.join(sorted(i)) - d[key].append(i) - - - return d.values() \ No newline at end of file diff --git a/496-next-greater-element-i/2022-09-26 17.35.26 - Accepted - runtime 168ms - memory 14.2MB.py b/496-next-greater-element-i/2022-09-26 17.35.26 - Accepted - runtime 168ms - memory 14.2MB.py deleted file mode 100644 index 9db84a3..0000000 --- a/496-next-greater-element-i/2022-09-26 17.35.26 - Accepted - runtime 168ms - memory 14.2MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]: - r = [] - for i in nums1: - ind = nums2.index(i) - for j in nums2[ind:]: - if j > i: - r.append(j) - break - else: - r.append(-1) - - return r - \ No newline at end of file diff --git a/5-longest-palindromic-substring/2022-11-27 19.08.05 - Accepted - runtime 390ms - memory 14MB.py b/5-longest-palindromic-substring/2022-11-27 19.08.05 - Accepted - runtime 390ms - memory 14MB.py deleted file mode 100644 index dc15ed1..0000000 --- a/5-longest-palindromic-substring/2022-11-27 19.08.05 - Accepted - runtime 390ms - memory 14MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def longestPalindrome(self, s: str) -> str: - l, w, wl = len(s), '', 0 - for i in range(l): - for u in (0, 1): - j, k = i, i + u - while j >= 0 and l > k and s[j] == s[k]: - j -= 1 - k += 1 - - if k - j - 1 > wl: - wl = k - j - 1 - w = s[j + 1: k] - - return w diff --git a/5-longest-palindromic-substring/2022-11-27 19.20.15 - Accepted - runtime 750ms - memory 13.8MB.py b/5-longest-palindromic-substring/2022-11-27 19.20.15 - Accepted - runtime 750ms - memory 13.8MB.py deleted file mode 100644 index 7bf8052..0000000 --- a/5-longest-palindromic-substring/2022-11-27 19.20.15 - Accepted - runtime 750ms - memory 13.8MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class Solution: - def longestPalindrome(self, s: str) -> str: - ll = len(s) - w, wl = '', 0 - - for i in range(ll): - for j in (0, 1): - l, r = i, i + j - while l >= 0 and r < ll and s[l] == s[r]: - a = r - l + 1 - if a > wl: - wl = a - w = s[l: r + 1] - - l -= 1 - r += 1 - - return w \ No newline at end of file diff --git a/5-longest-palindromic-substring/2022-11-27 19.26.11 - Accepted - runtime 1620ms - memory 14MB.py b/5-longest-palindromic-substring/2022-11-27 19.26.11 - Accepted - runtime 1620ms - memory 14MB.py deleted file mode 100644 index 5a02739..0000000 --- a/5-longest-palindromic-substring/2022-11-27 19.26.11 - Accepted - runtime 1620ms - memory 14MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class Solution: - def longestPalindrome(self, s: str) -> str: - ll = len(s) - w, wl = '', 0 - - for i in range(ll): - for j in (0, 1): - l, r = i, i + j - - while l >= 0 and r < ll and s[l] == s[r]: - tl = r - l + 1 - if tl > wl: - w = s[l: r + 1] - wl = tl - - l -= 1 - r += 1 - - return w \ No newline at end of file diff --git a/5-longest-palindromic-substring/2022-11-28 10.32.44 - Accepted - runtime 1300ms - memory 14MB.py b/5-longest-palindromic-substring/2022-11-28 10.32.44 - Accepted - runtime 1300ms - memory 14MB.py deleted file mode 100644 index e639cf3..0000000 --- a/5-longest-palindromic-substring/2022-11-28 10.32.44 - Accepted - runtime 1300ms - memory 14MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def longestPalindrome(self, s: str) -> str: - ll = len(s) - w, wl = '', 0 - - for i in range(ll): - for j in (0, 1): - l, r = i, i + j - - while l >= 0 and r < ll and s[l] == s[r]: - tl = r - l + 1 - if tl > wl: - w = s[l: r + 1] - wl = tl - - l -= 1 - r += 1 - - - return w \ No newline at end of file diff --git a/5-longest-palindromic-substring/2022-12-16 14.17.05 - Accepted - runtime 575ms - memory 13.8MB.py b/5-longest-palindromic-substring/2022-12-16 14.17.05 - Accepted - runtime 575ms - memory 13.8MB.py deleted file mode 100644 index 6dd5240..0000000 --- a/5-longest-palindromic-substring/2022-12-16 14.17.05 - Accepted - runtime 575ms - memory 13.8MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def longestPalindrome(self, s: str) -> str: - ll = len(s) - w, wl = '', 0 - for i in range(ll): - for j in (0, 1): - l, r = i, i + j - while l >= 0 and r < ll and s[l] == s[r]: - t = r - l + 1 - if t > wl: - wl = t - w = s[l: r + 1] - l -= 1 - r += 1 - - return w \ No newline at end of file diff --git a/5-longest-palindromic-substring/2023-01-19 18.12.07 - Accepted - runtime 544ms - memory 13.8MB.py b/5-longest-palindromic-substring/2023-01-19 18.12.07 - Accepted - runtime 544ms - memory 13.8MB.py deleted file mode 100644 index 005b489..0000000 --- a/5-longest-palindromic-substring/2023-01-19 18.12.07 - Accepted - runtime 544ms - memory 13.8MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def longestPalindrome(self, s: str) -> str: - ll = len(s) - res = '' - wl = 0 - for i in range(ll): - for j in (0, 1): - l = i - r = i + j - while r < ll and l >= 0 and s[l] == s[r]: - if r - l + 1 > wl: - wl = r - l + 1 - res = s[l:r + 1] - l -= 1 - r += 1 - return res \ No newline at end of file diff --git a/5-longest-palindromic-substring/2023-03-03 14.57.53 - Accepted - runtime 4224ms - memory 37.3MB.kt b/5-longest-palindromic-substring/2023-03-03 14.57.53 - Accepted - runtime 4224ms - memory 37.3MB.kt deleted file mode 100644 index c8f63ae..0000000 --- a/5-longest-palindromic-substring/2023-03-03 14.57.53 - Accepted - runtime 4224ms - memory 37.3MB.kt +++ /dev/null @@ -1,15 +0,0 @@ -class Solution { - fun longestPalindrome(s: String): String { - - var temp = "" - - for (i in s.length downTo 0) { - for (j in 0 .. s.length - i) { - temp = s.substring(j, j + i) - if (temp.reversed() == temp) return temp - } - } - - return s.substring(0, 1) - } -} \ No newline at end of file diff --git a/5-longest-palindromic-substring/2024-02-18 12.02.26 - Accepted - runtime 7ms - memory 12.9MB.cpp b/5-longest-palindromic-substring/2024-02-18 12.02.26 - Accepted - runtime 7ms - memory 12.9MB.cpp deleted file mode 100644 index b9296b8..0000000 --- a/5-longest-palindromic-substring/2024-02-18 12.02.26 - Accepted - runtime 7ms - memory 12.9MB.cpp +++ /dev/null @@ -1,21 +0,0 @@ -class Solution { -public: - string longestPalindrome(string s) { - int l = s.size(), wl = 0; - string w; - for (int i = 0;i < l;i++){ - for (int u = 0;u < 2;u++){ - int j = i, k = i + u; - while (j >= 0 && l > k && s[j] == s[k]){ - j--; - k++; - } - if (k - j - 1 > wl){ - wl = k - j - 1; - w = s.substr(j + 1, k - j - 1); - } - } - } - return w; - } -}; \ No newline at end of file diff --git a/50-powx-n/2022-07-06 13.14.25 - Accepted - runtime 53ms - memory 14MB.py b/50-powx-n/2022-07-06 13.14.25 - Accepted - runtime 53ms - memory 14MB.py deleted file mode 100644 index e8ef429..0000000 --- a/50-powx-n/2022-07-06 13.14.25 - Accepted - runtime 53ms - memory 14MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def myPow(self, x: float, n: int) -> float: - return math.pow(x, n) \ No newline at end of file diff --git a/500-keyboard-row/2022-07-21 17.04.16 - Accepted - runtime 28ms - memory 13.9MB.py b/500-keyboard-row/2022-07-21 17.04.16 - Accepted - runtime 28ms - memory 13.9MB.py deleted file mode 100644 index 97fd11d..0000000 --- a/500-keyboard-row/2022-07-21 17.04.16 - Accepted - runtime 28ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def findWords(self, words: List[str]) -> List[str]: - l = ['qwertyuiop','asdfghjkl','zxcvbnm'] - t = [] - for word in words: - if any(all(char in f for char in word.lower()) for f in l): - t += word, - - return t \ No newline at end of file diff --git a/504-base-7/2024-04-01 19.43.04 - Accepted - runtime 34ms - memory 16.4MB.py b/504-base-7/2024-04-01 19.43.04 - Accepted - runtime 34ms - memory 16.4MB.py deleted file mode 100644 index 6d523d9..0000000 --- a/504-base-7/2024-04-01 19.43.04 - Accepted - runtime 34ms - memory 16.4MB.py +++ /dev/null @@ -1,23 +0,0 @@ -def n(x: int, base: int) -> str: - symbols = ( - "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - + "".join(chr(f) for f in range(123, 123 + base)) - ) - if x < 0: - sign = -1 - if x == 0: - return "0" - else: - sign = 1 - x *= sign - result = "" - while x: - result += symbols[int(x % base)] - x //= base - if sign == -1: - result += "-" - - return result[::-1] -class Solution: - def convertToBase7(self, num: int) -> str: - return n(num, 7) if num >= 0 else '-' + n(-num, 7) \ No newline at end of file diff --git a/506-relative-ranks/2024-05-08 10.23.23 - Accepted - runtime 60ms - memory 17.7MB.py b/506-relative-ranks/2024-05-08 10.23.23 - Accepted - runtime 60ms - memory 17.7MB.py deleted file mode 100644 index c487867..0000000 --- a/506-relative-ranks/2024-05-08 10.23.23 - Accepted - runtime 60ms - memory 17.7MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def findRelativeRanks(self, score: List[int]) -> List[str]: - d = {} - for ind, i in enumerate(sorted(score, reverse=True), 1): - d[i] = ind - return [ - {1: 'Gold Medal', 2: 'Silver Medal', 3: 'Bronze Medal'}.get(d[f], str(d[f])) - for f in score] \ No newline at end of file diff --git a/513-find-bottom-left-tree-value/2024-02-28 19.11.58 - Accepted - runtime 693ms - memory 19.4MB.py b/513-find-bottom-left-tree-value/2024-02-28 19.11.58 - Accepted - runtime 693ms - memory 19.4MB.py deleted file mode 100644 index 71cb574..0000000 --- a/513-find-bottom-left-tree-value/2024-02-28 19.11.58 - Accepted - runtime 693ms - memory 19.4MB.py +++ /dev/null @@ -1,16 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, node, depth = 1, left: bool = False): - if node: - yield depth, node.val - yield from self.traverse(node.left, depth + 1, True) - yield from self.traverse(node.right, depth + 1) - - def findBottomLeftValue(self, root: Optional[TreeNode]) -> int: - d = list(self.traverse(root)) - return max(d, key=lambda x: (x[0], -d.index(x)))[1] \ No newline at end of file diff --git a/513-find-bottom-left-tree-value/2024-02-28 19.14.16 - Accepted - runtime 28ms - memory 18.2MB.py b/513-find-bottom-left-tree-value/2024-02-28 19.14.16 - Accepted - runtime 28ms - memory 18.2MB.py deleted file mode 100644 index 89e036b..0000000 --- a/513-find-bottom-left-tree-value/2024-02-28 19.14.16 - Accepted - runtime 28ms - memory 18.2MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def findBottomLeftValue(self, root: Optional[TreeNode]) -> int: - queue = [root] - for node in queue: - queue += filter(None, (node.right, node.left)) - - return node.val - \ No newline at end of file diff --git a/513-find-bottom-left-tree-value/2024-02-28 19.19.57 - Accepted - runtime 13ms - memory 20.2MB.cpp b/513-find-bottom-left-tree-value/2024-02-28 19.19.57 - Accepted - runtime 13ms - memory 20.2MB.cpp deleted file mode 100644 index 72507cc..0000000 --- a/513-find-bottom-left-tree-value/2024-02-28 19.19.57 - Accepted - runtime 13ms - memory 20.2MB.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int findBottomLeftValue(TreeNode* root) { - queue q; - TreeNode* n; - q.push(root); - while (!q.empty()){ - n = q.front(); - q.pop(); - if (n -> right) q.push(n -> right); - if (n -> left) q.push(n -> left); - } - return n->val; - } -}; \ No newline at end of file diff --git a/514-freedom-trail/2024-04-27 14.47.26 - Accepted - runtime 71ms - memory 16.5MB.py b/514-freedom-trail/2024-04-27 14.47.26 - Accepted - runtime 71ms - memory 16.5MB.py deleted file mode 100644 index 0edef72..0000000 --- a/514-freedom-trail/2024-04-27 14.47.26 - Accepted - runtime 71ms - memory 16.5MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def findRotateSteps(self, ring: str, key: str) -> int: - indexes, n, dp, pre = collections.defaultdict(list), len(ring), [0] * len(ring), key[0] - for i, c in enumerate(ring): - indexes[c].append(i) - for i in indexes[key[0]]: - dp[i] = min(i, n - i) + 1 - for c in key[1:]: - for i in indexes[c]: - dp[i] = min(dp[j] + min(i - j, j + n - i) if i >= j else dp[j] + min(j - i, i + n - j) for j in indexes[pre]) + 1 - pre = c - return min(dp[i] for i in indexes[key[-1]]) \ No newline at end of file diff --git a/515-find-largest-value-in-each-tree-row/2024-01-22 00.05.58 - Accepted - runtime 41ms - memory 18.3MB.py b/515-find-largest-value-in-each-tree-row/2024-01-22 00.05.58 - Accepted - runtime 41ms - memory 18.3MB.py deleted file mode 100644 index 72aa3cf..0000000 --- a/515-find-largest-value-in-each-tree-row/2024-01-22 00.05.58 - Accepted - runtime 41ms - memory 18.3MB.py +++ /dev/null @@ -1,23 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, root, level, l={}): - if level in l: - l[level].append(root.val) - else: - l[level] = [root.val] - if root.left: - self.traverse(root.left, level + 1, l) - if root.right: - self.traverse(root.right, level + 1, l) - - def largestValues(self, root: Optional[TreeNode]) -> List[int]: - if not root: - return [] - l = {} - self.traverse(root, 1, l) - return [max(f) for f in l.values()] \ No newline at end of file diff --git a/515-find-largest-value-in-each-tree-row/2024-01-22 00.13.33 - Accepted - runtime 42ms - memory 18.2MB.py b/515-find-largest-value-in-each-tree-row/2024-01-22 00.13.33 - Accepted - runtime 42ms - memory 18.2MB.py deleted file mode 100644 index 6b0fcbd..0000000 --- a/515-find-largest-value-in-each-tree-row/2024-01-22 00.13.33 - Accepted - runtime 42ms - memory 18.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def largestValues(self, root: Optional[TreeNode]) -> List[int]: - maxes = [] - level = [root] - while any(level): - maxes.append(max(n.val for n in level)) - level = [kid for node in level for kid in (node.left, node.right) if kid] - - return maxes \ No newline at end of file diff --git a/516-longest-palindromic-subsequence/2023-04-14 12.17.20 - Accepted - runtime 1179ms - memory 13.9MB.py b/516-longest-palindromic-subsequence/2023-04-14 12.17.20 - Accepted - runtime 1179ms - memory 13.9MB.py deleted file mode 100644 index 6fa095a..0000000 --- a/516-longest-palindromic-subsequence/2023-04-14 12.17.20 - Accepted - runtime 1179ms - memory 13.9MB.py +++ /dev/null @@ -1,28 +0,0 @@ -class Solution: - def longestPalindromeSubseq(self, s: str) -> int: - n = len(s) - dp = [1] * n - for i in range(1, n): - pre = dp[i] - for j in range(i - 1, -1, -1): - temp = dp[j] - if s[i] == s[j]: - dp[j] = 2 + pre if j + 1 <= i - 1 else 2 - else: - dp[j] = max(dp[j], dp[j + 1]) - pre = temp - - return dp[0] - -# n = len(s) -# dp = [1] * n -# for j in xrange(1, len(s)): -# pre = dp[j] -# for i in reversed(xrange(0, j)): -# tmp = dp[i] -# if s[i] == s[j]: -# dp[i] = 2 + pre if i + 1 <= j - 1 else 2 -# else: -# dp[i] = max(dp[i + 1], dp[i]) -# pre = tmp -# return dp[0] \ No newline at end of file diff --git a/520-detect-capital/2022-07-21 17.06.47 - Accepted - runtime 48ms - memory 13.9MB.py b/520-detect-capital/2022-07-21 17.06.47 - Accepted - runtime 48ms - memory 13.9MB.py deleted file mode 100644 index dff994d..0000000 --- a/520-detect-capital/2022-07-21 17.06.47 - Accepted - runtime 48ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def detectCapitalUse(self, word: str) -> bool: - return word.isupper() or word.istitle() or word.islower() \ No newline at end of file diff --git a/520-detect-capital/2023-01-05 20.48.46 - Accepted - runtime 67ms - memory 13.7MB.py b/520-detect-capital/2023-01-05 20.48.46 - Accepted - runtime 67ms - memory 13.7MB.py deleted file mode 100644 index 6fa6715..0000000 --- a/520-detect-capital/2023-01-05 20.48.46 - Accepted - runtime 67ms - memory 13.7MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def detectCapitalUse(self, word: str) -> bool: - return word.islower() or word.isupper() or word.istitle() \ No newline at end of file diff --git a/520-detect-capital/2023-01-05 20.50.30 - Accepted - runtime 65ms - memory 13.9MB.py b/520-detect-capital/2023-01-05 20.50.30 - Accepted - runtime 65ms - memory 13.9MB.py deleted file mode 100644 index e62a305..0000000 --- a/520-detect-capital/2023-01-05 20.50.30 - Accepted - runtime 65ms - memory 13.9MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def detectCapitalUse(self, word: str) -> bool: - u = l = 0 - for i in word: - if i.islower(): - l += 1 - else: - u += 1 - - return not l or not u or u == 1 and word[0].isupper() \ No newline at end of file diff --git a/521-longest-uncommon-subsequence-i/2024-03-31 20.55.28 - Accepted - runtime 22ms - memory 16.5MB.py b/521-longest-uncommon-subsequence-i/2024-03-31 20.55.28 - Accepted - runtime 22ms - memory 16.5MB.py deleted file mode 100644 index 02063b3..0000000 --- a/521-longest-uncommon-subsequence-i/2024-03-31 20.55.28 - Accepted - runtime 22ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findLUSlength(self, a: str, b: str) -> int: - return -1 if a == b else max(len(a), len(b)) \ No newline at end of file diff --git a/525-contiguous-array/2024-03-16 14.29.53 - Accepted - runtime 609ms - memory 22.2MB.py b/525-contiguous-array/2024-03-16 14.29.53 - Accepted - runtime 609ms - memory 22.2MB.py deleted file mode 100644 index 45fb120..0000000 --- a/525-contiguous-array/2024-03-16 14.29.53 - Accepted - runtime 609ms - memory 22.2MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def findMaxLength(self, nums: List[int]) -> int: - res = c = 0 - d = {0: 0} - for ind, i in enumerate(nums, 1): - if i == 0:c -= 1 - else:c += 1 - if c in d: - res = max(res, ind - d[c]) - else: - d[c] = ind - return res \ No newline at end of file diff --git a/528-swapping-nodes-in-a-linked-list/2023-05-15 15.35.57 - Accepted - runtime 1845ms - memory 66.8MB.py b/528-swapping-nodes-in-a-linked-list/2023-05-15 15.35.57 - Accepted - runtime 1845ms - memory 66.8MB.py deleted file mode 100644 index 95da9b4..0000000 --- a/528-swapping-nodes-in-a-linked-list/2023-05-15 15.35.57 - Accepted - runtime 1845ms - memory 66.8MB.py +++ /dev/null @@ -1,23 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def swapNodes(self, head: Optional[ListNode], k: int) -> Optional[ListNode]: - if not head: - return None - - l = [] - while head: - l.append(head.val) - head = head.next - - k -= 1 - l[k], l[~k] = l[~k], l[k] - dummy = curr = ListNode() - for i in l: - curr.next = ListNode(i) - curr = curr.next - - return dummy.next \ No newline at end of file diff --git a/528-swapping-nodes-in-a-linked-list/2024-02-24 00.30.15 - Accepted - runtime 372ms - memory 40.5MB.py b/528-swapping-nodes-in-a-linked-list/2024-02-24 00.30.15 - Accepted - runtime 372ms - memory 40.5MB.py deleted file mode 100644 index 8b11a49..0000000 --- a/528-swapping-nodes-in-a-linked-list/2024-02-24 00.30.15 - Accepted - runtime 372ms - memory 40.5MB.py +++ /dev/null @@ -1,15 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def swapNodes(self, head: Optional[ListNode], k: int) -> Optional[ListNode]: - l = [] - while head: - l.append(head) - head = head.next - k -= 1 - l[k].val, l[~k].val = l[~k].val, l[k].val - - return l[0] \ No newline at end of file diff --git a/528-swapping-nodes-in-a-linked-list/2024-02-24 00.41.36 - Accepted - runtime 364ms - memory 183.8MB.cpp b/528-swapping-nodes-in-a-linked-list/2024-02-24 00.41.36 - Accepted - runtime 364ms - memory 183.8MB.cpp deleted file mode 100644 index 0383a54..0000000 --- a/528-swapping-nodes-in-a-linked-list/2024-02-24 00.41.36 - Accepted - runtime 364ms - memory 183.8MB.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* swapNodes(ListNode* head, int k) { - ListNode *a = nullptr, *b = nullptr; - for (ListNode* p = head; p != NULL; p = p -> next){ - b = b == nullptr? nullptr: b->next; - if (--k == 0){ - a = p; - b = head; - } - } - swap(a -> val, b -> val); - return head; - } -}; \ No newline at end of file diff --git a/53-maximum-subarray/2022-06-23 16.36.47 - Accepted - runtime 1257ms - memory 27.9MB.py b/53-maximum-subarray/2022-06-23 16.36.47 - Accepted - runtime 1257ms - memory 27.9MB.py deleted file mode 100644 index 137f4a3..0000000 --- a/53-maximum-subarray/2022-06-23 16.36.47 - Accepted - runtime 1257ms - memory 27.9MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def maxSubArray(self, nums: List[int]) -> int: - current = res = nums[0] - for i in range(1, len(nums)): - current = max(current + nums[i], nums[i]) - res = max(current, res) - return res \ No newline at end of file diff --git a/54-spiral-matrix/2023-01-28 19.23.56 - Accepted - runtime 32ms - memory 13.9MB.py b/54-spiral-matrix/2023-01-28 19.23.56 - Accepted - runtime 32ms - memory 13.9MB.py deleted file mode 100644 index 327f884..0000000 --- a/54-spiral-matrix/2023-01-28 19.23.56 - Accepted - runtime 32ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def spiralOrder(self, matrix: List[List[int]]) -> List[int]: - return matrix and list(matrix.pop(0)) + self.spiralOrder(list(zip(*matrix))[::-1]) \ No newline at end of file diff --git a/54-spiral-matrix/2023-01-31 19.06.09 - Accepted - runtime 25ms - memory 13.9MB.py b/54-spiral-matrix/2023-01-31 19.06.09 - Accepted - runtime 25ms - memory 13.9MB.py deleted file mode 100644 index 327f884..0000000 --- a/54-spiral-matrix/2023-01-31 19.06.09 - Accepted - runtime 25ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def spiralOrder(self, matrix: List[List[int]]) -> List[int]: - return matrix and list(matrix.pop(0)) + self.spiralOrder(list(zip(*matrix))[::-1]) \ No newline at end of file diff --git a/54-spiral-matrix/2023-01-31 19.10.29 - Accepted - runtime 37ms - memory 13.9MB.py b/54-spiral-matrix/2023-01-31 19.10.29 - Accepted - runtime 37ms - memory 13.9MB.py deleted file mode 100644 index bf8bb8e..0000000 --- a/54-spiral-matrix/2023-01-31 19.10.29 - Accepted - runtime 37ms - memory 13.9MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def spiralOrder(self, matrix: List[List[int]]) -> List[int]: - res = [] - while matrix: - res.extend(matrix.pop(0)) - matrix = list(zip(*matrix))[::-1] - - return res \ No newline at end of file diff --git a/54-spiral-matrix/2023-05-09 12.38.05 - Accepted - runtime 32ms - memory 16.2MB.py b/54-spiral-matrix/2023-05-09 12.38.05 - Accepted - runtime 32ms - memory 16.2MB.py deleted file mode 100644 index 0bb7b2e..0000000 --- a/54-spiral-matrix/2023-05-09 12.38.05 - Accepted - runtime 32ms - memory 16.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def spiralOrder(self, matrix: List[List[int]]) -> List[int]: - res = [] - while matrix: - res.extend(matrix[0]) - matrix = list(zip(*matrix[1:]))[::-1] - - return res - \ No newline at end of file diff --git a/541-reverse-string-ii/2024-03-31 23.45.22 - Accepted - runtime 44ms - memory 16.7MB.py b/541-reverse-string-ii/2024-03-31 23.45.22 - Accepted - runtime 44ms - memory 16.7MB.py deleted file mode 100644 index 1527425..0000000 --- a/541-reverse-string-ii/2024-03-31 23.45.22 - Accepted - runtime 44ms - memory 16.7MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def reverseStr(self, s: str, k: int) -> str: - s = list(s) - for i in range(0, len(s), 2 * k):s[i:i + k] = s[i:i + k][::-1] - return ''.join(s) \ No newline at end of file diff --git a/543-diameter-of-binary-tree/2024-02-18 22.50.50 - Accepted - runtime 7ms - memory 18.8MB.cpp b/543-diameter-of-binary-tree/2024-02-18 22.50.50 - Accepted - runtime 7ms - memory 18.8MB.cpp deleted file mode 100644 index 7ae59d9..0000000 --- a/543-diameter-of-binary-tree/2024-02-18 22.50.50 - Accepted - runtime 7ms - memory 18.8MB.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int res = 0; - int depth(TreeNode* n){ - if (!n) return 0; - int left = depth(n -> left), right = depth(n -> right); - res = max(res, left + right); - return 1 + max(left, right); - } - int diameterOfBinaryTree(TreeNode* r) { - depth(r); - return res; - } -}; \ No newline at end of file diff --git a/543-diameter-of-binary-tree/2024-02-28 00.27.21 - Accepted - runtime 6ms - memory 18.9MB.cpp b/543-diameter-of-binary-tree/2024-02-28 00.27.21 - Accepted - runtime 6ms - memory 18.9MB.cpp deleted file mode 100644 index 7ae59d9..0000000 --- a/543-diameter-of-binary-tree/2024-02-28 00.27.21 - Accepted - runtime 6ms - memory 18.9MB.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int res = 0; - int depth(TreeNode* n){ - if (!n) return 0; - int left = depth(n -> left), right = depth(n -> right); - res = max(res, left + right); - return 1 + max(left, right); - } - int diameterOfBinaryTree(TreeNode* r) { - depth(r); - return res; - } -}; \ No newline at end of file diff --git a/551-student-attendance-record-i/2024-03-31 23.50.21 - Accepted - runtime 32ms - memory 16.6MB.py b/551-student-attendance-record-i/2024-03-31 23.50.21 - Accepted - runtime 32ms - memory 16.6MB.py deleted file mode 100644 index d0ec23d..0000000 --- a/551-student-attendance-record-i/2024-03-31 23.50.21 - Accepted - runtime 32ms - memory 16.6MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def checkRecord(self, s: str) -> bool: - return s.count('A') < 2 and 'LLL' not in s \ No newline at end of file diff --git a/557-reverse-words-in-a-string-iii/2023-01-27 12.53.59 - Accepted - runtime 43ms - memory 14.6MB.py b/557-reverse-words-in-a-string-iii/2023-01-27 12.53.59 - Accepted - runtime 43ms - memory 14.6MB.py deleted file mode 100644 index 610ac9f..0000000 --- a/557-reverse-words-in-a-string-iii/2023-01-27 12.53.59 - Accepted - runtime 43ms - memory 14.6MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def reverseWords(self, s: str) -> str: - return ' '.join(f[::-1] for f in s.split()) \ No newline at end of file diff --git a/557-reverse-words-in-a-string-iii/2024-02-18 00.20.23 - Accepted - runtime 23ms - memory 16.7MB.cpp b/557-reverse-words-in-a-string-iii/2024-02-18 00.20.23 - Accepted - runtime 23ms - memory 16.7MB.cpp deleted file mode 100644 index ce1d2ad..0000000 --- a/557-reverse-words-in-a-string-iii/2024-02-18 00.20.23 - Accepted - runtime 23ms - memory 16.7MB.cpp +++ /dev/null @@ -1,16 +0,0 @@ -class Solution { -public: - string reverseWords(string s) { - string res, tmp; - for (char i: s){ - if (i == ' '){ - reverse(tmp.begin(), tmp.end()); - res += tmp + " "; - tmp = ""; - } - else tmp += i; - } - reverse(tmp.begin(), tmp.end()); - return res + tmp; - } -}; \ No newline at end of file diff --git a/557-reverse-words-in-a-string-iii/2024-02-18 00.22.14 - Accepted - runtime 10ms - memory 13MB.cpp b/557-reverse-words-in-a-string-iii/2024-02-18 00.22.14 - Accepted - runtime 10ms - memory 13MB.cpp deleted file mode 100644 index fd78771..0000000 --- a/557-reverse-words-in-a-string-iii/2024-02-18 00.22.14 - Accepted - runtime 10ms - memory 13MB.cpp +++ /dev/null @@ -1,18 +0,0 @@ -class Solution { -public: - string reverseWords(string s) { - stringstream ss(s); - string o = ""; - string ans; - ss >> ans; - reverse(ans.begin(), ans.end()); - while (!ss.eof()) { - ss >> o; - reverse(o.begin(), o.end()); - ans.push_back(' '); - ans += o; - } - - return ans; - } -}; \ No newline at end of file diff --git a/561-array-partition/2023-01-27 13.06.41 - Accepted - runtime 341ms - memory 16.6MB.py b/561-array-partition/2023-01-27 13.06.41 - Accepted - runtime 341ms - memory 16.6MB.py deleted file mode 100644 index 1743f89..0000000 --- a/561-array-partition/2023-01-27 13.06.41 - Accepted - runtime 341ms - memory 16.6MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def arrayPairSum(self, nums: List[int]) -> int: - return sum(sorted(nums)[::2]) \ No newline at end of file diff --git a/57-insert-interval/2024-03-18 00.35.25 - Accepted - runtime 62ms - memory 20MB.py b/57-insert-interval/2024-03-18 00.35.25 - Accepted - runtime 62ms - memory 20MB.py deleted file mode 100644 index 59b1bfc..0000000 --- a/57-insert-interval/2024-03-18 00.35.25 - Accepted - runtime 62ms - memory 20MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: - res = [] - for interval in intervals: - if interval[1] < newInterval[0]: - res.append(interval) - elif interval[0] > newInterval[1]: - res.append(newInterval) - newInterval = interval - elif interval[1] >= newInterval[0] or interval[0] <= newInterval[1]: - newInterval[0] = min(interval[0], newInterval[0]) - newInterval[1] = max(newInterval[1], interval[1]) - - - res.append(newInterval); - return res \ No newline at end of file diff --git a/572-subtree-of-another-tree/2024-01-07 19.33.08 - Accepted - runtime 72ms - memory 17.6MB.py b/572-subtree-of-another-tree/2024-01-07 19.33.08 - Accepted - runtime 72ms - memory 17.6MB.py deleted file mode 100644 index 8c64f16..0000000 --- a/572-subtree-of-another-tree/2024-01-07 19.33.08 - Accepted - runtime 72ms - memory 17.6MB.py +++ /dev/null @@ -1,24 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def check(self, n1, n2) -> bool: - if n1 and n2: - return n1.val == n2.val and self.check(n1.left, n2.left) and self.check(n1.right, n2.right) - else: - return n1 is n2 - def isSubtree(self, root: Optional[TreeNode], subRoot: Optional[TreeNode]) -> bool: - stack = [root] - while stack: - n = stack.pop() - if self.check(n, subRoot): - return True - if n.left: - stack.append(n.left) - if n.right: - stack.append(n.right) - - return False \ No newline at end of file diff --git a/58-length-of-last-word/2022-06-15 21.46.06 - Accepted - runtime 36ms - memory 13.8MB.py b/58-length-of-last-word/2022-06-15 21.46.06 - Accepted - runtime 36ms - memory 13.8MB.py deleted file mode 100644 index 40ad18e..0000000 --- a/58-length-of-last-word/2022-06-15 21.46.06 - Accepted - runtime 36ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def lengthOfLastWord(self, s: str) -> int: - return len(s.split()[-1]) \ No newline at end of file diff --git a/58-length-of-last-word/2024-02-17 13.21.12 - Accepted - runtime 0ms - memory 7.6MB.cpp b/58-length-of-last-word/2024-02-17 13.21.12 - Accepted - runtime 0ms - memory 7.6MB.cpp deleted file mode 100644 index 1883b30..0000000 --- a/58-length-of-last-word/2024-02-17 13.21.12 - Accepted - runtime 0ms - memory 7.6MB.cpp +++ /dev/null @@ -1,9 +0,0 @@ -class Solution { -public: - int lengthOfLastWord(string s) { - int res = 0, high = s.size() - 1; - while (high >= 0 && s[high] == ' ')high--; - while (high >= 0 && s[high--] != ' ')res++; - return res; - } -}; \ No newline at end of file diff --git a/58-length-of-last-word/2024-04-01 15.53.26 - Accepted - runtime 32ms - memory 16.8MB.py b/58-length-of-last-word/2024-04-01 15.53.26 - Accepted - runtime 32ms - memory 16.8MB.py deleted file mode 100644 index 40ad18e..0000000 --- a/58-length-of-last-word/2024-04-01 15.53.26 - Accepted - runtime 32ms - memory 16.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def lengthOfLastWord(self, s: str) -> int: - return len(s.split()[-1]) \ No newline at end of file diff --git a/599-minimum-index-sum-of-two-lists/2024-04-01 00.27.29 - Accepted - runtime 141ms - memory 17.1MB.py b/599-minimum-index-sum-of-two-lists/2024-04-01 00.27.29 - Accepted - runtime 141ms - memory 17.1MB.py deleted file mode 100644 index af94a0b..0000000 --- a/599-minimum-index-sum-of-two-lists/2024-04-01 00.27.29 - Accepted - runtime 141ms - memory 17.1MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def findRestaurant(self, A: List[str], B: List[str]) -> List[str]: - Aindex = {u: i for i, u in enumerate(A)} - best, ans = 1e9, [] - - for j, v in enumerate(B): - i = Aindex.get(v, 1e9) - if i + j < best: - best = i + j - ans = [v] - elif i + j == best: - ans.append(v) - return ans \ No newline at end of file diff --git a/6-zigzag-conversion/2024-03-31 18.49.00 - Accepted - runtime 48ms - memory 16.5MB.py b/6-zigzag-conversion/2024-03-31 18.49.00 - Accepted - runtime 48ms - memory 16.5MB.py deleted file mode 100644 index 0ddef5d..0000000 --- a/6-zigzag-conversion/2024-03-31 18.49.00 - Accepted - runtime 48ms - memory 16.5MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def convert(self, s: str, numRows: int) -> str: - if numRows == 1 or numRows >= len(s): - return s - - L = [''] * numRows - index, step = 0, 1 - - for x in s: - L[index] += x - if index == 0: - step = 1 - elif index == numRows -1: - step = -1 - index += step - - return ''.join(L) \ No newline at end of file diff --git a/605-can-place-flowers/2023-03-20 10.45.08 - Accepted - runtime 182ms - memory 14.3MB.py b/605-can-place-flowers/2023-03-20 10.45.08 - Accepted - runtime 182ms - memory 14.3MB.py deleted file mode 100644 index 8ebbb00..0000000 --- a/605-can-place-flowers/2023-03-20 10.45.08 - Accepted - runtime 182ms - memory 14.3MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: - if not n: - return True - for i in range(l := len(flowerbed)): - if flowerbed[i] == 0 and flowerbed[max(i - 1, 0)] == 0 and flowerbed[min(i + 1, l - 1)] == 0: - flowerbed[i] = 1 - n -= 1 - if n == 0: - return True - - return False \ No newline at end of file diff --git a/606-construct-string-from-binary-tree/2024-01-07 22.32.07 - Accepted - runtime 41ms - memory 18.6MB.py b/606-construct-string-from-binary-tree/2024-01-07 22.32.07 - Accepted - runtime 41ms - memory 18.6MB.py deleted file mode 100644 index 88bd7dc..0000000 --- a/606-construct-string-from-binary-tree/2024-01-07 22.32.07 - Accepted - runtime 41ms - memory 18.6MB.py +++ /dev/null @@ -1,20 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, node) -> str: - s = str(node.val) - if node.left or node.right: - if node.left: - s += '(' + self.traverse(node.left) + ')' - else: - s += '()' - if node.right: - s += '(' + self.traverse(node.right) + ')' - return s - - def tree2str(self, root: Optional[TreeNode]) -> str: - return self.traverse(root) \ No newline at end of file diff --git a/61-rotate-list/2022-07-18 16.08.07 - Accepted - runtime 58ms - memory 13.8MB.py b/61-rotate-list/2022-07-18 16.08.07 - Accepted - runtime 58ms - memory 13.8MB.py deleted file mode 100644 index b2e7c1b..0000000 --- a/61-rotate-list/2022-07-18 16.08.07 - Accepted - runtime 58ms - memory 13.8MB.py +++ /dev/null @@ -1,18 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def rotateRight(self, head: Optional[ListNode], k: int) -> Optional[ListNode]: - if not head or not k:return head - last, L = head, 1 - while last.next:last = last.next; L += 1 - last.next = head - - for i in range(L - k % L):last = last.next - final = last.next - last.next = None - - return final - \ No newline at end of file diff --git a/617-merge-two-binary-trees/2024-02-02 00.33.11 - Accepted - runtime 63ms - memory 17MB.py b/617-merge-two-binary-trees/2024-02-02 00.33.11 - Accepted - runtime 63ms - memory 17MB.py deleted file mode 100644 index ff8955c..0000000 --- a/617-merge-two-binary-trees/2024-02-02 00.33.11 - Accepted - runtime 63ms - memory 17MB.py +++ /dev/null @@ -1,17 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def merge(self, a, b): - if a and b: - k = TreeNode(a.val + b.val) - k.left = self.merge(a.left, b.left) - k.right = self.merge(a.right, b.right) - return k - return a or b - def mergeTrees(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> Optional[TreeNode]: - res = self.merge(root1, root2) - return res \ No newline at end of file diff --git a/617-merge-two-binary-trees/2024-02-02 00.34.59 - Accepted - runtime 48ms - memory 17.1MB.py b/617-merge-two-binary-trees/2024-02-02 00.34.59 - Accepted - runtime 48ms - memory 17.1MB.py deleted file mode 100644 index a659209..0000000 --- a/617-merge-two-binary-trees/2024-02-02 00.34.59 - Accepted - runtime 48ms - memory 17.1MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def mergeTrees(self, a: Optional[TreeNode], b: Optional[TreeNode]) -> Optional[TreeNode]: - if a and b: - res = TreeNode(a.val + b.val) - res.left = self.mergeTrees(a.left, b.left) - res.right = self.mergeTrees(a.right, b.right) - return res - return a or b \ No newline at end of file diff --git a/62-unique-paths/2022-08-01 12.55.38 - Accepted - runtime 55ms - memory 13.9MB.py b/62-unique-paths/2022-08-01 12.55.38 - Accepted - runtime 55ms - memory 13.9MB.py deleted file mode 100644 index c7857dc..0000000 --- a/62-unique-paths/2022-08-01 12.55.38 - Accepted - runtime 55ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def uniquePaths(self, m: int, n: int) -> int: - return factorial(m+n-2) // factorial(m-1) // factorial(n-1) \ No newline at end of file diff --git a/62-unique-paths/2022-08-01 12.55.49 - Accepted - runtime 68ms - memory 13.8MB.py b/62-unique-paths/2022-08-01 12.55.49 - Accepted - runtime 68ms - memory 13.8MB.py deleted file mode 100644 index c7857dc..0000000 --- a/62-unique-paths/2022-08-01 12.55.49 - Accepted - runtime 68ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def uniquePaths(self, m: int, n: int) -> int: - return factorial(m+n-2) // factorial(m-1) // factorial(n-1) \ No newline at end of file diff --git a/621-task-scheduler/2024-03-19 12.48.51 - Accepted - runtime 374ms - memory 17MB.py b/621-task-scheduler/2024-03-19 12.48.51 - Accepted - runtime 374ms - memory 17MB.py deleted file mode 100644 index 8427b5f..0000000 --- a/621-task-scheduler/2024-03-19 12.48.51 - Accepted - runtime 374ms - memory 17MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def leastInterval(self, tasks: List[str], n: int) -> int: - c = defaultdict(int) - count = 0 - for i in tasks: - c[i] += 1 - count = max(count, c[i]) - res = (count - 1) * (n + 1) - for i in c: - if c[i] == count: res += 1 - - return max(res, len(tasks)) - \ No newline at end of file diff --git a/623-add-one-row-to-tree/2024-04-16 12.14.31 - Accepted - runtime 53ms - memory 17.8MB.py b/623-add-one-row-to-tree/2024-04-16 12.14.31 - Accepted - runtime 53ms - memory 17.8MB.py deleted file mode 100644 index 8a87ca3..0000000 --- a/623-add-one-row-to-tree/2024-04-16 12.14.31 - Accepted - runtime 53ms - memory 17.8MB.py +++ /dev/null @@ -1,31 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def addOneRow(self, root: Optional[TreeNode], val: int, depth: int) -> Optional[TreeNode]: - if depth == 1: - r = TreeNode(val) - r.left = root - return r - - levels = deque([root]) - depth -= 2 - while depth > 0: - depth -= 1 - for _ in range(len(levels)): - n = levels.pop() - if n.left: - levels.appendleft(n.left) - if n.right: - levels.appendleft(n.right) - - while levels: - n = levels.pop() - left, right = TreeNode(val), TreeNode(val) - left.left, right.right = n.left, n.right - n.left, n.right = left, right - - return root diff --git a/623-add-one-row-to-tree/2024-04-16 12.16.27 - Accepted - runtime 46ms - memory 17.9MB.py b/623-add-one-row-to-tree/2024-04-16 12.16.27 - Accepted - runtime 46ms - memory 17.9MB.py deleted file mode 100644 index 797918d..0000000 --- a/623-add-one-row-to-tree/2024-04-16 12.16.27 - Accepted - runtime 46ms - memory 17.9MB.py +++ /dev/null @@ -1,29 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def addOneRow(self, root: Optional[TreeNode], val: int, depth: int) -> Optional[TreeNode]: - if depth == 1: - return TreeNode(val, root) - - levels = deque([root]) - depth -= 2 - while depth > 0: - depth -= 1 - for _ in range(len(levels)): - n = levels.pop() - if n.left: - levels.appendleft(n.left) - if n.right: - levels.appendleft(n.right) - - while levels: - n = levels.pop() - left, right = TreeNode(val), TreeNode(val) - left.left, right.right = n.left, n.right - n.left, n.right = left, right - - return root diff --git a/630-course-schedule-iii/2022-06-23 13.07.08 - Accepted - runtime 1542ms - memory 20.2MB.py b/630-course-schedule-iii/2022-06-23 13.07.08 - Accepted - runtime 1542ms - memory 20.2MB.py deleted file mode 100644 index 0dfe017..0000000 --- a/630-course-schedule-iii/2022-06-23 13.07.08 - Accepted - runtime 1542ms - memory 20.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def scheduleCourse(self, courses: List[List[int]]) -> int: - courses.sort(key=lambda c: c[1]) - A, curr = [], 0 - for dur, ld in courses: - heapq.heappush(A,-dur) - curr += dur - if curr > ld: curr += heapq.heappop(A) - return len(A) \ No newline at end of file diff --git a/630-course-schedule-iii/2022-06-23 13.07.18 - Accepted - runtime 963ms - memory 19.3MB.py b/630-course-schedule-iii/2022-06-23 13.07.18 - Accepted - runtime 963ms - memory 19.3MB.py deleted file mode 100644 index 0dfe017..0000000 --- a/630-course-schedule-iii/2022-06-23 13.07.18 - Accepted - runtime 963ms - memory 19.3MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def scheduleCourse(self, courses: List[List[int]]) -> int: - courses.sort(key=lambda c: c[1]) - A, curr = [], 0 - for dur, ld in courses: - heapq.heappush(A,-dur) - curr += dur - if curr > ld: curr += heapq.heappop(A) - return len(A) \ No newline at end of file diff --git a/630-course-schedule-iii/2022-06-23 14.46.58 - Accepted - runtime 955ms - memory 20.1MB.py b/630-course-schedule-iii/2022-06-23 14.46.58 - Accepted - runtime 955ms - memory 20.1MB.py deleted file mode 100644 index 499f79a..0000000 --- a/630-course-schedule-iii/2022-06-23 14.46.58 - Accepted - runtime 955ms - memory 20.1MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def scheduleCourse(self, courses: List[List[int]]) -> int: - valid_courses, curr = [], 0 - courses.sort(key=lambda x:x[1]) - for dur, ld in courses: - heapq.heappush(valid_courses, -dur) - curr += dur - if curr > ld: curr += heapq.heappop(valid_courses) - - return len(valid_courses) - \ No newline at end of file diff --git a/633-sum-of-square-numbers/2024-04-15 15.14.41 - Accepted - runtime 127ms - memory 16.5MB.py b/633-sum-of-square-numbers/2024-04-15 15.14.41 - Accepted - runtime 127ms - memory 16.5MB.py deleted file mode 100644 index 0f04e9b..0000000 --- a/633-sum-of-square-numbers/2024-04-15 15.14.41 - Accepted - runtime 127ms - memory 16.5MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def judgeSquareSum(self, c: int) -> bool: - for i in range(int(c ** .5) + 1): - j = (c - i * i) ** .5 - if j % 1 == 0: - return True - - return False \ No newline at end of file diff --git a/64-minimum-path-sum/2023-03-27 15.21.32 - Accepted - runtime 91ms - memory 15.6MB.py b/64-minimum-path-sum/2023-03-27 15.21.32 - Accepted - runtime 91ms - memory 15.6MB.py deleted file mode 100644 index 86f5271..0000000 --- a/64-minimum-path-sum/2023-03-27 15.21.32 - Accepted - runtime 91ms - memory 15.6MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def minPathSum(self, grid: List[List[int]]) -> int: - h, w = len(grid), len(grid[0]) - - for i in range(1, h): - grid[i][0] += grid[i - 1][0] - - for i in range(1, w): - grid[0][i] += grid[0][i - 1] - - for i in range(1, h): - for j in range(1, w): - grid[i][j] += min(grid[i][j - 1], grid[i - 1][j]) - - - return grid[-1][-1] \ No newline at end of file diff --git a/64-minimum-path-sum/2023-03-27 15.38.59 - Accepted - runtime 96ms - memory 15.6MB.py b/64-minimum-path-sum/2023-03-27 15.38.59 - Accepted - runtime 96ms - memory 15.6MB.py deleted file mode 100644 index 9462465..0000000 --- a/64-minimum-path-sum/2023-03-27 15.38.59 - Accepted - runtime 96ms - memory 15.6MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minPathSum(self, grid: List[List[int]]) -> int: - for i in range(1, h := len(grid)):grid[i][0] += grid[i - 1][0] - for i in range(1, w := len(grid[0])):grid[0][i] += grid[0][i - 1] - for i in range(1, h): - for j in range(1, w): - grid[i][j] += min(grid[i - 1][j], grid[i][j - 1]) - - return grid[h - 1][w - 1] \ No newline at end of file diff --git a/645-set-mismatch/2022-10-23 15.13.18 - Accepted - runtime 526ms - memory 15.8MB.py b/645-set-mismatch/2022-10-23 15.13.18 - Accepted - runtime 526ms - memory 15.8MB.py deleted file mode 100644 index e878803..0000000 --- a/645-set-mismatch/2022-10-23 15.13.18 - Accepted - runtime 526ms - memory 15.8MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def findErrorNums(self, nums: List[int]) -> List[int]: - l = len(nums) - a = l * (l + 1) // 2 - d = set() - s = 0 - for i in nums: - if i in d: - k = i - else: - d.add(i) - s += i - - return k, a - s - \ No newline at end of file diff --git a/645-set-mismatch/2022-10-23 15.18.00 - Accepted - runtime 501ms - memory 15.4MB.py b/645-set-mismatch/2022-10-23 15.18.00 - Accepted - runtime 501ms - memory 15.4MB.py deleted file mode 100644 index d75a169..0000000 --- a/645-set-mismatch/2022-10-23 15.18.00 - Accepted - runtime 501ms - memory 15.4MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def findErrorNums(self, nums: List[int]) -> List[int]: - d = df = 0 - for ind, i in enumerate(nums, start = 1): - d += ind - i - df += ind * ind - i * i - - s = df // d - return (s - d) // 2, (s + d) // 2 - \ No newline at end of file diff --git a/645-set-mismatch/2022-10-23 15.18.20 - Accepted - runtime 463ms - memory 15.4MB.py b/645-set-mismatch/2022-10-23 15.18.20 - Accepted - runtime 463ms - memory 15.4MB.py deleted file mode 100644 index 2a6fa6c..0000000 --- a/645-set-mismatch/2022-10-23 15.18.20 - Accepted - runtime 463ms - memory 15.4MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def findErrorNums(self, nums: List[int]) -> List[int]: - d = df = 0 - for ind, i in enumerate(nums, start = 1): - d += ind - i - df += ind * ind - i * i - - s = df // d - return (s - d) // 2, (s + d) // 2 \ No newline at end of file diff --git a/647-palindromic-substrings/2024-02-10 13.34.43 - Accepted - runtime 415ms - memory 16.5MB.py b/647-palindromic-substrings/2024-02-10 13.34.43 - Accepted - runtime 415ms - memory 16.5MB.py deleted file mode 100644 index ea634a5..0000000 --- a/647-palindromic-substrings/2024-02-10 13.34.43 - Accepted - runtime 415ms - memory 16.5MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def countSubstrings(self, s: str) -> int: - c = 0 - for i in range(len(s)): - for j in range(i, len(s)): - t = s[i: j + 1] - c += t == t[::-1] - - return c - \ No newline at end of file diff --git a/65-valid-number/2024-04-05 10.55.01 - Accepted - runtime 38ms - memory 16.6MB.py b/65-valid-number/2024-04-05 10.55.01 - Accepted - runtime 38ms - memory 16.6MB.py deleted file mode 100644 index 37713f5..0000000 --- a/65-valid-number/2024-04-05 10.55.01 - Accepted - runtime 38ms - memory 16.6MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def isNumber(self, s: str) -> bool: - try: - float(s) - return s.lower() not in ('inf', '-inf', '+inf', 'infinity', '-infinity', '+infinity', 'nan', '-nan') - except: - return False \ No newline at end of file diff --git a/653-two-sum-iv-input-is-a-bst/2024-01-07 18.59.04 - Accepted - runtime 57ms - memory 19.7MB.py b/653-two-sum-iv-input-is-a-bst/2024-01-07 18.59.04 - Accepted - runtime 57ms - memory 19.7MB.py deleted file mode 100644 index a469c53..0000000 --- a/653-two-sum-iv-input-is-a-bst/2024-01-07 18.59.04 - Accepted - runtime 57ms - memory 19.7MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def findTarget(self, root: Optional[TreeNode], k: int) -> bool: - s = set() - stack = [root] - while stack: - n = stack.pop() - if n.val in s: - return True - s.add(k - n.val) - if n.left: - stack.append(n.left) - if n.right: - stack.append(n.right) - - return False \ No newline at end of file diff --git a/654-maximum-binary-tree/2024-02-08 22.21.01 - Accepted - runtime 128ms - memory 17.1MB.py b/654-maximum-binary-tree/2024-02-08 22.21.01 - Accepted - runtime 128ms - memory 17.1MB.py deleted file mode 100644 index fc014fb..0000000 --- a/654-maximum-binary-tree/2024-02-08 22.21.01 - Accepted - runtime 128ms - memory 17.1MB.py +++ /dev/null @@ -1,21 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def constructMaximumBinaryTree(self, nums: List[int]) -> Optional[TreeNode]: - nodes = [] - for i in nums: - node = TreeNode(i) - while nodes and nodes[-1].val < i: - node.left = nodes.pop() - - if nodes: - nodes[-1].right = node - - nodes.append(node) - - return nodes.pop(0) - \ No newline at end of file diff --git a/657-robot-return-to-origin/2024-04-01 00.31.58 - Accepted - runtime 102ms - memory 16.6MB.py b/657-robot-return-to-origin/2024-04-01 00.31.58 - Accepted - runtime 102ms - memory 16.6MB.py deleted file mode 100644 index f7e76c6..0000000 --- a/657-robot-return-to-origin/2024-04-01 00.31.58 - Accepted - runtime 102ms - memory 16.6MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def judgeCircle(self, moves: str) -> bool: - x = y = 0 - for i in moves: - x += [[0, -1][i == 'L'], 1][i == 'R'] - y += [[0, -1][i == 'D'], 1][i == 'U'] - - return not x and not y \ No newline at end of file diff --git a/66-plus-one/2022-06-15 23.39.23 - Accepted - runtime 72ms - memory 13.9MB.py b/66-plus-one/2022-06-15 23.39.23 - Accepted - runtime 72ms - memory 13.9MB.py deleted file mode 100644 index f2b3dc5..0000000 --- a/66-plus-one/2022-06-15 23.39.23 - Accepted - runtime 72ms - memory 13.9MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def plusOne(self, digits: List[int]) -> List[int]: - a = int(''.join(str(f)for f in digits)) + 1 - return list(str(a)) \ No newline at end of file diff --git a/66-plus-one/2024-02-17 14.25.06 - Accepted - runtime 0ms - memory 10.3MB.cpp b/66-plus-one/2024-02-17 14.25.06 - Accepted - runtime 0ms - memory 10.3MB.cpp deleted file mode 100644 index 27a224b..0000000 --- a/66-plus-one/2024-02-17 14.25.06 - Accepted - runtime 0ms - memory 10.3MB.cpp +++ /dev/null @@ -1,21 +0,0 @@ -class Solution { -public: - vector plusOne(vector& digits) { - int high = digits.size() - 1; - while(high >= 0){ // 19999999 - if(digits[high] == 9) { - digits[high] = 0; - if (!high){ - digits.push_back(0); - digits[0] = 1; - } - } - else{ - digits[high]++; - return digits; - } - high--; - } - return digits; - } -}; \ No newline at end of file diff --git a/665-non-decreasing-array/2022-06-25 22.48.17 - Accepted - runtime 193ms - memory 15.2MB.py b/665-non-decreasing-array/2022-06-25 22.48.17 - Accepted - runtime 193ms - memory 15.2MB.py deleted file mode 100644 index 9af7ca7..0000000 --- a/665-non-decreasing-array/2022-06-25 22.48.17 - Accepted - runtime 193ms - memory 15.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def checkPossibility(self, A): - p, n = -1, len(A) - for i in range(n - 1): - if A[i] > A[i+1]: - if p != -1: return False - p = i - - return p in [-1, 0, n-2] or A[p-1] <= A[p+1] or A[p] <= A[p+2] \ No newline at end of file diff --git a/67-add-binary/2022-06-20 19.33.28 - Accepted - runtime 36ms - memory 13.9MB.py b/67-add-binary/2022-06-20 19.33.28 - Accepted - runtime 36ms - memory 13.9MB.py deleted file mode 100644 index cbeb033..0000000 --- a/67-add-binary/2022-06-20 19.33.28 - Accepted - runtime 36ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def addBinary(self, a: str, b: str) -> str: - return f'{int(a,2) + int(b,2):b}' \ No newline at end of file diff --git a/678-valid-parenthesis-string/2024-04-07 14.11.33 - Accepted - runtime 39ms - memory 16.6MB.py b/678-valid-parenthesis-string/2024-04-07 14.11.33 - Accepted - runtime 39ms - memory 16.6MB.py deleted file mode 100644 index 1e33bad..0000000 --- a/678-valid-parenthesis-string/2024-04-07 14.11.33 - Accepted - runtime 39ms - memory 16.6MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def checkValidString(self, s: str) -> bool: - a = b = 0 - for i in s: - a = a - 1 if i == ')' else a + 1 - b = b + 1 if i == '(' else max(b - 1, 0) - if a < 0: return False - - - return b == 0 \ No newline at end of file diff --git a/686-repeated-string-match/2024-03-12 16.07.58 - Accepted - runtime 41ms - memory 16.7MB.py b/686-repeated-string-match/2024-03-12 16.07.58 - Accepted - runtime 41ms - memory 16.7MB.py deleted file mode 100644 index 9127619..0000000 --- a/686-repeated-string-match/2024-03-12 16.07.58 - Accepted - runtime 41ms - memory 16.7MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def repeatedStringMatch(self, a: str, b: str) -> int: - t = ceil(len(b) / len(a)) - return t * (b in a * t) or (t + 1) * (b in a * (t + 1)) or -1 \ No newline at end of file diff --git a/69-sqrtx/2022-06-20 19.34.51 - Accepted - runtime 59ms - memory 13.9MB.py b/69-sqrtx/2022-06-20 19.34.51 - Accepted - runtime 59ms - memory 13.9MB.py deleted file mode 100644 index 8ba9663..0000000 --- a/69-sqrtx/2022-06-20 19.34.51 - Accepted - runtime 59ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def mySqrt(self, x: int) -> int: - return int(__import__('math').sqrt(x)) \ No newline at end of file diff --git a/695-max-area-of-island/2022-07-15 14.42.17 - Accepted - runtime 427ms - memory 14.4MB.py b/695-max-area-of-island/2022-07-15 14.42.17 - Accepted - runtime 427ms - memory 14.4MB.py deleted file mode 100644 index c826473..0000000 --- a/695-max-area-of-island/2022-07-15 14.42.17 - Accepted - runtime 427ms - memory 14.4MB.py +++ /dev/null @@ -1,32 +0,0 @@ -class Solution: - def neighbours(self, x, y, grid, visited, w, h): - neigh = [] - for a,b in ((0,1),(0,-1),(1,0),(-1,0)): - X = max(min(x + a, w), 0) - Y = max(min(y + b, h), 0) - if grid[Y][X] and not visited[Y][X]: - neigh.append((X,Y)) - return neigh - - def bfs(self, x, y, grid, visited, w, h, res = 0): - visit = [(x,y)] - while visit: - X,Y = visit.pop() - if visited[Y][X] or not grid[Y][X]:continue - visited[Y][X] = 1 - visit.extend(self.neighbours(X, Y, grid, visited, w, h)) - res += grid[Y][X] - - return res - - - def maxAreaOfIsland(self, grid: List[List[int]]) -> int: - w, h = len(grid[0]), len(grid) - visited = [[0] * w for f in range(h)] - r = [] - for y,i in enumerate(grid): - for x,j in enumerate(i): - if not visited[y][x]: - r.append(self.bfs(x,y,grid,visited,w-1,h-1)) - return max(r) - \ No newline at end of file diff --git a/695-max-area-of-island/2022-07-15 14.47.48 - Accepted - runtime 344ms - memory 14.8MB.py b/695-max-area-of-island/2022-07-15 14.47.48 - Accepted - runtime 344ms - memory 14.8MB.py deleted file mode 100644 index 131bcd2..0000000 --- a/695-max-area-of-island/2022-07-15 14.47.48 - Accepted - runtime 344ms - memory 14.8MB.py +++ /dev/null @@ -1,25 +0,0 @@ -class Solution: - def maxAreaOfIsland(self, grid: List[List[int]]) -> int: - w, h = len(grid[0]) - 1, len(grid) - 1 - visited = set() - r = [] - for y,i in enumerate(grid): - for x,j in enumerate(i): - if (x,y) not in visited: - visit = [(x,y)] - size = 0 - while visit: - X,Y = visit.pop() - if (X,Y) in visited or not grid[Y][X]: - continue - visited.add((X,Y)) - size += 1 - for a,b in ((1,0),(-1,0),(0,1),(0,-1)): - XX = max(min(X + a, w),0) - YY = max(min(Y + b, h),0) - visit.append((XX,YY)) - - r.append(size) - - return max(r) - \ No newline at end of file diff --git a/695-max-area-of-island/2022-07-16 01.20.04 - Accepted - runtime 250ms - memory 14.2MB.py b/695-max-area-of-island/2022-07-16 01.20.04 - Accepted - runtime 250ms - memory 14.2MB.py deleted file mode 100644 index d3773ba..0000000 --- a/695-max-area-of-island/2022-07-16 01.20.04 - Accepted - runtime 250ms - memory 14.2MB.py +++ /dev/null @@ -1,25 +0,0 @@ -class Solution: - def maxAreaOfIsland(self, grid: List[List[int]]) -> int: - w, h = len(grid[0]), len(grid) - visited = [[0] * w for f in range(h)] - areas = [] - for y,i in enumerate(grid): - for x,j in enumerate(i): - if not visited[y][x]: - visit = [(x,y)] - size = 0 - while visit: - X,Y = visit.pop(0) - if visited[Y][X] or not grid[Y][X]:continue - visited[Y][X] = 1 - size += grid[Y][X] - for a,b in ((1,0),(-1,0),(0,1),(0,-1)): - XX = max(min(X + a, w - 1), 0) - YY = max(min(Y + b, h - 1), 0) - if not visited[YY][XX] and grid[YY][XX]: - visit.append((XX,YY)) - areas.append(size) - - - - return max(areas) \ No newline at end of file diff --git a/695-max-area-of-island/2022-07-16 01.20.31 - Accepted - runtime 307ms - memory 14MB.py b/695-max-area-of-island/2022-07-16 01.20.31 - Accepted - runtime 307ms - memory 14MB.py deleted file mode 100644 index d3e7db2..0000000 --- a/695-max-area-of-island/2022-07-16 01.20.31 - Accepted - runtime 307ms - memory 14MB.py +++ /dev/null @@ -1,25 +0,0 @@ -class Solution: - def maxAreaOfIsland(self, grid: List[List[int]]) -> int: - w, h = len(grid[0]), len(grid) - visited = [[0] * w for f in range(h)] - res = 0 - for y,i in enumerate(grid): - for x,j in enumerate(i): - if not visited[y][x]: - visit = [(x,y)] - size = 0 - while visit: - X,Y = visit.pop(0) - if visited[Y][X] or not grid[Y][X]:continue - visited[Y][X] = 1 - size += grid[Y][X] - for a,b in ((1,0),(-1,0),(0,1),(0,-1)): - XX = max(min(X + a, w - 1), 0) - YY = max(min(Y + b, h - 1), 0) - if not visited[YY][XX] and grid[YY][XX]: - visit.append((XX,YY)) - res = max(size, res) - - - - return res \ No newline at end of file diff --git a/695-max-area-of-island/2022-07-16 01.23.13 - Accepted - runtime 301ms - memory 14.1MB.py b/695-max-area-of-island/2022-07-16 01.23.13 - Accepted - runtime 301ms - memory 14.1MB.py deleted file mode 100644 index 04903ac..0000000 --- a/695-max-area-of-island/2022-07-16 01.23.13 - Accepted - runtime 301ms - memory 14.1MB.py +++ /dev/null @@ -1,23 +0,0 @@ -class Solution: - def maxAreaOfIsland(self, grid: List[List[int]]) -> int: - w, h = len(grid[0]), len(grid) - res = 0 - for y,i in enumerate(grid): - for x,j in enumerate(i): - if grid[y][x] != -1: - visit = [(x,y)] - size = 0 - while visit: - X,Y = visit.pop(0) - if grid[Y][X] != 1:continue - grid[Y][X] = -1 - size += 1 - for a,b in ((1,0),(-1,0),(0,1),(0,-1)): - XX = max(min(X + a, w - 1), 0) - YY = max(min(Y + b, h - 1), 0) - if grid[YY][XX] == 1:visit.append((XX,YY)) - res = max(size, res) - - - - return res \ No newline at end of file diff --git a/695-max-area-of-island/2022-07-16 01.23.36 - Accepted - runtime 382ms - memory 14MB.py b/695-max-area-of-island/2022-07-16 01.23.36 - Accepted - runtime 382ms - memory 14MB.py deleted file mode 100644 index 04903ac..0000000 --- a/695-max-area-of-island/2022-07-16 01.23.36 - Accepted - runtime 382ms - memory 14MB.py +++ /dev/null @@ -1,23 +0,0 @@ -class Solution: - def maxAreaOfIsland(self, grid: List[List[int]]) -> int: - w, h = len(grid[0]), len(grid) - res = 0 - for y,i in enumerate(grid): - for x,j in enumerate(i): - if grid[y][x] != -1: - visit = [(x,y)] - size = 0 - while visit: - X,Y = visit.pop(0) - if grid[Y][X] != 1:continue - grid[Y][X] = -1 - size += 1 - for a,b in ((1,0),(-1,0),(0,1),(0,-1)): - XX = max(min(X + a, w - 1), 0) - YY = max(min(Y + b, h - 1), 0) - if grid[YY][XX] == 1:visit.append((XX,YY)) - res = max(size, res) - - - - return res \ No newline at end of file diff --git a/695-max-area-of-island/2022-07-16 01.23.48 - Accepted - runtime 249ms - memory 14.1MB.py b/695-max-area-of-island/2022-07-16 01.23.48 - Accepted - runtime 249ms - memory 14.1MB.py deleted file mode 100644 index 04903ac..0000000 --- a/695-max-area-of-island/2022-07-16 01.23.48 - Accepted - runtime 249ms - memory 14.1MB.py +++ /dev/null @@ -1,23 +0,0 @@ -class Solution: - def maxAreaOfIsland(self, grid: List[List[int]]) -> int: - w, h = len(grid[0]), len(grid) - res = 0 - for y,i in enumerate(grid): - for x,j in enumerate(i): - if grid[y][x] != -1: - visit = [(x,y)] - size = 0 - while visit: - X,Y = visit.pop(0) - if grid[Y][X] != 1:continue - grid[Y][X] = -1 - size += 1 - for a,b in ((1,0),(-1,0),(0,1),(0,-1)): - XX = max(min(X + a, w - 1), 0) - YY = max(min(Y + b, h - 1), 0) - if grid[YY][XX] == 1:visit.append((XX,YY)) - res = max(size, res) - - - - return res \ No newline at end of file diff --git a/696-count-binary-substrings/2024-04-08 17.06.30 - Accepted - runtime 99ms - memory 18.3MB.py b/696-count-binary-substrings/2024-04-08 17.06.30 - Accepted - runtime 99ms - memory 18.3MB.py deleted file mode 100644 index 054757c..0000000 --- a/696-count-binary-substrings/2024-04-08 17.06.30 - Accepted - runtime 99ms - memory 18.3MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def countBinarySubstrings(self, s: str) -> int: - s = list(map(len, s.replace('10', '1 0').replace('01', '1 0').split())) - return sum(min(a, b) for a, b in zip(s, s[1:])) \ No newline at end of file diff --git a/7-reverse-integer/2022-06-29 10.37.22 - Accepted - runtime 56ms - memory 14MB.py b/7-reverse-integer/2022-06-29 10.37.22 - Accepted - runtime 56ms - memory 14MB.py deleted file mode 100644 index ecd0655..0000000 --- a/7-reverse-integer/2022-06-29 10.37.22 - Accepted - runtime 56ms - memory 14MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def reverse(self, x: int) -> int: - if x < 0: - num = int(str(x)[1:][::-1]) - if num > 2147483648: - return 0 - return -num - else: - num = int(str(x)[::-1]) - if num > 2147483648: - return 0 - return num \ No newline at end of file diff --git a/7-reverse-integer/2023-01-06 21.21.32 - Accepted - runtime 48ms - memory 13.9MB.py b/7-reverse-integer/2023-01-06 21.21.32 - Accepted - runtime 48ms - memory 13.9MB.py deleted file mode 100644 index 331576b..0000000 --- a/7-reverse-integer/2023-01-06 21.21.32 - Accepted - runtime 48ms - memory 13.9MB.py +++ /dev/null @@ -1,9 +0,0 @@ -_min = -(2 ** 31) -_max = abs(_min) - 1 -class Solution: - def reverse(self, x: int) -> int: - neg = x < 0 - x = int(str(abs(x))[::-1]) - if neg: - x = -x - return x if _min <= x <= _max else 0 \ No newline at end of file diff --git a/70-climbing-stairs/2022-06-23 16.51.25 - Accepted - runtime 38ms - memory 13.8MB.py b/70-climbing-stairs/2022-06-23 16.51.25 - Accepted - runtime 38ms - memory 13.8MB.py deleted file mode 100644 index ad47fa8..0000000 --- a/70-climbing-stairs/2022-06-23 16.51.25 - Accepted - runtime 38ms - memory 13.8MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - stairs = [0] * 45 - def climbStairs(self, n: int) -> int: - arr = [0] * (n+1) - for i in range(n+1): - if i < 3: - arr[i] = i - else: - arr[i] = arr[i-1] + arr[i-2] - - return arr[-1] \ No newline at end of file diff --git a/70-climbing-stairs/2022-06-23 16.53.01 - Accepted - runtime 71ms - memory 14MB.py b/70-climbing-stairs/2022-06-23 16.53.01 - Accepted - runtime 71ms - memory 14MB.py deleted file mode 100644 index 7261a8f..0000000 --- a/70-climbing-stairs/2022-06-23 16.53.01 - Accepted - runtime 71ms - memory 14MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - d = {1: 1, 2: 2, 3: 3, 4: 5, 5: 8, 6: 13, 7: 21, 8: 34, 9: 55, 10: 89, 11: 144, 12: 233, 13: 377, 14: 610, 15: 987, 16: 1597, 17: 2584, 18: 4181, 19: 6765, 20: 10946, 21: 17711, 22: 28657, 23: 46368, 24: 75025, 25: 121393, 26: 196418, 27: 317811, 28: 514229, 29: 832040, 30: 1346269, 31: 2178309, 32: 3524578, 33: 5702887, 34: 9227465, 35: 14930352, 36: 24157817, 37: 39088169, 38: 63245986, 39: 102334155, 40: 165580141, 41: 267914296, 42: 433494437, 43: 701408733, 44: 1134903170, 45: 1836311903} - def climbStairs(self, n: int) -> int: - return self.d[n] \ No newline at end of file diff --git a/70-climbing-stairs/2022-06-23 16.53.10 - Accepted - runtime 52ms - memory 13.9MB.py b/70-climbing-stairs/2022-06-23 16.53.10 - Accepted - runtime 52ms - memory 13.9MB.py deleted file mode 100644 index 7261a8f..0000000 --- a/70-climbing-stairs/2022-06-23 16.53.10 - Accepted - runtime 52ms - memory 13.9MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - d = {1: 1, 2: 2, 3: 3, 4: 5, 5: 8, 6: 13, 7: 21, 8: 34, 9: 55, 10: 89, 11: 144, 12: 233, 13: 377, 14: 610, 15: 987, 16: 1597, 17: 2584, 18: 4181, 19: 6765, 20: 10946, 21: 17711, 22: 28657, 23: 46368, 24: 75025, 25: 121393, 26: 196418, 27: 317811, 28: 514229, 29: 832040, 30: 1346269, 31: 2178309, 32: 3524578, 33: 5702887, 34: 9227465, 35: 14930352, 36: 24157817, 37: 39088169, 38: 63245986, 39: 102334155, 40: 165580141, 41: 267914296, 42: 433494437, 43: 701408733, 44: 1134903170, 45: 1836311903} - def climbStairs(self, n: int) -> int: - return self.d[n] \ No newline at end of file diff --git a/70-climbing-stairs/2022-06-23 16.53.19 - Accepted - runtime 62ms - memory 13.9MB.py b/70-climbing-stairs/2022-06-23 16.53.19 - Accepted - runtime 62ms - memory 13.9MB.py deleted file mode 100644 index 7261a8f..0000000 --- a/70-climbing-stairs/2022-06-23 16.53.19 - Accepted - runtime 62ms - memory 13.9MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - d = {1: 1, 2: 2, 3: 3, 4: 5, 5: 8, 6: 13, 7: 21, 8: 34, 9: 55, 10: 89, 11: 144, 12: 233, 13: 377, 14: 610, 15: 987, 16: 1597, 17: 2584, 18: 4181, 19: 6765, 20: 10946, 21: 17711, 22: 28657, 23: 46368, 24: 75025, 25: 121393, 26: 196418, 27: 317811, 28: 514229, 29: 832040, 30: 1346269, 31: 2178309, 32: 3524578, 33: 5702887, 34: 9227465, 35: 14930352, 36: 24157817, 37: 39088169, 38: 63245986, 39: 102334155, 40: 165580141, 41: 267914296, 42: 433494437, 43: 701408733, 44: 1134903170, 45: 1836311903} - def climbStairs(self, n: int) -> int: - return self.d[n] \ No newline at end of file diff --git a/71-simplify-path/2023-04-12 13.30.05 - Accepted - runtime 32ms - memory 13.7MB.py b/71-simplify-path/2023-04-12 13.30.05 - Accepted - runtime 32ms - memory 13.7MB.py deleted file mode 100644 index fca2fbe..0000000 --- a/71-simplify-path/2023-04-12 13.30.05 - Accepted - runtime 32ms - memory 13.7MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def simplifyPath(self, path: str) -> str: - curr = [] - for i in path.split('/'): - if i: - if i == '..': - if curr: - curr.pop() - elif i == '.': - pass - else: - curr.append(i) - - return '/' + '/'.join(curr) \ No newline at end of file diff --git a/71-simplify-path/2023-04-13 23.23.56 - Accepted - runtime 29ms - memory 13.8MB.py b/71-simplify-path/2023-04-13 23.23.56 - Accepted - runtime 29ms - memory 13.8MB.py deleted file mode 100644 index c6a6386..0000000 --- a/71-simplify-path/2023-04-13 23.23.56 - Accepted - runtime 29ms - memory 13.8MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def simplifyPath(self, path: str) -> str: - curr = [] - for i in path.split('/'): - if i: - if i == '.':pass - elif i == '..': - if curr:curr.pop() - else:curr.append(i) - - return '/' + '/'.join(curr) \ No newline at end of file diff --git a/713-subarray-product-less-than-k/2024-03-27 19.58.59 - Accepted - runtime 508ms - memory 19.2MB.py b/713-subarray-product-less-than-k/2024-03-27 19.58.59 - Accepted - runtime 508ms - memory 19.2MB.py deleted file mode 100644 index b1398d9..0000000 --- a/713-subarray-product-less-than-k/2024-03-27 19.58.59 - Accepted - runtime 508ms - memory 19.2MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int: - left, prod, res = 0, 1, 0 - for right in range(len(nums)): - prod *= nums[right] - - while prod >= k and left <= right: - prod /= nums[left] - left += 1 - - res += right - left + 1 - - - return res \ No newline at end of file diff --git a/713-subarray-product-less-than-k/2024-03-28 11.16.26 - Accepted - runtime 530ms - memory 19.4MB.py b/713-subarray-product-less-than-k/2024-03-28 11.16.26 - Accepted - runtime 530ms - memory 19.4MB.py deleted file mode 100644 index 8cb366a..0000000 --- a/713-subarray-product-less-than-k/2024-03-28 11.16.26 - Accepted - runtime 530ms - memory 19.4MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int: - left, prod, res = 0, 1, 0 - for right in range(len(nums)): - prod *= nums[right] - while prod >= k and left <= right: - prod /= nums[left] - left += 1 - - res += right - left + 1 - - return res \ No newline at end of file diff --git a/728-self-dividing-numbers/2022-09-26 14.17.53 - Accepted - runtime 121ms - memory 13.9MB.py b/728-self-dividing-numbers/2022-09-26 14.17.53 - Accepted - runtime 121ms - memory 13.9MB.py deleted file mode 100644 index 30e5269..0000000 --- a/728-self-dividing-numbers/2022-09-26 14.17.53 - Accepted - runtime 121ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def selfDividingNumbers(self, left: int, right: int) -> List[int]: - return [f for f in range(left, right + 1)if '0'not in str(f) and all(f%int(i) == 0 for i in str(f))] \ No newline at end of file diff --git a/73-set-matrix-zeroes/2024-03-10 18.21.20 - Accepted - runtime 116ms - memory 17.5MB.py b/73-set-matrix-zeroes/2024-03-10 18.21.20 - Accepted - runtime 116ms - memory 17.5MB.py deleted file mode 100644 index 39a710d..0000000 --- a/73-set-matrix-zeroes/2024-03-10 18.21.20 - Accepted - runtime 116ms - memory 17.5MB.py +++ /dev/null @@ -1,14 +0,0 @@ -from copy import deepcopy -class Solution: - def setZeroes(self, matrix: List[List[int]]) -> None: - """ - Do not return anything, modify matrix in-place instead. - """ - h, w = len(matrix), len(matrix[0]) - mmatrix = deepcopy(matrix) - for y in range(h): - for x in range(w): - if mmatrix[y][x] == 0: - for i in range(h):matrix[i][x] = 0 - for i in range(w):matrix[y][i] = 0 - diff --git a/739-daily-temperatures/2024-01-31 21.29.56 - Accepted - runtime 898ms - memory 32.4MB.py b/739-daily-temperatures/2024-01-31 21.29.56 - Accepted - runtime 898ms - memory 32.4MB.py deleted file mode 100644 index 849ed8c..0000000 --- a/739-daily-temperatures/2024-01-31 21.29.56 - Accepted - runtime 898ms - memory 32.4MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def dailyTemperatures(self, te: List[int]) -> List[int]: - r = [0] * len(te) - stack = [] - for i, t in enumerate(te): - while stack and stack[-1][1] < t: - ind, temp = stack.pop() - r[ind] = i - ind - stack.append((i, t)) - - return r \ No newline at end of file diff --git a/742-to-lower-case/2022-09-20 14.25.24 - Accepted - runtime 61ms - memory 13.8MB.py b/742-to-lower-case/2022-09-20 14.25.24 - Accepted - runtime 61ms - memory 13.8MB.py deleted file mode 100644 index 726932d..0000000 --- a/742-to-lower-case/2022-09-20 14.25.24 - Accepted - runtime 61ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def toLowerCase(self, s: str) -> str: - return s.lower() \ No newline at end of file diff --git a/747-min-cost-climbing-stairs/2022-07-10 15.01.01 - Accepted - runtime 108ms - memory 14MB.py b/747-min-cost-climbing-stairs/2022-07-10 15.01.01 - Accepted - runtime 108ms - memory 14MB.py deleted file mode 100644 index 44fc012..0000000 --- a/747-min-cost-climbing-stairs/2022-07-10 15.01.01 - Accepted - runtime 108ms - memory 14MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def minCostClimbingStairs(self, cost: List[int]) -> int: - a, b = cost[0], cost[1] - c = 0 - for i in range(2, len(cost)): - c = cost[i] + min(a, b) - a, b = b, c - return min(a,b) \ No newline at end of file diff --git a/753-open-the-lock/2024-04-22 09.48.00 - Accepted - runtime 389ms - memory 18.1MB.py b/753-open-the-lock/2024-04-22 09.48.00 - Accepted - runtime 389ms - memory 18.1MB.py deleted file mode 100644 index 6e8e628..0000000 --- a/753-open-the-lock/2024-04-22 09.48.00 - Accepted - runtime 389ms - memory 18.1MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class Solution: - def openLock(self, deadends: List[str], target: str) -> int: - dead = set(deadends) - q = deque([('0000', 0)]) - vis = set('0000') - while q: - st, cnt = q.popleft() - if st == target: return cnt - if st in dead: continue - for i in range(4): - n = int(st[i]) - for move in (-1, 1): - new_st = f'{st[: i]}{(n + move) % 10}{st[i + 1:]}' - if new_st not in vis: - vis.add(new_st) - q.append((new_st, cnt + 1)) - - return -1 \ No newline at end of file diff --git a/775-n-ary-tree-preorder-traversal/2022-07-07 11.52.59 - Accepted - runtime 70ms - memory 16.4MB.py b/775-n-ary-tree-preorder-traversal/2022-07-07 11.52.59 - Accepted - runtime 70ms - memory 16.4MB.py deleted file mode 100644 index 691e862..0000000 --- a/775-n-ary-tree-preorder-traversal/2022-07-07 11.52.59 - Accepted - runtime 70ms - memory 16.4MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def dfs(self, root, l): - if not root:return - if root:l.append(root.val) - for child in root.children: - self.dfs(child,l) - - - def preorder(self, root: 'Node') -> List[int]: - res = [] - self.dfs(root, res) - - return res \ No newline at end of file diff --git a/775-n-ary-tree-preorder-traversal/2022-07-07 11.54.29 - Accepted - runtime 80ms - memory 16.1MB.py b/775-n-ary-tree-preorder-traversal/2022-07-07 11.54.29 - Accepted - runtime 80ms - memory 16.1MB.py deleted file mode 100644 index 6866478..0000000 --- a/775-n-ary-tree-preorder-traversal/2022-07-07 11.54.29 - Accepted - runtime 80ms - memory 16.1MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def preorder(self, root: 'Node') -> List[int]: - res = [] - stack = [root] - while stack: - node = stack.pop() - if node: - res.append(node.val) - stack.extend(node.children[::-1]) - - return res \ No newline at end of file diff --git a/775-n-ary-tree-preorder-traversal/2022-07-07 11.57.42 - Accepted - runtime 60ms - memory 16MB.py b/775-n-ary-tree-preorder-traversal/2022-07-07 11.57.42 - Accepted - runtime 60ms - memory 16MB.py deleted file mode 100644 index 6fcbafe..0000000 --- a/775-n-ary-tree-preorder-traversal/2022-07-07 11.57.42 - Accepted - runtime 60ms - memory 16MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def preorder(self, root: 'Node') -> List[int]: - res = [] - stack = [root] - while stack: - node = stack.pop() - if node: - res.append(node.val) - stack.extend(reversed(node.children)) - - return res \ No newline at end of file diff --git a/775-n-ary-tree-preorder-traversal/2022-07-07 11.57.57 - Accepted - runtime 99ms - memory 16MB.py b/775-n-ary-tree-preorder-traversal/2022-07-07 11.57.57 - Accepted - runtime 99ms - memory 16MB.py deleted file mode 100644 index 6fcbafe..0000000 --- a/775-n-ary-tree-preorder-traversal/2022-07-07 11.57.57 - Accepted - runtime 99ms - memory 16MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def preorder(self, root: 'Node') -> List[int]: - res = [] - stack = [root] - while stack: - node = stack.pop() - if node: - res.append(node.val) - stack.extend(reversed(node.children)) - - return res \ No newline at end of file diff --git a/775-n-ary-tree-preorder-traversal/2022-07-07 11.58.14 - Accepted - runtime 68ms - memory 16MB.py b/775-n-ary-tree-preorder-traversal/2022-07-07 11.58.14 - Accepted - runtime 68ms - memory 16MB.py deleted file mode 100644 index 6fcbafe..0000000 --- a/775-n-ary-tree-preorder-traversal/2022-07-07 11.58.14 - Accepted - runtime 68ms - memory 16MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def preorder(self, root: 'Node') -> List[int]: - res = [] - stack = [root] - while stack: - node = stack.pop() - if node: - res.append(node.val) - stack.extend(reversed(node.children)) - - return res \ No newline at end of file diff --git a/775-n-ary-tree-preorder-traversal/2024-01-07 18.49.27 - Accepted - runtime 55ms - memory 19.3MB.py b/775-n-ary-tree-preorder-traversal/2024-01-07 18.49.27 - Accepted - runtime 55ms - memory 19.3MB.py deleted file mode 100644 index e471cd3..0000000 --- a/775-n-ary-tree-preorder-traversal/2024-01-07 18.49.27 - Accepted - runtime 55ms - memory 19.3MB.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -# Definition for a Node. -class Node: - def __init__(self, val=None, children=None): - self.val = val - self.children = children -""" - -class Solution: - def traverse(self, node): - yield node.val - if node.children: - for n in node.children: - yield from self.traverse(n) - - def preorder(self, root: 'Node') -> List[int]: - return list(self.traverse(root)) if root else [] \ No newline at end of file diff --git a/776-n-ary-tree-postorder-traversal/2022-07-07 11.14.19 - Accepted - runtime 130ms - memory 16.1MB.py b/776-n-ary-tree-postorder-traversal/2022-07-07 11.14.19 - Accepted - runtime 130ms - memory 16.1MB.py deleted file mode 100644 index e08c04a..0000000 --- a/776-n-ary-tree-postorder-traversal/2022-07-07 11.14.19 - Accepted - runtime 130ms - memory 16.1MB.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -# Definition for a Node. -class Node: - def __init__(self, val=None, children=None): - self.val = val - self.children = children -""" - -class Solution: - def postorder(self, root: 'Node') -> List[int]: - res = [] - stack = [root] - while stack: - node = stack.pop() - if node: - res.append(node.val) - stack.extend(node.children) - - return res[::-1] - \ No newline at end of file diff --git a/782-jewels-and-stones/2022-08-01 16.26.49 - Accepted - runtime 55ms - memory 13.8MB.py b/782-jewels-and-stones/2022-08-01 16.26.49 - Accepted - runtime 55ms - memory 13.8MB.py deleted file mode 100644 index 6456571..0000000 --- a/782-jewels-and-stones/2022-08-01 16.26.49 - Accepted - runtime 55ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def numJewelsInStones(self, jewels: str, stones: str) -> int: - return sum(f in jewels for f in stones) \ No newline at end of file diff --git a/783-search-in-a-binary-search-tree/2022-09-26 14.36.07 - Accepted - runtime 170ms - memory 16.5MB.py b/783-search-in-a-binary-search-tree/2022-09-26 14.36.07 - Accepted - runtime 170ms - memory 16.5MB.py deleted file mode 100644 index 4840bf8..0000000 --- a/783-search-in-a-binary-search-tree/2022-09-26 14.36.07 - Accepted - runtime 170ms - memory 16.5MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def searchBST(self, root: Optional[TreeNode], val: int) -> Optional[TreeNode]: - while root: - if root.val == val: - return root - root = root.left if root.val > val else root.right - - return \ No newline at end of file diff --git a/789-kth-largest-element-in-a-stream/2023-05-23 14.50.31 - Accepted - runtime 109ms - memory 20.4MB.py b/789-kth-largest-element-in-a-stream/2023-05-23 14.50.31 - Accepted - runtime 109ms - memory 20.4MB.py deleted file mode 100644 index 7b533e7..0000000 --- a/789-kth-largest-element-in-a-stream/2023-05-23 14.50.31 - Accepted - runtime 109ms - memory 20.4MB.py +++ /dev/null @@ -1,19 +0,0 @@ -class KthLargest: - - def __init__(self, k: int, nums: List[int]): - self.k = k - self.h = nums - heapq.heapify(self.h) - while len(self.h) > k: - heapq.heappop(self.h) - - def add(self, val: int) -> int: - heapq.heappush(self.h, val) - if len(self.h) > self.k: - heapq.heappop(self.h) - return self.h[0] - - -# Your KthLargest object will be instantiated and called as such: -# obj = KthLargest(k, nums) -# param_1 = obj.add(val) \ No newline at end of file diff --git a/79-word-search/2024-04-03 12.06.52 - Accepted - runtime 39ms - memory 16.7MB.py b/79-word-search/2024-04-03 12.06.52 - Accepted - runtime 39ms - memory 16.7MB.py deleted file mode 100644 index a340ea4..0000000 --- a/79-word-search/2024-04-03 12.06.52 - Accepted - runtime 39ms - memory 16.7MB.py +++ /dev/null @@ -1,43 +0,0 @@ -class Solution: - def exist(self, board: List[List[str]], word: str) -> bool: - - R = len(board) - C = len(board[0]) - - if len(word) > R*C: - return False - - count = Counter(sum(board, [])) - - for c, countWord in Counter(word).items(): - if count[c] < countWord: - return False - - if count[word[0]] > count[word[-1]]: - word = word[::-1] - - seen = set() - - def dfs(r, c, i): - if i == len(word): - return True - if r < 0 or c < 0 or r >= R or c >= C or word[i] != board[r][c] or (r,c) in seen: - return False - - seen.add((r,c)) - res = ( - dfs(r+1,c,i+1) or - dfs(r-1,c,i+1) or - dfs(r,c+1,i+1) or - dfs(r,c-1,i+1) - ) - seen.remove((r,c)) - - return res - - for i in range(R): - for j in range(C): - if dfs(i,j,0): - return True - return False - \ No newline at end of file diff --git a/792-binary-search/2022-07-21 16.44.05 - Accepted - runtime 416ms - memory 15.6MB.py b/792-binary-search/2022-07-21 16.44.05 - Accepted - runtime 416ms - memory 15.6MB.py deleted file mode 100644 index 38095e3..0000000 --- a/792-binary-search/2022-07-21 16.44.05 - Accepted - runtime 416ms - memory 15.6MB.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def search(self, nums: List[int], target: int) -> int: - low = 0 - high = len(nums) - 1 - while low <= high: - mid = low + (high - low) // 2 - if nums[mid] == target:return mid - elif nums[mid] > target: - high = mid - 1 - else: - low = mid + 1 - - return -1 \ No newline at end of file diff --git a/792-binary-search/2023-04-01 23.42.27 - Accepted - runtime 238ms - memory 15.5MB.py b/792-binary-search/2023-04-01 23.42.27 - Accepted - runtime 238ms - memory 15.5MB.py deleted file mode 100644 index ee56095..0000000 --- a/792-binary-search/2023-04-01 23.42.27 - Accepted - runtime 238ms - memory 15.5MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def search(self, nums: List[int], target: int) -> int: - lo, hi = 0, len(nums) - - while lo < hi: - mid = (lo + hi) // 2 - if nums[mid] == target: return mid - elif nums[mid] > target: hi = mid - else: lo = mid + 1 - - return -1 \ No newline at end of file diff --git a/792-binary-search/2024-03-12 15.08.10 - Accepted - runtime 187ms - memory 18.1MB.py b/792-binary-search/2024-03-12 15.08.10 - Accepted - runtime 187ms - memory 18.1MB.py deleted file mode 100644 index 52958ee..0000000 --- a/792-binary-search/2024-03-12 15.08.10 - Accepted - runtime 187ms - memory 18.1MB.py +++ /dev/null @@ -1,16 +0,0 @@ -class Solution: - def search(self, nums: List[int], target: int) -> int: - low = 0 - high = len(nums) - 1 - while low <= high: - mid = (low + high) // 2 - if nums[mid] == target: - return mid - - elif nums[mid] < target: - low = mid + 1 - - else: - high = mid - 1 - - return -1 \ No newline at end of file diff --git a/8-string-to-integer-atoi/2024-03-31 18.54.54 - Accepted - runtime 40ms - memory 16.5MB.py b/8-string-to-integer-atoi/2024-03-31 18.54.54 - Accepted - runtime 40ms - memory 16.5MB.py deleted file mode 100644 index 60137a1..0000000 --- a/8-string-to-integer-atoi/2024-03-31 18.54.54 - Accepted - runtime 40ms - memory 16.5MB.py +++ /dev/null @@ -1,6 +0,0 @@ -from re import search -class Solution: - def myAtoi(self, s: str) -> int: - m = search(r'^([\-\+]?\d+)', s.strip()) - n = int(m.group(1)) if m else 0 - return min(max(n, -2147483648), 2147483647) diff --git a/802-k-th-smallest-prime-fraction/2024-05-10 09.34.39 - Accepted - runtime 2437ms - memory 121.5MB.py b/802-k-th-smallest-prime-fraction/2024-05-10 09.34.39 - Accepted - runtime 2437ms - memory 121.5MB.py deleted file mode 100644 index 1ce2e8e..0000000 --- a/802-k-th-smallest-prime-fraction/2024-05-10 09.34.39 - Accepted - runtime 2437ms - memory 121.5MB.py +++ /dev/null @@ -1,12 +0,0 @@ -class Solution: - def kthSmallestPrimeFraction(self, arr: List[int], k: int) -> List[int]: - t = len(arr) - l = [] - for i in range(t): - for j in range(t - 1, 0, -1): - heapq.heappush(l, (arr[i]/arr[j], arr[i], arr[j])) - - for i in range(k): - _, a, b = heapq.heappop(l) - - return a, b \ No newline at end of file diff --git a/803-cheapest-flights-within-k-stops/2024-02-23 15.09.35 - Accepted - runtime 83ms - memory 18.2MB.py b/803-cheapest-flights-within-k-stops/2024-02-23 15.09.35 - Accepted - runtime 83ms - memory 18.2MB.py deleted file mode 100644 index 30dfe30..0000000 --- a/803-cheapest-flights-within-k-stops/2024-02-23 15.09.35 - Accepted - runtime 83ms - memory 18.2MB.py +++ /dev/null @@ -1,29 +0,0 @@ -from queue import Queue -class Solution: - def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, k: int) -> int: - routes = defaultdict(list) - for _from, _to, price in flights: - routes[_from].append((_to, price)) - - dist = [float('inf')] * n - dist[src] = 0 - - q = Queue() - q.put((src, 0)) - stops = 0 - - while not q.empty() and stops <= k: - sz = q.qsize() - for _ in range(sz): - node, distance = q.get() - - if node not in routes: continue - - for neighbour, price in routes[node]: - if price + distance >= dist[neighbour]: continue - dist[neighbour] = price + distance - q.put((neighbour, dist[neighbour])) - - stops += 1 - - return dist[dst] if dist[dst] != float('inf') else -1 \ No newline at end of file diff --git a/807-custom-sort-string/2024-03-11 12.29.55 - Accepted - runtime 46ms - memory 16.4MB.py b/807-custom-sort-string/2024-03-11 12.29.55 - Accepted - runtime 46ms - memory 16.4MB.py deleted file mode 100644 index ddf49f4..0000000 --- a/807-custom-sort-string/2024-03-11 12.29.55 - Accepted - runtime 46ms - memory 16.4MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def customSortString(self, order: str, s: str) -> str: - return ''.join(sorted(s, key=lambda x:order.find(x))) - \ No newline at end of file diff --git a/807-custom-sort-string/2024-03-11 12.30.10 - Accepted - runtime 30ms - memory 16.5MB.py b/807-custom-sort-string/2024-03-11 12.30.10 - Accepted - runtime 30ms - memory 16.5MB.py deleted file mode 100644 index ddf49f4..0000000 --- a/807-custom-sort-string/2024-03-11 12.30.10 - Accepted - runtime 30ms - memory 16.5MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def customSortString(self, order: str, s: str) -> str: - return ''.join(sorted(s, key=lambda x:order.find(x))) - \ No newline at end of file diff --git a/812-rotate-string/2024-04-05 19.29.38 - Accepted - runtime 44ms - memory 16.5MB.py b/812-rotate-string/2024-04-05 19.29.38 - Accepted - runtime 44ms - memory 16.5MB.py deleted file mode 100644 index 17acad4..0000000 --- a/812-rotate-string/2024-04-05 19.29.38 - Accepted - runtime 44ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def rotateString(self, s: str, goal: str) -> bool: - return any(s[f:] + s[:f] == goal for f in range(len(s))) \ No newline at end of file diff --git a/812-rotate-string/2024-04-05 19.29.53 - Accepted - runtime 45ms - memory 16.4MB.py b/812-rotate-string/2024-04-05 19.29.53 - Accepted - runtime 45ms - memory 16.4MB.py deleted file mode 100644 index 17acad4..0000000 --- a/812-rotate-string/2024-04-05 19.29.53 - Accepted - runtime 45ms - memory 16.4MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def rotateString(self, s: str, goal: str) -> bool: - return any(s[f:] + s[:f] == goal for f in range(len(s))) \ No newline at end of file diff --git a/816-design-hashset/2024-02-24 22.10.17 - Accepted - runtime 102ms - memory 21.7MB.py b/816-design-hashset/2024-02-24 22.10.17 - Accepted - runtime 102ms - memory 21.7MB.py deleted file mode 100644 index d129edd..0000000 --- a/816-design-hashset/2024-02-24 22.10.17 - Accepted - runtime 102ms - memory 21.7MB.py +++ /dev/null @@ -1,21 +0,0 @@ -class MyHashSet: - - def __init__(self): - self.set = set() - - def add(self, key: int) -> None: - self.set.add(key) - - def remove(self, key: int) -> None: - if key in self.set: - self.set.remove(key) - - def contains(self, key: int) -> bool: - return key in self.set - - -# Your MyHashSet object will be instantiated and called as such: -# obj = MyHashSet() -# obj.add(key) -# obj.remove(key) -# param_3 = obj.contains(key) \ No newline at end of file diff --git a/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.31.33 - Accepted - runtime 41ms - memory 16.5MB.py b/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.31.33 - Accepted - runtime 41ms - memory 16.5MB.py deleted file mode 100644 index 0710e1f..0000000 --- a/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.31.33 - Accepted - runtime 41ms - memory 16.5MB.py +++ /dev/null @@ -1,29 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]: - prev_head = prev = None - new_head = head - while head: - if not new_head: - new_head = head - if prev and prev.val == head.val: - if head.val == new_head.val: - new_head = None - elif not head.next or (head.next and head.val != head.next.val): - if prev_head: - prev_head.next = head - prev_head = head - - else: - if prev_head: - prev_head.next = None - - prev = head - head = head.next - - return new_head - \ No newline at end of file diff --git a/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.40.55 - Accepted - runtime 45ms - memory 16.5MB.py b/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.40.55 - Accepted - runtime 45ms - memory 16.5MB.py deleted file mode 100644 index 5050e2b..0000000 --- a/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.40.55 - Accepted - runtime 45ms - memory 16.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def deleteDuplicates(self, head: Optional[ListNode], prev:int = -101) -> Optional[ListNode]: - if head is None: - return head - - if head.val == prev: - return self.deleteDuplicates(head.next, prev) - - if head.next and head.next.val == head.val: - return self.deleteDuplicates(head.next, head.val) - - head.next = self.deleteDuplicates(head.next, head.val) - return head - \ No newline at end of file diff --git a/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.43.39 - Accepted - runtime 5ms - memory 14.1MB.cpp b/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.43.39 - Accepted - runtime 5ms - memory 14.1MB.cpp deleted file mode 100644 index bd41db9..0000000 --- a/82-remove-duplicates-from-sorted-list-ii/2024-02-24 23.43.39 - Accepted - runtime 5ms - memory 14.1MB.cpp +++ /dev/null @@ -1,11 +0,0 @@ -class Solution { -public: - ListNode* deleteDuplicates(ListNode* head, int prev = -101) { - if (head == NULL) return head; - if (head->val == prev) return deleteDuplicates(head->next, prev); - if (head->next && head->next->val == head->val) - return deleteDuplicates(head->next, head->val); - head -> next = deleteDuplicates(head->next, head->val); - return head; - } -}; \ No newline at end of file diff --git a/822-unique-morse-code-words/2022-09-20 14.28.25 - Accepted - runtime 76ms - memory 14MB.py b/822-unique-morse-code-words/2022-09-20 14.28.25 - Accepted - runtime 76ms - memory 14MB.py deleted file mode 100644 index bf8f43f..0000000 --- a/822-unique-morse-code-words/2022-09-20 14.28.25 - Accepted - runtime 76ms - memory 14MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def uniqueMorseRepresentations(self, words: list[str]) -> int: - morse = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] - return len(set(''.join(morse[ord(f) - 97]for f in word)for word in words)) \ No newline at end of file diff --git a/83-remove-duplicates-from-sorted-list/2022-06-20 19.42.44 - Accepted - runtime 70ms - memory 13.8MB.py b/83-remove-duplicates-from-sorted-list/2022-06-20 19.42.44 - Accepted - runtime 70ms - memory 13.8MB.py deleted file mode 100644 index eeb2ea4..0000000 --- a/83-remove-duplicates-from-sorted-list/2022-06-20 19.42.44 - Accepted - runtime 70ms - memory 13.8MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]: - hhead = head - while head and head.next: - if head.val == head.next.val: - head.next = head.next.next - else: - head = head.next - return hhead \ No newline at end of file diff --git a/832-binary-tree-pruning/2024-01-08 15.38.29 - Accepted - runtime 43ms - memory 17.4MB.py b/832-binary-tree-pruning/2024-01-08 15.38.29 - Accepted - runtime 43ms - memory 17.4MB.py deleted file mode 100644 index 9d7850e..0000000 --- a/832-binary-tree-pruning/2024-01-08 15.38.29 - Accepted - runtime 43ms - memory 17.4MB.py +++ /dev/null @@ -1,35 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, node) -> bool: - if not node: - return False - if not node.val and not node.left and not node.right: - return False - if node.val: - return True - return self.traverse(node.left) or self.traverse(node.right) - - def pruneTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - r = root - if not self.traverse(r): - return None - stack = [r] - while stack: - n = stack.pop() - if n.left: - if self.traverse(n.left): - stack.append(n.left) - else: - n.left = None - if n.right: - if self.traverse(n.right): - stack.append(n.right) - else: - n.right = None - - return r \ No newline at end of file diff --git a/832-binary-tree-pruning/2024-01-08 15.38.39 - Accepted - runtime 38ms - memory 17.4MB.py b/832-binary-tree-pruning/2024-01-08 15.38.39 - Accepted - runtime 38ms - memory 17.4MB.py deleted file mode 100644 index 9d7850e..0000000 --- a/832-binary-tree-pruning/2024-01-08 15.38.39 - Accepted - runtime 38ms - memory 17.4MB.py +++ /dev/null @@ -1,35 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, node) -> bool: - if not node: - return False - if not node.val and not node.left and not node.right: - return False - if node.val: - return True - return self.traverse(node.left) or self.traverse(node.right) - - def pruneTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - r = root - if not self.traverse(r): - return None - stack = [r] - while stack: - n = stack.pop() - if n.left: - if self.traverse(n.left): - stack.append(n.left) - else: - n.left = None - if n.right: - if self.traverse(n.right): - stack.append(n.right) - else: - n.right = None - - return r \ No newline at end of file diff --git a/832-binary-tree-pruning/2024-01-08 15.41.14 - Accepted - runtime 30ms - memory 17.2MB.py b/832-binary-tree-pruning/2024-01-08 15.41.14 - Accepted - runtime 30ms - memory 17.2MB.py deleted file mode 100644 index 9d7850e..0000000 --- a/832-binary-tree-pruning/2024-01-08 15.41.14 - Accepted - runtime 30ms - memory 17.2MB.py +++ /dev/null @@ -1,35 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def traverse(self, node) -> bool: - if not node: - return False - if not node.val and not node.left and not node.right: - return False - if node.val: - return True - return self.traverse(node.left) or self.traverse(node.right) - - def pruneTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: - r = root - if not self.traverse(r): - return None - stack = [r] - while stack: - n = stack.pop() - if n.left: - if self.traverse(n.left): - stack.append(n.left) - else: - n.left = None - if n.right: - if self.traverse(n.right): - stack.append(n.right) - else: - n.right = None - - return r \ No newline at end of file diff --git a/832-binary-tree-pruning/2024-01-08 15.42.34 - Accepted - runtime 33ms - memory 17.2MB.py b/832-binary-tree-pruning/2024-01-08 15.42.34 - Accepted - runtime 33ms - memory 17.2MB.py deleted file mode 100644 index f059144..0000000 --- a/832-binary-tree-pruning/2024-01-08 15.42.34 - Accepted - runtime 33ms - memory 17.2MB.py +++ /dev/null @@ -1,13 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def pruneTree(self, root): - if not root: return None - root.left = self.pruneTree(root.left) - root.right = self.pruneTree(root.right) - if not root.left and not root.right and not root.val: return None - return root \ No newline at end of file diff --git a/832-binary-tree-pruning/2024-01-08 15.42.47 - Accepted - runtime 35ms - memory 17.4MB.py b/832-binary-tree-pruning/2024-01-08 15.42.47 - Accepted - runtime 35ms - memory 17.4MB.py deleted file mode 100644 index f059144..0000000 --- a/832-binary-tree-pruning/2024-01-08 15.42.47 - Accepted - runtime 35ms - memory 17.4MB.py +++ /dev/null @@ -1,13 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def pruneTree(self, root): - if not root: return None - root.left = self.pruneTree(root.left) - root.right = self.pruneTree(root.right) - if not root.left and not root.right and not root.val: return None - return root \ No newline at end of file diff --git a/837-most-common-word/2024-04-05 19.36.42 - Accepted - runtime 43ms - memory 16.5MB.py b/837-most-common-word/2024-04-05 19.36.42 - Accepted - runtime 43ms - memory 16.5MB.py deleted file mode 100644 index 8c558bf..0000000 --- a/837-most-common-word/2024-04-05 19.36.42 - Accepted - runtime 43ms - memory 16.5MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: - b = set(banned) - c = Counter(filter(lambda x: x not in b, re.findall(r'\w+', paragraph.lower()))) - return c.most_common(1)[0][0] \ No newline at end of file diff --git a/841-shortest-distance-to-a-character/2022-09-26 17.43.01 - Accepted - runtime 167ms - memory 13.9MB.py b/841-shortest-distance-to-a-character/2022-09-26 17.43.01 - Accepted - runtime 167ms - memory 13.9MB.py deleted file mode 100644 index 80786d0..0000000 --- a/841-shortest-distance-to-a-character/2022-09-26 17.43.01 - Accepted - runtime 167ms - memory 13.9MB.py +++ /dev/null @@ -1,4 +0,0 @@ -class Solution: - def shortestToChar(self, s: str, c: str) -> List[int]: - indices = [ind for ind,f in enumerate(s)if f == c] - return [min(abs(ind - i)for i in indices)for ind,f in enumerate(s)] \ No newline at end of file diff --git a/85-maximal-rectangle/2024-04-13 09.44.22 - Accepted - runtime 227ms - memory 18.1MB.py b/85-maximal-rectangle/2024-04-13 09.44.22 - Accepted - runtime 227ms - memory 18.1MB.py deleted file mode 100644 index 515ceae..0000000 --- a/85-maximal-rectangle/2024-04-13 09.44.22 - Accepted - runtime 227ms - memory 18.1MB.py +++ /dev/null @@ -1,25 +0,0 @@ -class Solution: - def maximalRectangle(self, matrix: List[List[str]]) -> int: - h, w = len(matrix), len(matrix[0]) - left = [0] * w - right = [w] * w - height = [0] * w - res = 0 - for i in range(h): - l, r = 0, w - for j in range(w): - if matrix[i][j] == '1': height[j] += 1 - else: height[j] = 0 - - for j in range(w): - if matrix[i][j] == '1': left[j] = max(left[j], l) - else: left[j] = 0; l = j + 1 - - for j in range(w - 1, -1, -1): - if matrix[i][j] == '1': right[j] = min(right[j], r) - else: right[j] = w; r = j - - for j in range(w): - res = max(res, (right[j]-left[j])*height[j]) - - return res \ No newline at end of file diff --git a/85-maximal-rectangle/2024-04-13 09.49.05 - Accepted - runtime 210ms - memory 17.9MB.py b/85-maximal-rectangle/2024-04-13 09.49.05 - Accepted - runtime 210ms - memory 17.9MB.py deleted file mode 100644 index 81a830a..0000000 --- a/85-maximal-rectangle/2024-04-13 09.49.05 - Accepted - runtime 210ms - memory 17.9MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def maximalRectangle(self, matrix: List[List[str]]) -> int: - m = len(matrix) - n = len(matrix[0]) - heights = [0] * (n + 1) - best = 0 - for row in matrix: - for col in range(n): - heights[col] = heights[col] + 1 if row[col] == '1' else 0 - stack = [-1] - for col in range(n + 1): - while heights[col] < heights[stack[-1]]: - h = heights[stack.pop()] - w = col - stack[-1] - 1 - best = max(best, h * w) - stack.append(col) - return best \ No newline at end of file diff --git a/851-goat-latin/2024-04-05 19.46.35 - Accepted - runtime 42ms - memory 16.5MB.py b/851-goat-latin/2024-04-05 19.46.35 - Accepted - runtime 42ms - memory 16.5MB.py deleted file mode 100644 index 3b9ed67..0000000 --- a/851-goat-latin/2024-04-05 19.46.35 - Accepted - runtime 42ms - memory 16.5MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def toGoatLatin(self, sentence: str) -> str: - return ' '.join(f[f[0] not in 'aeiouAEIOU':] + f[:f[0] not in 'aeiouAEIOU'] + 'ma' + 'a' * ind for ind, f in enumerate(sentence.split(), 1)) \ No newline at end of file diff --git a/857-positions-of-large-groups/2024-04-07 00.24.09 - Accepted - runtime 38ms - memory 16.6MB.py b/857-positions-of-large-groups/2024-04-07 00.24.09 - Accepted - runtime 38ms - memory 16.6MB.py deleted file mode 100644 index c983f98..0000000 --- a/857-positions-of-large-groups/2024-04-07 00.24.09 - Accepted - runtime 38ms - memory 16.6MB.py +++ /dev/null @@ -1,17 +0,0 @@ -class Solution: - def largeGroupPositions(self, s: str) -> List[List[int]]: - r = [] - count = last = 0 - curr = '' - for i in range(len(s)): - if curr == s[i]: - count += 1 - else: - if count > 2: - r += (last, i - 1), - last = i - curr = s[i] - count = 1 - if count > 2:r += (last, i), - - return r \ No newline at end of file diff --git a/863-sum-of-distances-in-tree/2024-04-28 10.41.42 - Accepted - runtime 767ms - memory 44.5MB.py b/863-sum-of-distances-in-tree/2024-04-28 10.41.42 - Accepted - runtime 767ms - memory 44.5MB.py deleted file mode 100644 index 2b655b4..0000000 --- a/863-sum-of-distances-in-tree/2024-04-28 10.41.42 - Accepted - runtime 767ms - memory 44.5MB.py +++ /dev/null @@ -1,27 +0,0 @@ -class Solution: - def sumOfDistancesInTree(self, n: int, edges: List[List[int]]) -> List[int]: - graph = defaultdict(list) - for u, v in edges: - graph[u].append(v) - graph[v].append(u) - - count = [1] * n - res = [0] * n - - def dfs(node, parent): - for child in graph[node]: - if child != parent: - dfs(child, node) - count[node] += count[child] - res[node] += res[child] + count[child] - - def dfs2(node, parent): - for child in graph[node]: - if child != parent: - res[child] = res[node] - count[child] + (n - count[child]) - dfs2(child, node) - - dfs(0, -1) - dfs2(0, -1) - - return res diff --git a/88-merge-sorted-array/2022-06-23 21.43.40 - Accepted - runtime 41ms - memory 13.9MB.py b/88-merge-sorted-array/2022-06-23 21.43.40 - Accepted - runtime 41ms - memory 13.9MB.py deleted file mode 100644 index 18e8cf9..0000000 --- a/88-merge-sorted-array/2022-06-23 21.43.40 - Accepted - runtime 41ms - memory 13.9MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: - """ - Do not return anything, modify nums1 in-place instead. - """ - for i in range(n): - nums1.pop() - nums1.extend(nums2) - nums1.sort() - \ No newline at end of file diff --git a/9-palindrome-number/2022-04-24 19.57.39 - Accepted - runtime 104ms - memory 13.9MB.py b/9-palindrome-number/2022-04-24 19.57.39 - Accepted - runtime 104ms - memory 13.9MB.py deleted file mode 100644 index fce763a..0000000 --- a/9-palindrome-number/2022-04-24 19.57.39 - Accepted - runtime 104ms - memory 13.9MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def isPalindrome(self, x: int) -> bool: - return str(x) == str(x)[::-1] \ No newline at end of file diff --git a/9-palindrome-number/2023-03-05 12.50.17 - Accepted - runtime 74ms - memory 13.8MB.py b/9-palindrome-number/2023-03-05 12.50.17 - Accepted - runtime 74ms - memory 13.8MB.py deleted file mode 100644 index fce763a..0000000 --- a/9-palindrome-number/2023-03-05 12.50.17 - Accepted - runtime 74ms - memory 13.8MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def isPalindrome(self, x: int) -> bool: - return str(x) == str(x)[::-1] \ No newline at end of file diff --git a/9-palindrome-number/2024-02-16 14.56.24 - Accepted - runtime 17ms - memory 10.6MB.cpp b/9-palindrome-number/2024-02-16 14.56.24 - Accepted - runtime 17ms - memory 10.6MB.cpp deleted file mode 100644 index 692920b..0000000 --- a/9-palindrome-number/2024-02-16 14.56.24 - Accepted - runtime 17ms - memory 10.6MB.cpp +++ /dev/null @@ -1,9 +0,0 @@ -class Solution { -public: - bool isPalindrome(int x) { - string s = to_string(x); - string t = s; - reverse(t.begin(), t.end()); - return s == t; - } -}; \ No newline at end of file diff --git a/904-leaf-similar-trees/2024-01-04 16.11.54 - Accepted - runtime 46ms - memory 17.5MB.py b/904-leaf-similar-trees/2024-01-04 16.11.54 - Accepted - runtime 46ms - memory 17.5MB.py deleted file mode 100644 index 74d94bf..0000000 --- a/904-leaf-similar-trees/2024-01-04 16.11.54 - Accepted - runtime 46ms - memory 17.5MB.py +++ /dev/null @@ -1,19 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def extract(self, node: Optional[TreeNode]): - if not node.left and not node.right: - yield node.val - else: - if node.left: - yield from self.extract(node.left) - if node.right: - yield from self.extract(node.right) - - def leafSimilar(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> bool: - return list(self.extract(root1)) == list(self.extract(root2)) - \ No newline at end of file diff --git a/904-leaf-similar-trees/2024-01-04 16.18.33 - Accepted - runtime 35ms - memory 17.4MB.py b/904-leaf-similar-trees/2024-01-04 16.18.33 - Accepted - runtime 35ms - memory 17.4MB.py deleted file mode 100644 index 3076871..0000000 --- a/904-leaf-similar-trees/2024-01-04 16.18.33 - Accepted - runtime 35ms - memory 17.4MB.py +++ /dev/null @@ -1,22 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def extract(self, node:Optional[TreeNode]) -> list[int]: - r, R = [], [node] - while R: - n = R.pop() - if not n.left and not n.right: - r.append(n.val) - continue - if n.left: - R.append(n.left) - if n.right: - R.append(n.right) - return r - - def leafSimilar(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> bool: - return self.extract(root1) == self.extract(root2) \ No newline at end of file diff --git a/907-koko-eating-bananas/2023-03-08 10.32.09 - Accepted - runtime 829ms - memory 15.5MB.py b/907-koko-eating-bananas/2023-03-08 10.32.09 - Accepted - runtime 829ms - memory 15.5MB.py deleted file mode 100644 index bb816c6..0000000 --- a/907-koko-eating-bananas/2023-03-08 10.32.09 - Accepted - runtime 829ms - memory 15.5MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def minEatingSpeed(self, piles: List[int], h: int) -> int: - lo, hi = 1, max(piles) * h - while lo < hi: - mid = (lo + hi) // 2 - if sum(math.ceil(f / mid) for f in piles) <= h: - hi = mid - else: - lo = mid + 1 - - return lo \ No newline at end of file diff --git a/907-koko-eating-bananas/2023-03-08 10.32.52 - Accepted - runtime 466ms - memory 15.4MB.py b/907-koko-eating-bananas/2023-03-08 10.32.52 - Accepted - runtime 466ms - memory 15.4MB.py deleted file mode 100644 index bc63569..0000000 --- a/907-koko-eating-bananas/2023-03-08 10.32.52 - Accepted - runtime 466ms - memory 15.4MB.py +++ /dev/null @@ -1,11 +0,0 @@ -class Solution: - def minEatingSpeed(self, piles: List[int], h: int) -> int: - lo, hi = 1, max(piles) - while lo < hi: - mid = (lo + hi) // 2 - if sum(math.ceil(f / mid) for f in piles) <= h: - hi = mid - else: - lo = mid + 1 - - return lo \ No newline at end of file diff --git a/908-middle-of-the-linked-list/2022-09-26 15.00.52 - Accepted - runtime 74ms - memory 13.9MB.py b/908-middle-of-the-linked-list/2022-09-26 15.00.52 - Accepted - runtime 74ms - memory 13.9MB.py deleted file mode 100644 index 0a4448f..0000000 --- a/908-middle-of-the-linked-list/2022-09-26 15.00.52 - Accepted - runtime 74ms - memory 13.9MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]: - l = [] - r = 0 - while head: - l.append(head) - head = head.next - r += 1 - return l[r // 2] \ No newline at end of file diff --git a/908-middle-of-the-linked-list/2022-09-26 15.16.05 - Accepted - runtime 59ms - memory 13.8MB.py b/908-middle-of-the-linked-list/2022-09-26 15.16.05 - Accepted - runtime 59ms - memory 13.8MB.py deleted file mode 100644 index a95acc0..0000000 --- a/908-middle-of-the-linked-list/2022-09-26 15.16.05 - Accepted - runtime 59ms - memory 13.8MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]: - slow = fast = head - while fast and fast.next: - slow = slow.next - fast = fast.next.next - - return slow \ No newline at end of file diff --git a/908-middle-of-the-linked-list/2024-03-07 14.21.03 - Accepted - runtime 38ms - memory 16.4MB.py b/908-middle-of-the-linked-list/2024-03-07 14.21.03 - Accepted - runtime 38ms - memory 16.4MB.py deleted file mode 100644 index 3d48db1..0000000 --- a/908-middle-of-the-linked-list/2024-03-07 14.21.03 - Accepted - runtime 38ms - memory 16.4MB.py +++ /dev/null @@ -1,14 +0,0 @@ -# Definition for singly-linked list. -# class ListNode: -# def __init__(self, val=0, next=None): -# self.val = val -# self.next = next -class Solution: - def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]: - l = [] - while head: - l.append(head) - head = head.next - - return l[len(l) // 2] - \ No newline at end of file diff --git a/917-boats-to-save-people/2023-04-03 21.20.24 - Accepted - runtime 451ms - memory 20.8MB.py b/917-boats-to-save-people/2023-04-03 21.20.24 - Accepted - runtime 451ms - memory 20.8MB.py deleted file mode 100644 index d5ed949..0000000 --- a/917-boats-to-save-people/2023-04-03 21.20.24 - Accepted - runtime 451ms - memory 20.8MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def numRescueBoats(self, people: List[int], limit: int) -> int: - people.sort() - lo, hi = 0, len(people) - 1 - res = 0 - while lo <= hi: - res += 1 - if people[hi] + people[lo] <= limit: - lo += 1 - hi -= 1 - else: - hi -= 1 - - return res \ No newline at end of file diff --git a/917-boats-to-save-people/2024-05-04 10.01.24 - Accepted - runtime 350ms - memory 23.4MB.py b/917-boats-to-save-people/2024-05-04 10.01.24 - Accepted - runtime 350ms - memory 23.4MB.py deleted file mode 100644 index 8d5de7a..0000000 --- a/917-boats-to-save-people/2024-05-04 10.01.24 - Accepted - runtime 350ms - memory 23.4MB.py +++ /dev/null @@ -1,15 +0,0 @@ -class Solution: - def numRescueBoats(self, people: List[int], limit: int) -> int: - res = 0 - l, r = 0, len(people) - 1 - people.sort() - while l <= r: - while people[r] > limit: r -= 1 - if people[r] + people[l] <= limit: - res += 1 - r -= 1 - l += 1 - else: - res += 1 - r -= 1 - return res \ No newline at end of file diff --git a/917-boats-to-save-people/2024-05-04 10.04.41 - Accepted - runtime 358ms - memory 23.3MB.py b/917-boats-to-save-people/2024-05-04 10.04.41 - Accepted - runtime 358ms - memory 23.3MB.py deleted file mode 100644 index 14fe86f..0000000 --- a/917-boats-to-save-people/2024-05-04 10.04.41 - Accepted - runtime 358ms - memory 23.3MB.py +++ /dev/null @@ -1,8 +0,0 @@ -class Solution: - def numRescueBoats(self, people: List[int], limit: int) -> int: - people.sort(reverse=True) - l, r = 0, len(people) - 1 - while l <= r: - if people[l] + people[r] <= limit: r -= 1 - l += 1 - return l \ No newline at end of file diff --git a/92-reverse-linked-list-ii/2022-07-21 22.46.11 - Accepted - runtime 49ms - memory 14MB.py b/92-reverse-linked-list-ii/2022-07-21 22.46.11 - Accepted - runtime 49ms - memory 14MB.py deleted file mode 100644 index 6b82982..0000000 --- a/92-reverse-linked-list-ii/2022-07-21 22.46.11 - Accepted - runtime 49ms - memory 14MB.py +++ /dev/null @@ -1,14 +0,0 @@ -class Solution: - def reverseBetween(self, head, m, n): - if not head or m == n: return head - p = dummy = ListNode(None) - dummy.next = head - for i in range(m-1): p = p.next - tail = p.next - - for i in range(n-m): - tmp = p.next # a) - p.next = tail.next # b) - tail.next = tail.next.next # c) - p.next.next = tmp # d) - return dummy.next \ No newline at end of file diff --git a/92-reverse-linked-list-ii/2024-02-17 16.28.17 - Accepted - runtime 0ms - memory 9.4MB.cpp b/92-reverse-linked-list-ii/2024-02-17 16.28.17 - Accepted - runtime 0ms - memory 9.4MB.cpp deleted file mode 100644 index c635bf5..0000000 --- a/92-reverse-linked-list-ii/2024-02-17 16.28.17 - Accepted - runtime 0ms - memory 9.4MB.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Definition for singly-linked list. - * struct ListNode { - * int val; - * ListNode *next; - * ListNode() : val(0), next(nullptr) {} - * ListNode(int x) : val(x), next(nullptr) {} - * ListNode(int x, ListNode *next) : val(x), next(next) {} - * }; - */ -class Solution { -public: - ListNode* reverseBetween(ListNode* head, int left, int right) { - if (head == NULL || left == right) return head; - ListNode* dummy = new ListNode(); - ListNode* p = dummy; - dummy -> next = head; - for (int i=0; i < left - 1;i++) p = p -> next; - ListNode* tail = p -> next; - for (int i=0; i < right - left; i++){ - ListNode* tmp = p -> next; - p -> next = tail -> next; - tail -> next = tail -> next -> next; - p -> next -> next = tmp; - } - return dummy -> next; - } - -}; \ No newline at end of file diff --git a/926-find-and-replace-pattern/2022-07-29 20.00.13 - Accepted - runtime 67ms - memory 14MB.py b/926-find-and-replace-pattern/2022-07-29 20.00.13 - Accepted - runtime 67ms - memory 14MB.py deleted file mode 100644 index a5fe8f4..0000000 --- a/926-find-and-replace-pattern/2022-07-29 20.00.13 - Accepted - runtime 67ms - memory 14MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def findAndReplacePattern(self, w: List[str], p: str) -> List[str]: - return [f for f in w if all(f.index(a)==p.index(b) for a,b in zip(f,p))] \ No newline at end of file diff --git a/932-monotonic-array/2024-02-20 19.40.30 - Accepted - runtime 751ms - memory 31.1MB.py b/932-monotonic-array/2024-02-20 19.40.30 - Accepted - runtime 751ms - memory 31.1MB.py deleted file mode 100644 index cb6af4c..0000000 --- a/932-monotonic-array/2024-02-20 19.40.30 - Accepted - runtime 751ms - memory 31.1MB.py +++ /dev/null @@ -1,5 +0,0 @@ -class Solution: - def isMonotonic(self, nums: List[int]) -> bool: - l = sorted(nums) - return nums == l or nums[::-1] == l - \ No newline at end of file diff --git a/932-monotonic-array/2024-02-20 19.48.57 - Accepted - runtime 109ms - memory 98.9MB.cpp b/932-monotonic-array/2024-02-20 19.48.57 - Accepted - runtime 109ms - memory 98.9MB.cpp deleted file mode 100644 index fc00700..0000000 --- a/932-monotonic-array/2024-02-20 19.48.57 - Accepted - runtime 109ms - memory 98.9MB.cpp +++ /dev/null @@ -1,11 +0,0 @@ -class Solution { -public: - bool isMonotonic(vector& nums) { - bool inc = true, dec = true; - for (int i = 1; i < nums.size(); ++i){ - inc &= nums[i - 1] <= nums[i]; - dec &= nums[i - 1] >= nums[i]; - } - return inc || dec; - } -}; \ No newline at end of file diff --git a/933-increasing-order-search-tree/2024-02-01 23.14.31 - Accepted - runtime 20ms - memory 16.6MB.py b/933-increasing-order-search-tree/2024-02-01 23.14.31 - Accepted - runtime 20ms - memory 16.6MB.py deleted file mode 100644 index 0efea0f..0000000 --- a/933-increasing-order-search-tree/2024-02-01 23.14.31 - Accepted - runtime 20ms - memory 16.6MB.py +++ /dev/null @@ -1,22 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def increasingBST(self, root: TreeNode) -> TreeNode: - r = [] - s = [root] - while s: - n = s.pop() - r.append(n) - for i in (n.left, n.right): - if i:s.append(i) - r.sort(key=lambda x: x.val) - for i in range(len(r) - 1): - r[i].left = None - r[i].right = r[i + 1] - r[-1].left = r[-1].right = None - - return r[0] \ No newline at end of file diff --git a/933-increasing-order-search-tree/2024-02-01 23.20.40 - Accepted - runtime 34ms - memory 16.6MB.py b/933-increasing-order-search-tree/2024-02-01 23.20.40 - Accepted - runtime 34ms - memory 16.6MB.py deleted file mode 100644 index 283edd8..0000000 --- a/933-increasing-order-search-tree/2024-02-01 23.20.40 - Accepted - runtime 34ms - memory 16.6MB.py +++ /dev/null @@ -1,13 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def increasingBST(self, root: TreeNode, parent = None) -> TreeNode: - if not root: return parent - res = self.increasingBST(root.left, root) - root.left = None - root.right = self.increasingBST(root.right, parent) - return res \ No newline at end of file diff --git a/94-binary-tree-inorder-traversal/2022-06-23 18.59.13 - Accepted - runtime 37ms - memory 13.9MB.py b/94-binary-tree-inorder-traversal/2022-06-23 18.59.13 - Accepted - runtime 37ms - memory 13.9MB.py deleted file mode 100644 index 5fc0aa5..0000000 --- a/94-binary-tree-inorder-traversal/2022-06-23 18.59.13 - Accepted - runtime 37ms - memory 13.9MB.py +++ /dev/null @@ -1,26 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]: - res = [] - nodes = [] - curr = root - if not root: - return res - - while nodes or curr: - while curr: - nodes.append(curr) - curr = curr.left - - curr = nodes.pop() - res.append(curr.val) - curr = curr.right - - return res - - \ No newline at end of file diff --git a/941-sort-array-by-parity/2024-02-17 23.57.04 - Accepted - runtime 63ms - memory 17.3MB.py b/941-sort-array-by-parity/2024-02-17 23.57.04 - Accepted - runtime 63ms - memory 17.3MB.py deleted file mode 100644 index 24c3efd..0000000 --- a/941-sort-array-by-parity/2024-02-17 23.57.04 - Accepted - runtime 63ms - memory 17.3MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sortArrayByParity(self, nums: List[int]) -> List[int]: - return sorted(nums, key=lambda x: x%2) \ No newline at end of file diff --git a/941-sort-array-by-parity/2024-02-18 00.01.22 - Accepted - runtime 7ms - memory 18.6MB.cpp b/941-sort-array-by-parity/2024-02-18 00.01.22 - Accepted - runtime 7ms - memory 18.6MB.cpp deleted file mode 100644 index 9b66c07..0000000 --- a/941-sort-array-by-parity/2024-02-18 00.01.22 - Accepted - runtime 7ms - memory 18.6MB.cpp +++ /dev/null @@ -1,12 +0,0 @@ -class Solution { -public: - vector sortArrayByParity(vector& nums) { - int low = 0, high = nums.size() - 1; - while (low < high){ - while (low < high && nums[low] % 2 == 0) low++; - while (low < high && nums[high] % 2)high--; - swap(nums[low], nums[high]); - } - return nums; - } -}; \ No newline at end of file diff --git a/941-sort-array-by-parity/2024-02-18 00.04.53 - Accepted - runtime 7ms - memory 19MB.cpp b/941-sort-array-by-parity/2024-02-18 00.04.53 - Accepted - runtime 7ms - memory 19MB.cpp deleted file mode 100644 index a7f66df..0000000 --- a/941-sort-array-by-parity/2024-02-18 00.04.53 - Accepted - runtime 7ms - memory 19MB.cpp +++ /dev/null @@ -1,8 +0,0 @@ -class Solution { -public: - vector sortArrayByParity(vector& nums) { - int even=-1; - for(int& x: nums) if(x % 2 == 0) swap(nums[++even], x); - return nums; - } -}; \ No newline at end of file diff --git a/941-sort-array-by-parity/2024-02-18 00.05.19 - Accepted - runtime 10ms - memory 18.9MB.cpp b/941-sort-array-by-parity/2024-02-18 00.05.19 - Accepted - runtime 10ms - memory 18.9MB.cpp deleted file mode 100644 index 2cd1e0b..0000000 --- a/941-sort-array-by-parity/2024-02-18 00.05.19 - Accepted - runtime 10ms - memory 18.9MB.cpp +++ /dev/null @@ -1,8 +0,0 @@ -class Solution { -public: - vector sortArrayByParity(vector& nums) { - int even=-1; - for(int& x: nums) if(!(x&1)) swap(nums[++even], x); - return nums; - } -}; \ No newline at end of file diff --git a/948-sort-an-array/2023-03-01 19.43.28 - Accepted - runtime 690ms - memory 22.2MB.py b/948-sort-an-array/2023-03-01 19.43.28 - Accepted - runtime 690ms - memory 22.2MB.py deleted file mode 100644 index a3e0168..0000000 --- a/948-sort-an-array/2023-03-01 19.43.28 - Accepted - runtime 690ms - memory 22.2MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def sortArray(self, nums: List[int]) -> List[int]: - return sorted(nums) \ No newline at end of file diff --git a/961-long-pressed-name/2024-04-06 12.16.00 - Accepted - runtime 46ms - memory 16.7MB.py b/961-long-pressed-name/2024-04-06 12.16.00 - Accepted - runtime 46ms - memory 16.7MB.py deleted file mode 100644 index a5974ad..0000000 --- a/961-long-pressed-name/2024-04-06 12.16.00 - Accepted - runtime 46ms - memory 16.7MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def isLongPressedName(self, name: str, typed: str) -> bool: - a,b = map(lambda x: list((A, len(list(B))) for A,B in groupby(x)), (name, typed)) - if len(a) != len(b): - return False - for (i, j), (I, J) in zip(a, b): - if i != I or j > J: - return False - return True \ No newline at end of file diff --git a/962-flip-string-to-monotone-increasing/2024-04-06 12.25.38 - Accepted - runtime 123ms - memory 17.2MB.py b/962-flip-string-to-monotone-increasing/2024-04-06 12.25.38 - Accepted - runtime 123ms - memory 17.2MB.py deleted file mode 100644 index 92b8aa5..0000000 --- a/962-flip-string-to-monotone-increasing/2024-04-06 12.25.38 - Accepted - runtime 123ms - memory 17.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def minFlipsMonoIncr(self, s: str) -> int: - a = b = 0 - for i in s: - if i == '1': a += 1 - else: b += 1 - b = min(a, b) - - return b \ No newline at end of file diff --git a/966-binary-subarrays-with-sum/2024-03-14 12.11.05 - Accepted - runtime 237ms - memory 20.2MB.py b/966-binary-subarrays-with-sum/2024-03-14 12.11.05 - Accepted - runtime 237ms - memory 20.2MB.py deleted file mode 100644 index fb88649..0000000 --- a/966-binary-subarrays-with-sum/2024-03-14 12.11.05 - Accepted - runtime 237ms - memory 20.2MB.py +++ /dev/null @@ -1,9 +0,0 @@ -class Solution: - def numSubarraysWithSum(self, nums: List[int], goal: int) -> int: - c = collections.Counter({0: 1}) - psum = res = 0 - for i in nums: - psum += i - res += c[psum - goal] - c[psum] += 1 - return res \ No newline at end of file diff --git a/969-number-of-recent-calls/2023-01-18 16.18.17 - Accepted - runtime 452ms - memory 19.4MB.py b/969-number-of-recent-calls/2023-01-18 16.18.17 - Accepted - runtime 452ms - memory 19.4MB.py deleted file mode 100644 index 09cf976..0000000 --- a/969-number-of-recent-calls/2023-01-18 16.18.17 - Accepted - runtime 452ms - memory 19.4MB.py +++ /dev/null @@ -1,18 +0,0 @@ -class RecentCounter: - - def __init__(self): - self.min = -3000 - self.pings: list[int] = [] - self.res = 0 - - def ping(self, t: int) -> int: - self.pings.append(t) - self.min = t - 3000 - self.res += 1 - for i in range(self.res): - if self.pings[i] >= self.min: - self.pings = self.pings[i:] - break - self.res -= 1 - return self.res - \ No newline at end of file diff --git a/975-range-sum-of-bst/2022-08-01 21.33.20 - Accepted - runtime 601ms - memory 23.1MB.py b/975-range-sum-of-bst/2022-08-01 21.33.20 - Accepted - runtime 601ms - memory 23.1MB.py deleted file mode 100644 index 2c12ad4..0000000 --- a/975-range-sum-of-bst/2022-08-01 21.33.20 - Accepted - runtime 601ms - memory 23.1MB.py +++ /dev/null @@ -1,16 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def sum_bst(self, node, low, high): - if node: - if node.val >= low and node.val <= high: - yield node.val - yield from self.sum_bst(node.left, low, high) - yield from self.sum_bst(node.right, low, high) - return 0 - def rangeSumBST(self, root: Optional[TreeNode], low: int, high: int) -> int: - return sum(self.sum_bst(root, low, high)) \ No newline at end of file diff --git a/975-range-sum-of-bst/2024-01-08 14.37.44 - Accepted - runtime 135ms - memory 24.7MB.py b/975-range-sum-of-bst/2024-01-08 14.37.44 - Accepted - runtime 135ms - memory 24.7MB.py deleted file mode 100644 index f59ba48..0000000 --- a/975-range-sum-of-bst/2024-01-08 14.37.44 - Accepted - runtime 135ms - memory 24.7MB.py +++ /dev/null @@ -1,20 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def rangeSumBST(self, root: Optional[TreeNode], low: int, high: int) -> int: - s = 0 - stack = [root] - while stack: - n = stack.pop() - if low <= n.val <= high: - s += n.val - if n.left: - stack.append(n.left) - if n.right: - stack.append(n.right) - return s - \ No newline at end of file diff --git a/975-range-sum-of-bst/2024-02-20 13.09.29 - Accepted - runtime 86ms - memory 63MB.cpp b/975-range-sum-of-bst/2024-02-20 13.09.29 - Accepted - runtime 86ms - memory 63MB.cpp deleted file mode 100644 index 9fe3873..0000000 --- a/975-range-sum-of-bst/2024-02-20 13.09.29 - Accepted - runtime 86ms - memory 63MB.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int rangeSumBST(TreeNode* root, int L, int H) { - if (!root) return 0; - if (root -> val < L) return rangeSumBST(root -> right, L, H); - if (root -> val > H) return rangeSumBST(root -> left, L, H); - return root -> val + rangeSumBST(root -> left, L, H) + rangeSumBST(root -> right, L, H); - } -}; \ No newline at end of file diff --git a/98-validate-binary-search-tree/2024-03-10 18.42.00 - Accepted - runtime 54ms - memory 18.5MB.py b/98-validate-binary-search-tree/2024-03-10 18.42.00 - Accepted - runtime 54ms - memory 18.5MB.py deleted file mode 100644 index 7d52f7c..0000000 --- a/98-validate-binary-search-tree/2024-03-10 18.42.00 - Accepted - runtime 54ms - memory 18.5MB.py +++ /dev/null @@ -1,17 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def isValidBST(self, root: Optional[TreeNode], min_val = float('-inf'), max_val = float('inf')) -> bool: - if not root: - return True - - if not (min_val < root.val < max_val): - return False - - return self.isValidBST(root.left, min_val, root.val) and \ - self.isValidBST(root.right, root.val, max_val) - \ No newline at end of file diff --git a/98-validate-binary-search-tree/2024-03-10 18.42.13 - Accepted - runtime 39ms - memory 18.4MB.py b/98-validate-binary-search-tree/2024-03-10 18.42.13 - Accepted - runtime 39ms - memory 18.4MB.py deleted file mode 100644 index 7d52f7c..0000000 --- a/98-validate-binary-search-tree/2024-03-10 18.42.13 - Accepted - runtime 39ms - memory 18.4MB.py +++ /dev/null @@ -1,17 +0,0 @@ -# Definition for a binary tree node. -# class TreeNode: -# def __init__(self, val=0, left=None, right=None): -# self.val = val -# self.left = left -# self.right = right -class Solution: - def isValidBST(self, root: Optional[TreeNode], min_val = float('-inf'), max_val = float('inf')) -> bool: - if not root: - return True - - if not (min_val < root.val < max_val): - return False - - return self.isValidBST(root.left, min_val, root.val) and \ - self.isValidBST(root.right, root.val, max_val) - \ No newline at end of file diff --git a/981-delete-columns-to-make-sorted/2023-01-06 20.36.30 - Accepted - runtime 90ms - memory 14.7MB.py b/981-delete-columns-to-make-sorted/2023-01-06 20.36.30 - Accepted - runtime 90ms - memory 14.7MB.py deleted file mode 100644 index 5cb021b..0000000 --- a/981-delete-columns-to-make-sorted/2023-01-06 20.36.30 - Accepted - runtime 90ms - memory 14.7MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def minDeletionSize(self, strs: List[str]) -> int: - return sum(f != tuple(sorted(f)) for f in zip(*strs)) \ No newline at end of file diff --git a/983-validate-stack-sequences/2023-04-13 11.17.47 - Accepted - runtime 71ms - memory 14.1MB.py b/983-validate-stack-sequences/2023-04-13 11.17.47 - Accepted - runtime 71ms - memory 14.1MB.py deleted file mode 100644 index 2785297..0000000 --- a/983-validate-stack-sequences/2023-04-13 11.17.47 - Accepted - runtime 71ms - memory 14.1MB.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool: - stack = [] - i = 0 - for n in pushed: - stack.append(n) - while stack and stack[-1] == popped[i]: - stack.pop() - i += 1 - return not stack \ No newline at end of file diff --git a/985-bag-of-tokens/2024-03-04 22.08.36 - Accepted - runtime 53ms - memory 16.8MB.py b/985-bag-of-tokens/2024-03-04 22.08.36 - Accepted - runtime 53ms - memory 16.8MB.py deleted file mode 100644 index d6d83b0..0000000 --- a/985-bag-of-tokens/2024-03-04 22.08.36 - Accepted - runtime 53ms - memory 16.8MB.py +++ /dev/null @@ -1,20 +0,0 @@ -class Solution: - def bagOfTokensScore(self, tokens: List[int], power: int) -> int: - tokens = deque(sorted(tokens)) - score = 0 - while score or tokens: - if len(tokens) == 1: - score += tokens[0] <= power - break - - if power >= tokens[0]: - power -= tokens.popleft() - score += 1 - else: - if score: - power += tokens.pop() - score -= 1 - else: - break - - return score \ No newline at end of file diff --git a/987-reveal-cards-in-increasing-order/2024-04-10 09.44.24 - Accepted - runtime 39ms - memory 16.7MB.py b/987-reveal-cards-in-increasing-order/2024-04-10 09.44.24 - Accepted - runtime 39ms - memory 16.7MB.py deleted file mode 100644 index c58caf6..0000000 --- a/987-reveal-cards-in-increasing-order/2024-04-10 09.44.24 - Accepted - runtime 39ms - memory 16.7MB.py +++ /dev/null @@ -1,7 +0,0 @@ -class Solution: - def deckRevealedIncreasing(self, deck: List[int]) -> List[int]: - d = deque() - for x in sorted(deck)[::-1]: - d.rotate() - d.appendleft(x) - return d \ No newline at end of file diff --git a/990-verifying-an-alien-dictionary/2023-02-02 17.45.03 - Accepted - runtime 44ms - memory 14.1MB.py b/990-verifying-an-alien-dictionary/2023-02-02 17.45.03 - Accepted - runtime 44ms - memory 14.1MB.py deleted file mode 100644 index 5fa41ac..0000000 --- a/990-verifying-an-alien-dictionary/2023-02-02 17.45.03 - Accepted - runtime 44ms - memory 14.1MB.py +++ /dev/null @@ -1,3 +0,0 @@ -class Solution: - def isAlienSorted(self, words: List[str], order: str) -> bool: - return words == sorted(words, key=lambda x:list(order.index(f) for f in x)) \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e2e736c..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 blocage - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Logo.svg b/Logo.svg new file mode 100644 index 0000000..55d4a53 --- /dev/null +++ b/Logo.svg @@ -0,0 +1,417 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app.js b/app.js new file mode 100644 index 0000000..39077b7 --- /dev/null +++ b/app.js @@ -0,0 +1,64 @@ +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}n(205);var o=n(3),i=r(o),a=n(60),s=n(183),u=r(s),l=n(142),c=r(l),h=n(246);(0,a.render)(i.default.createElement(h.Router,{history:h.browserHistory},i.default.createElement(h.Route,{path:"/",component:u.default}),i.default.createElement(h.Route,{path:"/galaxy/:name",component:c.default})),document.getElementById("app"))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(h===clearTimeout)return clearTimeout(e);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function a(){m&&d&&(m=!1,d.length?f=d.concat(f):v=-1,f.length&&s())}function s(){if(!m){var e=o(a);m=!0;for(var t=f.length;t;){for(d=f,f=[];++v1)for(var n=1;n2?n-2:0),o=2;o when using tables, nesting tags like
,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",n,ee.getID(e)):I(!1)},_mountImageIntoNode:function(e,n,i,a){if(!n||n.nodeType!==W&&n.nodeType!==G&&n.nodeType!==q?"production"!==t.env.NODE_ENV?I(!1,"mountComponentIntoNode(...): Target container is not valid."):I(!1):void 0,i){var s=o(n);if(A.canReuseMarkup(e,s))return;var u=s.getAttribute(A.CHECKSUM_ATTR_NAME);s.removeAttribute(A.CHECKSUM_ATTR_NAME);var l=s.outerHTML;s.setAttribute(A.CHECKSUM_ATTR_NAME,u);var c=e;if("production"!==t.env.NODE_ENV){var h;n.nodeType===W?(h=document.createElement("div"),h.innerHTML=e,c=h.innerHTML):(h=document.createElement("iframe"),document.body.appendChild(h),h.contentDocument.write(e),c=h.contentDocument.documentElement.outerHTML,document.body.removeChild(h))}var p=r(c,l),d=" (client) "+c.substring(p-20,p+20)+"\n (server) "+l.substring(p-20,p+20);n.nodeType===G?"production"!==t.env.NODE_ENV?I(!1,"You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s",d):I(!1):void 0,"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?B(!1,"React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:\n%s",d):void 0)}if(n.nodeType===G?"production"!==t.env.NODE_ENV?I(!1,"You're trying to render a component to the document but you didn't use server rendering. We can't do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering."):I(!1):void 0,a.useCreateElement){for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(e)}else V(n,e)},ownerDocumentContextKey:X,getReactRootID:i,getID:a,setID:u,getNode:l,getNodeFromInstance:c,isValid:h,purgeID:p};N.measureMethods(ee,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=ee}).call(t,n(1))},function(e,t,n){(function(t){"use strict";var r=n(19),o=n(4),i=n(47),a="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,s={key:!0,ref:!0,__self:!0,__source:!0},u=function(e,n,r,o,s,u,l){var c={$$typeof:a,type:e,key:n,ref:r,props:l,_owner:u};return"production"!==t.env.NODE_ENV&&(c._store={},i?(Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s})):(c._store.validated=!1,c._self=o,c._source=s),Object.freeze(c.props),Object.freeze(c)),c};u.createElement=function(e,t,n){var o,i={},a=null,l=null,c=null,h=null;if(null!=t){l=void 0===t.ref?null:t.ref,a=void 0===t.key?null:""+t.key,c=void 0===t.__self?null:t.__self,h=void 0===t.__source?null:t.__source;for(o in t)t.hasOwnProperty(o)&&!s.hasOwnProperty(o)&&(i[o]=t[o])}var p=arguments.length-2;if(1===p)i.children=n;else if(p>1){for(var d=Array(p),f=0;f1){for(var m=Array(f),v=0;v2?r-2:0);for(var o=2;o1&&(o=Array.prototype.splice.call(arguments,1));for(var i=0;i should not have a "'+t+'" prop')}t.__esModule=!0,t.falsy=r;var o=n(3),i=o.PropTypes.func,a=o.PropTypes.object,s=o.PropTypes.arrayOf,u=o.PropTypes.oneOfType,l=o.PropTypes.element,c=o.PropTypes.shape,h=o.PropTypes.string,p=c({listen:i.isRequired,pushState:i.isRequired,replaceState:i.isRequired,go:i.isRequired});t.history=p;var d=c({pathname:h.isRequired,search:h.isRequired,state:a,action:h.isRequired,key:h});t.location=d;var f=u([i,h]);t.component=f;var m=u([f,a]);t.components=m;var v=u([a,l]);t.route=v;var g=u([v,s(v)]);t.routes=g,t.default={falsy:r,history:p,location:d,component:f,components:m,route:v}},function(e,t,n){(function(t){"use strict";function r(e,t){return(e&t)===t}var o=n(2),i={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var n=i,a=e.Properties||{},u=e.DOMAttributeNamespaces||{},l=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},h=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in a){s.properties.hasOwnProperty(p)?"production"!==t.env.NODE_ENV?o(!1,"injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",p):o(!1):void 0;var d=p.toLowerCase(),f=a[p],m={attributeName:d,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(f,n.MUST_USE_ATTRIBUTE),mustUseProperty:r(f,n.MUST_USE_PROPERTY),hasSideEffects:r(f,n.HAS_SIDE_EFFECTS),hasBooleanValue:r(f,n.HAS_BOOLEAN_VALUE),hasNumericValue:r(f,n.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(f,n.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(f,n.HAS_OVERLOADED_BOOLEAN_VALUE)};if(m.mustUseAttribute&&m.mustUseProperty?"production"!==t.env.NODE_ENV?o(!1,"DOMProperty: Cannot require using both attribute and property: %s",p):o(!1):void 0,!m.mustUseProperty&&m.hasSideEffects?"production"!==t.env.NODE_ENV?o(!1,"DOMProperty: Properties that have side effects must use property: %s",p):o(!1):void 0,m.hasBooleanValue+m.hasNumericValue+m.hasOverloadedBooleanValue<=1?void 0:"production"!==t.env.NODE_ENV?o(!1,"DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s",p):o(!1), +"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[d]=p),l.hasOwnProperty(p)){var v=l[p];m.attributeName=v,"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[v]=p)}u.hasOwnProperty(p)&&(m.attributeNamespace=u[p]),c.hasOwnProperty(p)&&(m.propertyName=c[p]),h.hasOwnProperty(p)&&(m.mutationMethod=h[p]),s.properties[p]=m}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:"production"!==t.env.NODE_ENV?{}:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t1){var t=e.indexOf(d,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var i=l(e,t);i!==e&&c(e,i,n,r,!1,!0),i!==t&&c(i,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(c("",e,t,n,!0,!1),c(e,"",t,n,!1,!0))},traverseTwoPhaseSkipTarget:function(e,t,n){e&&(c("",e,t,n,!0,!0),c(e,"",t,n,!0,!0))},traverseAncestors:function(e,t,n){c("",e,t,n,!0,!1)},getFirstCommonAncestorID:l,_getNextDescendantID:u,isAncestorIDOf:a,SEPARATOR:d};e.exports=v}).call(t,n(1))},function(e,t,n){var r=r||{},o={REVISION:"71"};e.exports=o,void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),o.log=function(){console.log.apply(console,arguments)},o.warn=function(){console.warn.apply(console,arguments)},o.error=function(){console.error.apply(console,arguments)},o.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},o.CullFaceNone=0,o.CullFaceBack=1,o.CullFaceFront=2,o.CullFaceFrontBack=3,o.FrontFaceDirectionCW=0,o.FrontFaceDirectionCCW=1,o.BasicShadowMap=0,o.PCFShadowMap=1,o.PCFSoftShadowMap=2,o.FrontSide=0,o.BackSide=1,o.DoubleSide=2,o.NoShading=0,o.FlatShading=1,o.SmoothShading=2,o.NoColors=0,o.FaceColors=1,o.VertexColors=2,o.NoBlending=0,o.NormalBlending=1,o.AdditiveBlending=2,o.SubtractiveBlending=3,o.MultiplyBlending=4,o.CustomBlending=5,o.AddEquation=100,o.SubtractEquation=101,o.ReverseSubtractEquation=102,o.MinEquation=103,o.MaxEquation=104,o.ZeroFactor=200,o.OneFactor=201,o.SrcColorFactor=202,o.OneMinusSrcColorFactor=203,o.SrcAlphaFactor=204,o.OneMinusSrcAlphaFactor=205,o.DstAlphaFactor=206,o.OneMinusDstAlphaFactor=207,o.DstColorFactor=208,o.OneMinusDstColorFactor=209,o.SrcAlphaSaturateFactor=210,o.MultiplyOperation=0,o.MixOperation=1,o.AddOperation=2,o.UVMapping=300,o.CubeReflectionMapping=301,o.CubeRefractionMapping=302,o.EquirectangularReflectionMapping=303,o.EquirectangularRefractionMapping=304,o.SphericalReflectionMapping=305,o.RepeatWrapping=1e3,o.ClampToEdgeWrapping=1001,o.MirroredRepeatWrapping=1002,o.NearestFilter=1003,o.NearestMipMapNearestFilter=1004,o.NearestMipMapLinearFilter=1005,o.LinearFilter=1006,o.LinearMipMapNearestFilter=1007,o.LinearMipMapLinearFilter=1008,o.UnsignedByteType=1009,o.ByteType=1010,o.ShortType=1011,o.UnsignedShortType=1012,o.IntType=1013,o.UnsignedIntType=1014,o.FloatType=1015,o.HalfFloatType=1025,o.UnsignedShort4444Type=1016,o.UnsignedShort5551Type=1017,o.UnsignedShort565Type=1018,o.AlphaFormat=1019,o.RGBFormat=1020,o.RGBAFormat=1021,o.LuminanceFormat=1022,o.LuminanceAlphaFormat=1023,o.RGBEFormat=o.RGBAFormat,o.RGB_S3TC_DXT1_Format=2001,o.RGBA_S3TC_DXT1_Format=2002,o.RGBA_S3TC_DXT3_Format=2003,o.RGBA_S3TC_DXT5_Format=2004,o.RGB_PVRTC_4BPPV1_Format=2100,o.RGB_PVRTC_2BPPV1_Format=2101,o.RGBA_PVRTC_4BPPV1_Format=2102,o.RGBA_PVRTC_2BPPV1_Format=2103,o.Projector=function(){o.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){o.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){o.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){o.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},o.CanvasRenderer=function(){o.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},o.Color=function(e){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(e)},o.Color.prototype={constructor:o.Color,r:1,g:1,b:1,set:function(e){return e instanceof o.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(0===t)this.r=this.g=this.b=n;else{var r=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e},o=n<=.5?n*(1+t):n+t-n*t,i=2*n-o;this.r=r(i,o,e+1/3),this.g=r(i,o,e),this.b=r(i,o,e-1/3)}return this},setStyle:function(e){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(e)){var t=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(e);return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(e)){var t=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(e);return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(e)){var t=/^\#([0-9a-f]{6})$/i.exec(e);return this.setHex(parseInt(t[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(e)){var t=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e);return this.setHex(parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3],16)),this}if(/^(\w+)$/i.test(e))return this.setHex(o.ColorKeywords[e]),this},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,n,r=e||{h:0,s:0,l:0},o=this.r,i=this.g,a=this.b,s=Math.max(o,i,a),u=Math.min(o,i,a),l=(u+s)/2;if(u===s)t=0,n=0;else{var c=s-u;switch(n=l<=.5?c/(s+u):c/(2-s-u),s){case o:t=(i-a)/c+(i0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(c-u)*t,this._y=(i-l)*t,this._z=(a-o)*t):r>s&&r>h?(t=2*Math.sqrt(1+r-s-h),this._w=(c-u)/t,this._x=.25*t,this._y=(o+a)/t,this._z=(i+l)/t):s>h?(t=2*Math.sqrt(1+s-r-h),this._w=(i-l)/t,this._x=(o+a)/t,this._y=.25*t,this._z=(u+c)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(a-o)/t,this._x=(i+l)/t,this._y=(u+c)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,n=1e-6;return function(r,i){return void 0===e&&(e=new o.Vector3),t=r.dot(i)+1,tMath.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(o.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,o=e._z,i=e._w,a=t._x,s=t._y,u=t._z,l=t._w;return this._x=n*l+i*a+r*u-o*s,this._y=r*l+i*s+o*a-n*u,this._z=o*l+i*u+n*s-r*a,this._w=i*l-n*a-r*s-o*u,this.onChangeCallback(),this},multiplyVector3:function(e){return o.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,o=this._z,i=this._w,a=i*e._w+n*e._x+r*e._y+o*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=i,this._x=n,this._y=r,this._z=o,this;var s=Math.acos(a),u=Math.sqrt(1-a*a);if(Math.abs(u)<.001)return this._w=.5*(i+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(o+this._z),this;var l=Math.sin((1-t)*s)/u,c=Math.sin(t*s)/u;return this._w=i*l+this._w*c,this._x=n*l+this._x*c,this._y=r*l+this._y*c,this._z=o*l+this._z*c,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new o.Quaternion(this._x,this._y,this._z,this._w)}},o.Quaternion.slerp=function(e,t,n,r){return n.copy(e).slerp(t,r)},o.Vector2=function(e,t){this.x=e||0,this.y=t||0},o.Vector2.prototype={constructor:o.Vector2,set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(o.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},sub:function(e,t){return void 0!==t?(o.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t}else this.x=0,this.y=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new o.Vector2,t=new o.Vector2),e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this},clone:function(){return new o.Vector2(this.x,this.y)}},o.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},o.Vector3.prototype={constructor:o.Vector3,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(o.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},sub:function(e,t){return void 0!==t?(o.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(o.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return t instanceof o.Euler==!1&&o.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new o.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,n){return void 0===e&&(e=new o.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,n)),this}}(),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*r,this.y=o[1]*t+o[4]*n+o[7]*r,this.z=o[2]*t+o[5]*n+o[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12],this.y=o[1]*t+o[5]*n+o[9]*r+o[13],this.z=o[2]*t+o[6]*n+o[10]*r+o[14],this},applyProjection:function(e){var t=this.x,n=this.y,r=this.z,o=e.elements,i=1/(o[3]*t+o[7]*n+o[11]*r+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*r+o[12])*i,this.y=(o[1]*t+o[5]*n+o[9]*r+o[13])*i,this.z=(o[2]*t+o[6]*n+o[10]*r+o[14])*i,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,o=e.x,i=e.y,a=e.z,s=e.w,u=s*t+i*r-a*n,l=s*n+a*t-o*r,c=s*r+o*n-i*t,h=-o*t-i*n-a*r;return this.x=u*s+h*-o+l*-a-c*-i,this.y=l*s+h*-i+c*-o-u*-a,this.z=c*s+h*-a+u*-i-l*-o,this},project:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,n=this.y,r=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r,this.y=o[1]*t+o[5]*n+o[9]*r,this.z=o[2]*t+o[6]*n+o[10]*r,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this.zt.z&&(this.z=t.z),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new o.Vector3,t=new o.Vector3),e.set(n,n,n),t.set(r,r,r),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},cross:function(e,t){if(void 0!==t)return o.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var n=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-n*e.z,this.z=n*e.y-r*e.x,this},crossVectors:function(e,t){var n=e.x,r=e.y,o=e.z,i=t.x,a=t.y,s=t.z;return this.x=r*s-o*a,this.y=o*i-n*s,this.z=n*a-r*i,this},projectOnVector:function(){var e,t;return function(n){return void 0===e&&(e=new o.Vector3),e.copy(n).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new o.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new o.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/(this.length()*e.length());return Math.acos(o.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},setEulerFromRotationMatrix:function(e,t){o.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(e,t){o.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return o.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return o.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return o.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),n=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),r=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){var n=4*e,r=t.elements; +return this.x=r[n],this.y=r[n+1],this.z=r[n+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this},clone:function(){return new o.Vector3(this.x,this.y,this.z)}},o.Vector4=function(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1},o.Vector4.prototype={constructor:o.Vector4,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(o.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},sub:function(e,t){return void 0!==t?(o.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,o=this.w,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r+i[12]*o,this.y=i[1]*t+i[5]*n+i[9]*r+i[13]*o,this.z=i[2]*t+i[6]*n+i[10]*r+i[14]*o,this.w=i[3]*t+i[7]*n+i[11]*r+i[15]*o,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t,this.w*=t}else this.x=0,this.y=0,this.z=0,this.w=1;return this},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,o,i=.01,a=.1,s=e.elements,u=s[0],l=s[4],c=s[8],h=s[1],p=s[5],d=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(l-h)y&&g>_?g_?ye.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this.w>e.w&&(this.w=e.w),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this.zt.z&&(this.z=t.z),this.wt.w&&(this.w=t.w),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new o.Vector4,t=new o.Vector4),e.set(n,n,n,n),t.set(r,r,r,r),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this},clone:function(){return new o.Vector4(this.x,this.y,this.z,this.w)}},o.Euler=function(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||o.Euler.DefaultOrder},o.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],o.Euler.DefaultOrder="XYZ",o.Euler.prototype={constructor:o.Euler,_x:0,_y:0,_z:0,_order:o.Euler.DefaultOrder,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=o.Math.clamp,i=e.elements,a=i[0],s=i[4],u=i[8],l=i[1],c=i[5],h=i[9],p=i[2],d=i[6],f=i[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(d,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(u,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-p,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-p,f),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,a))):"ZYX"===t?(this._y=Math.asin(-r(p,-1,1)),Math.abs(p)<.99999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-s,c))):"YZX"===t?(this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(u,f))):"XZY"===t?(this._z=Math.asin(-r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(d,c),this._y=Math.atan2(u,a)):(this._x=Math.atan2(-h,f),this._y=0)):o.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,n!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,n,r){return void 0===e&&(e=new o.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,r),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new o.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new o.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new o.Euler(this._x,this._y,this._z,this._order)}},o.Line3=function(e,t){this.start=void 0!==e?e:new o.Vector3,this.end=void 0!==t?t:new o.Vector3},o.Line3.prototype={constructor:o.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new o.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new o.Vector3;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var n=t||new o.Vector3;return this.delta(n).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new o.Vector3,t=new o.Vector3;return function(n,r){e.subVectors(n,this.start),t.subVectors(this.end,this.start);var i=t.dot(t),a=t.dot(e),s=a/i;return r&&(s=o.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t),i=n||new o.Vector3;return this.delta(i).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)},clone:function(){return(new o.Line3).copy(this)}},o.Box2=function(e,t){this.min=void 0!==e?e:new o.Vector2(1/0,1/0),this.max=void 0!==t?t:new o.Vector2(-(1/0),-(1/0))},o.Box2.prototype={constructor:o.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){var n=t||new o.Vector2;return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){var n=t||new o.Vector2;return n.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new o.Vector2;return function(t){var n=e.copy(t).clamp(this.min,this.max);return n.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new o.Box2).copy(this)}},o.Box3=function(e,t){this.min=void 0!==e?e:new o.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new o.Vector3(-(1/0),-(1/0),-(1/0))},o.Box3.prototype={constructor:o.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){var n=t||new o.Vector3;return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},clampPoint:function(e,t){var n=t||new o.Vector3;return n.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new o.Vector3;return function(t){var n=e.copy(t).clamp(this.min,this.max);return n.sub(t).length()}}(),getBoundingSphere:function(){var e=new o.Vector3;return function(t){var n=t||new o.Sphere;return n.center=this.center(),n.radius=.5*this.size(e).length(),n}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new o.Box3).copy(this)}},o.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&o.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},o.Matrix3.prototype={constructor:o.Matrix3,set:function(e,t,n,r,o,i,a,s,u){var l=this.elements;return l[0]=e,l[3]=t,l[6]=n,l[1]=r,l[4]=o,l[7]=i,l[2]=a,l[5]=s,l[8]=u,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(e){return o.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return o.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e=new o.Vector3;return function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=t.length);for(var o=0,i=n;o0&&o.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},o.Matrix4.prototype={constructor:o.Matrix4,set:function(e,t,n,r,o,i,a,s,u,l,c,h,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=o,v[5]=i,v[9]=a,v[13]=s,v[2]=u,v[6]=l,v[10]=c,v[14]=h,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},extractPosition:function(e){return o.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){var r=this.elements;return e.set(r[0],r[1],r[2]),t.set(r[4],r[5],r[6]),n.set(r[8],r[9],r[10]),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e=new o.Vector3;return function(t){var n=this.elements,r=t.elements,o=1/e.set(r[0],r[1],r[2]).length(),i=1/e.set(r[4],r[5],r[6]).length(),a=1/e.set(r[8],r[9],r[10]).length();return n[0]=r[0]*o,n[1]=r[1]*o,n[2]=r[2]*o,n[4]=r[4]*i,n[5]=r[5]*i,n[6]=r[6]*i,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,this}}(),makeRotationFromEuler:function(e){e instanceof o.Euler==!1&&o.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),s=Math.sin(n),u=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===e.order){var p=a*c,d=a*h,f=s*c,m=s*h;t[0]=u*c,t[4]=-u*h,t[8]=l,t[1]=d+f*l,t[5]=p-m*l,t[9]=-s*u,t[2]=m-p*l,t[6]=f+d*l,t[10]=a*u}else if("YXZ"===e.order){var v=u*c,g=u*h,y=l*c,_=l*h;t[0]=v+_*s,t[4]=y*s-g,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-s,t[2]=g*s-y,t[6]=_+v*s,t[10]=a*u}else if("ZXY"===e.order){var v=u*c,g=u*h,y=l*c,_=l*h;t[0]=v-_*s,t[4]=-a*h,t[8]=y+g*s,t[1]=g+y*s,t[5]=a*c,t[9]=_-v*s,t[2]=-a*l,t[6]=s,t[10]=a*u}else if("ZYX"===e.order){var p=a*c,d=a*h,f=s*c,m=s*h;t[0]=u*c,t[4]=f*l-d,t[8]=p*l+m,t[1]=u*h,t[5]=m*l+p,t[9]=d*l-f,t[2]=-l,t[6]=s*u,t[10]=a*u}else if("YZX"===e.order){var b=a*u,x=a*l,w=s*u,E=s*l;t[0]=u*c,t[4]=E-b*h,t[8]=w*h+x,t[1]=h,t[5]=a*c,t[9]=-s*c,t[2]=-l*c,t[6]=x*h+w,t[10]=b-E*h}else if("XZY"===e.order){var b=a*u,x=a*l,w=s*u,E=s*l;t[0]=u*c,t[4]=-h,t[8]=l*c,t[1]=b*h+E,t[5]=a*c,t[9]=x*h-w,t[2]=w*h-x,t[6]=s*c,t[10]=E*h+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},setRotationFromQuaternion:function(e){return o.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,r=e.y,o=e.z,i=e.w,a=n+n,s=r+r,u=o+o,l=n*a,c=n*s,h=n*u,p=r*s,d=r*u,f=o*u,m=i*a,v=i*s,g=i*u;return t[0]=1-(p+f),t[4]=c-g,t[8]=h+v,t[1]=c+g,t[5]=1-(l+f),t[9]=d-m,t[2]=h-v,t[6]=d+m,t[10]=1-(l+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e=new o.Vector3,t=new o.Vector3,n=new o.Vector3;return function(r,o,i){var a=this.elements;return n.subVectors(r,o).normalize(),0===n.length()&&(n.z=1),e.crossVectors(i,n).normalize(),0===e.length()&&(n.x+=1e-4,e.crossVectors(i,n).normalize()),t.crossVectors(n,e),a[0]=e.x,a[4]=t.x,a[8]=n.x,a[1]=e.y,a[5]=t.y,a[9]=n.y,a[2]=e.z,a[6]=t.z,a[10]=n.z,this}}(),multiply:function(e,t){return void 0!==t?(o.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,o=this.elements,i=n[0],a=n[4],s=n[8],u=n[12],l=n[1],c=n[5],h=n[9],p=n[13],d=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],_=n[11],b=n[15],x=r[0],w=r[4],E=r[8],M=r[12],C=r[1],S=r[5],T=r[9],A=r[13],N=r[2],P=r[6],O=r[10],R=r[14],D=r[3],L=r[7],k=r[11],F=r[15];return o[0]=i*x+a*C+s*N+u*D,o[4]=i*w+a*S+s*P+u*L,o[8]=i*E+a*T+s*O+u*k,o[12]=i*M+a*A+s*R+u*F,o[1]=l*x+c*C+h*N+p*D,o[5]=l*w+c*S+h*P+p*L,o[9]=l*E+c*T+h*O+p*k,o[13]=l*M+c*A+h*R+p*F,o[2]=d*x+f*C+m*N+v*D,o[6]=d*w+f*S+m*P+v*L,o[10]=d*E+f*T+m*O+v*k,o[14]=d*M+f*A+m*R+v*F,o[3]=g*x+y*C+_*N+b*D,o[7]=g*w+y*S+_*P+b*L,o[11]=g*E+y*T+_*O+b*k,o[15]=g*M+y*A+_*R+b*F,this},multiplyToArray:function(e,t,n){var r=this.elements;return this.multiplyMatrices(e,t),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){return o.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return o.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return o.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e=new o.Vector3;return function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=t.length);for(var o=0,i=n;o0)if(s=p*f-d,u=p*d-f,c=h*v,s>=0)if(u>=-c)if(u<=c){var g=1/v;s*=g,u*=g,l=s*(s+p*u+2*d)+u*(p*s+u+2*f)+m}else u=h,s=Math.max(0,-(p*u+d)),l=-s*s+u*(u+2*f)+m;else u=-h,s=Math.max(0,-(p*u+d)),l=-s*s+u*(u+2*f)+m;else u<=-c?(s=Math.max(0,-(-p*h+d)),u=s>0?-h:Math.min(Math.max(-h,-f),h),l=-s*s+u*(u+2*f)+m):u<=c?(s=0,u=Math.min(Math.max(-h,-f),h),l=u*(u+2*f)+m):(s=Math.max(0,-(p*h+d)),u=s>0?h:Math.min(Math.max(-h,-f),h),l=-s*s+u*(u+2*f)+m);else u=p>0?-h:h,s=Math.max(0,-(p*u+d)),l=-s*s+u*(u+2*f)+m;return i&&i.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(u).add(e),l}}(),isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius; +},intersectSphere:function(){var e=new o.Vector3;return function(t,n){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),o=e.dot(e)-r*r,i=t.radius*t.radius;if(o>i)return null;var a=Math.sqrt(i-o),s=r-a,u=r+a;return s<0&&u<0?null:s<0?this.at(u,n):this.at(s,n)}}(),isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var n=e.normal.dot(this.direction);return n*t<0},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0==t)return 0==e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},isIntersectionBox:function(){var e=new o.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(e,t){var n,r,o,i,a,s,u=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,h=this.origin;return u>=0?(n=(e.min.x-h.x)*u,r=(e.max.x-h.x)*u):(n=(e.max.x-h.x)*u,r=(e.min.x-h.x)*u),l>=0?(o=(e.min.y-h.y)*l,i=(e.max.y-h.y)*l):(o=(e.max.y-h.y)*l,i=(e.min.y-h.y)*l),n>i||o>r?null:((o>n||n!==n)&&(n=o),(i=0?(a=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(a=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||a>r?null:((a>n||n!==n)&&(n=a),(s=0?n:r,t)))},intersectTriangle:function(){var e=new o.Vector3,t=new o.Vector3,n=new o.Vector3,r=new o.Vector3;return function(o,i,a,s,u){t.subVectors(i,o),n.subVectors(a,o),r.crossVectors(t,n);var l,c=this.direction.dot(r);if(c>0){if(s)return null;l=1}else{if(!(c<0))return null;l=-1,c=-c}e.subVectors(this.origin,o);var h=l*this.direction.dot(n.crossVectors(e,n));if(h<0)return null;var p=l*this.direction.dot(t.cross(e));if(p<0)return null;if(h+p>c)return null;var d=-l*e.dot(r);return d<0?null:this.at(d/c,u)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)},clone:function(){return(new o.Ray).copy(this)}},o.Sphere=function(e,t){this.center=void 0!==e?e:new o.Vector3,this.radius=void 0!==t?t:0},o.Sphere.prototype={constructor:o.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new o.Box3;return function(t,n){var r=this.center;void 0!==n?r.copy(n):e.setFromPoints(t).center(r);for(var o=0,i=0,a=t.length;ithis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){var t=e||new o.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius},clone:function(){return(new o.Sphere).copy(this)}},o.Frustum=function(e,t,n,r,i,a){this.planes=[void 0!==e?e:new o.Plane,void 0!==t?t:new o.Plane,void 0!==n?n:new o.Plane,void 0!==r?r:new o.Plane,void 0!==i?i:new o.Plane,void 0!==a?a:new o.Plane]},o.Frustum.prototype={constructor:o.Frustum,set:function(e,t,n,r,o,i){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(o),a[5].copy(i),this},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],u=n[5],l=n[6],c=n[7],h=n[8],p=n[9],d=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(a-r,c-s,f-h,y-m).normalize(),t[1].setComponents(a+r,c+s,f+h,y+m).normalize(),t[2].setComponents(a+o,c+u,f+p,y+v).normalize(),t[3].setComponents(a-o,c-u,f-p,y-v).normalize(),t[4].setComponents(a-i,c-l,f-d,y-g).normalize(),t[5].setComponents(a+i,c+l,f+d,y+g).normalize(),this},intersectsObject:function(){var e=new o.Sphere;return function(t){var n=t.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),e.copy(n.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,o=0;o<6;o++){var i=t[o].distanceToPoint(n);if(i0?n.min.x:n.max.x,t.x=i.normal.x>0?n.max.x:n.min.x,e.y=i.normal.y>0?n.min.y:n.max.y,t.y=i.normal.y>0?n.max.y:n.min.y,e.z=i.normal.z>0?n.min.z:n.max.z,t.z=i.normal.z>0?n.max.z:n.min.z;var a=i.distanceToPoint(e),s=i.distanceToPoint(t);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0},clone:function(){return(new o.Frustum).copy(this)}},o.Plane=function(e,t){this.normal=void 0!==e?e:new o.Vector3(1,0,0),this.constant=void 0!==t?t:0},o.Plane.prototype={constructor:o.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new o.Vector3,t=new o.Vector3;return function(n,r,o){var i=e.subVectors(o,r).cross(t.subVectors(n,r)).normalize();return this.setFromNormalAndCoplanarPoint(i,n),this}}(),copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var n=this.distanceToPoint(e),r=t||new o.Vector3;return r.copy(this.normal).multiplyScalar(n)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectLine:function(){var e=new o.Vector3;return function(t,n){var r=n||new o.Vector3,i=t.delta(e),a=this.normal.dot(i);if(0!=a){var s=-(t.start.dot(this.normal)+this.constant)/a;if(!(s<0||s>1))return r.copy(i).multiplyScalar(s).add(t.start)}else if(0==this.distanceToPoint(t.start))return r.copy(t.start)}}(),coplanarPoint:function(e){var t=e||new o.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new o.Vector3,t=new o.Vector3,n=new o.Matrix3;return function(r,o){var i=o||n.getNormalMatrix(r),a=e.copy(this.normal).applyMatrix3(i),s=this.coplanarPoint(t);return s.applyMatrix4(r),this.setFromNormalAndCoplanarPoint(a,s),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant==this.constant},clone:function(){return(new o.Plane).copy(this)}},o.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),r=0;return function(){for(var o=0;o<36;o++)8==o||13==o||18==o||23==o?n[o]="-":14==o?n[o]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,n[o]=t[19==o?3&e|8:e]);return n.join("")}}(),clamp:function(e,t,n){return en?n:e},clampBottom:function(e,t){return e=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return Math.floor(this.randFloat(e,t))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},o.Spline=function(e){function t(e,t,n,r,o,i,a){var s=.5*(n-e),u=.5*(r-t);return(2*(t-n)+s+u)*a+(-3*(t-n)-2*s-u)*i+s*o+t}this.points=e;var n,r,i,a,s,u,l,c,h,p=[],d={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;tthis.points.length-2?this.points.length-1:r+1,p[3]=r>this.points.length-3?this.points.length-1:r+2,u=this.points[p[0]],l=this.points[p[1]],c=this.points[p[2]],h=this.points[p[3]],a=i*i,s=i*a,d.x=t(u.x,l.x,c.x,h.x,i,a,s),d.y=t(u.y,l.y,c.y,h.y,i,a,s),d.z=t(u.z,l.z,c.z,h.z,i,a,s),d},this.getControlPointsArray=function(){var e,t,n=this.points.length,r=[];for(e=0;e0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}}(),o.Triangle.barycoordFromPoint=function(){var e=new o.Vector3,t=new o.Vector3,n=new o.Vector3;return function(r,i,a,s,u){e.subVectors(s,i),t.subVectors(a,i),n.subVectors(r,i);var l=e.dot(e),c=e.dot(t),h=e.dot(n),p=t.dot(t),d=t.dot(n),f=l*p-c*c,m=u||new o.Vector3;if(0==f)return m.set(-2,-1,-1);var v=1/f,g=(p*h-c*d)*v,y=(l*d-c*h)*v;return m.set(1-g-y,y,g)}}(),o.Triangle.containsPoint=function(){var e=new o.Vector3;return function(t,n,r,i){var a=o.Triangle.barycoordFromPoint(t,n,r,i,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),o.Triangle.prototype={constructor:o.Triangle,set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new o.Vector3,t=new o.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new o.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return o.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new o.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return o.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return o.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)},clone:function(){return(new o.Triangle).copy(this)}},o.Clock=function(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},o.Clock.prototype={constructor:o.Clock,start:function(){this.startTime=void 0!==r.performance&&void 0!==r.performance.now?r.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=void 0!==r.performance&&void 0!==r.performance.now?r.performance.now():Date.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e}},o.EventDispatcher=function(){},o.EventDispatcher.prototype={constructor:o.EventDispatcher,apply:function(e){e.addEventListener=o.EventDispatcher.prototype.addEventListener,e.hasEventListener=o.EventDispatcher.prototype.hasEventListener,e.removeEventListener=o.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=o.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&n[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners,r=n[e];if(void 0!==r){var o=r.indexOf(t);o!==-1&&r.splice(o,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,n=t[e.type];if(void 0!==n){e.target=this;for(var r=[],o=n.length,i=0;i1){for(var t=0;t1)for(var t=0;t0){t.children=[];for(var r=0;r0,u=3==r[0].vertexNormals.length,l=new Float32Array(3*r.length*3);this.addAttribute("position",new o.BufferAttribute(l,3));var c=new Float32Array(3*r.length*3);if(this.addAttribute("normal",new o.BufferAttribute(c,3)),a!==o.NoColors){var h=new Float32Array(3*r.length*3);this.addAttribute("color",new o.BufferAttribute(h,3))}if(s===!0){var p=new Float32Array(3*r.length*2);this.addAttribute("uv",new o.BufferAttribute(p,2))}for(var d=0,f=0,m=0;d0?this.offsets:[{ +start:0,count:f.length,index:0}],v=0,g=m.length;vu.index+e){var _={start:i,count:0,index:a};s.push(_),u=_;for(var b=0;b<6;b+=2){var x=h[b+1];x>-1&&x0&&(e.data.offsets=JSON.parse(JSON.stringify(n))),null!==r&&(e.data.boundingSphere={center:r.center.toArray(),radius:r.radius}),e},clone:function(){var e=new o.BufferGeometry;for(var t in this.attributes){var n=this.attributes[t];e.addAttribute(t,n.clone())}for(var r=0,i=this.offsets.length;r0)for(var h=0;h0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new o.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new o.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e instanceof o.Geometry==!1)return void o.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var r,i=this.vertices.length,a=this.vertices,s=e.vertices,u=this.faces,l=e.faces,c=this.faceVertexUvs[0],h=e.faceVertexUvs[0];void 0===n&&(n=0),void 0!==t&&(r=(new o.Matrix3).getNormalMatrix(t));for(var p=0,d=s.length;p=0;n--){var v=d[n];for(this.faces.splice(v,1),a=0,s=this.faceVertexUvs.length;a0,w=g.vertexNormals.length>0,E=1!==g.color.r||1!==g.color.g||1!==g.color.b,M=g.vertexColors.length>0,C=0;if(C=e(C,0,0),C=e(C,1,y),C=e(C,2,_),C=e(C,3,b),C=e(C,4,x),C=e(C,5,w),C=e(C,6,E),C=e(C,7,M),c.push(C),c.push(g.a,g.b,g.c),b){var S=this.faceVertexUvs[0][u];c.push(r(S[0]),r(S[1]),r(S[2]))}if(x&&c.push(t(g.normal)),w){var T=g.vertexNormals;c.push(t(T[0]),t(T[1]),t(T[2]))}if(E&&c.push(n(g.color)),M){var A=g.vertexColors;c.push(n(A[0]),n(A[1]),n(A[2]))}}return o.data={},o.data.vertices=s,o.data.normals=h,d.length>0&&(o.data.colors=d),m.length>0&&(o.data.uvs=[m]),o.data.faces=c,o},clone:function(){for(var e=new o.Geometry,t=this.vertices,n=0,r=t.length;n1?e.skinWeights[n+1]:0,u=t>2?e.skinWeights[n+2]:0,l=t>3?e.skinWeights[n+3]:0;a.skinWeights.push(new o.Vector4(i,s,u,l))}if(e.skinIndices)for(var n=0,r=e.skinIndices.length;n1?e.skinIndices[n+1]:0,p=t>2?e.skinIndices[n+2]:0,d=t>3?e.skinIndices[n+3]:0;a.skinIndices.push(new o.Vector4(c,h,p,d))}a.bones=e.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&o.warn("THREE.JSONLoader: When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match."),a.animation=e.animation,a.animations=e.animations}function i(t){if(void 0!==e.morphTargets){var n,r,i,s,u,l;for(n=0,r=e.morphTargets.length;n0){var i=new o.LoadingManager(t),a=new o.ImageLoader(i);a.setCrossOrigin(this.crossOrigin);for(var s=function(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)})},u=0,l=e.length;us)){var S=t.origin.distanceTo(p);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:w,offsetIndex:y,face:null,faceIndex:null,object:this})}}}else for(var v=f.position.array,w=0;ws)){var S=t.origin.distanceTo(p);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else if(u instanceof o.Geometry)for(var T=u.vertices,A=T.length,w=0;ws)){var S=t.origin.distanceTo(p);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}}}(),o.Line.prototype.clone=function(e){return void 0===e&&(e=new o.Line(this.geometry,this.material,this.mode)),o.Object3D.prototype.clone.call(this,e),e},o.Mesh=function(e,t){o.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new o.Geometry,this.material=void 0!==t?t:new o.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},o.Mesh.prototype=Object.create(o.Object3D.prototype),o.Mesh.prototype.constructor=o.Mesh,o.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;es.far||u.push({distance:T,point:S,face:new o.Face3(h,p,d,o.Triangle.normal(r,i,a)),faceIndex:null,object:this})}}}else for(var g=f.position.array,M=0,A=0,C=g.length;Ms.far||u.push({distance:T,point:S,face:new o.Face3(h,p,d,o.Triangle.normal(r,i,a)),faceIndex:null,object:this})}}}else if(l instanceof o.Geometry)for(var h,p,d,N=this.material instanceof o.MeshFaceMaterial,P=N===!0?this.material.materials:null,m=s.precision,O=l.vertices,R=0,D=l.faces.length;Rs.far||u.push({distance:T,point:S,face:L,faceIndex:R,object:this})}}}}}(),o.Mesh.prototype.clone=function(e,t){return void 0===e&&(e=new o.Mesh(this.geometry,this.material)),o.Object3D.prototype.clone.call(this,e,t),e},o.Bone=function(e){o.Object3D.call(this),this.type="Bone",this.skin=e},o.Bone.prototype=Object.create(o.Object3D.prototype),o.Bone.prototype.constructor=o.Bone,o.Skeleton=function(e,t,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new o.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var r;r=this.bones.length>256?64:this.bones.length>64?32:this.bones.length>16?16:8,this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new o.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,o.RGBAFormat,o.FloatType),this.boneTexture.minFilter=o.NearestFilter,this.boneTexture.magFilter=o.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{o.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var i=0,a=this.bones.length;i1){var u=s[1];n[u]||(n[u]={start:1/0,end:-(1/0)});var l=n[u];ol.end&&(l.end=o),t||(t=u)}}e.firstAnimation=t},o.MorphAnimMesh.prototype.setAnimationLabel=function(e,t,n){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[e]={start:t,end:n}},o.MorphAnimMesh.prototype.playAnimation=function(e,t){var n=this.geometry.animations[e];n?(this.setFrameRange(n.start,n.end),this.duration=1e3*((n.end-n.start)/t),this.time=0):o.warn("THREE.MorphAnimMesh: animation["+e+"] undefined in .playAnimation()")},o.MorphAnimMesh.prototype.updateAnimation=function(e){var t=this.duration/this.length;this.time+=this.direction*e,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var n=this.startKeyframe+o.Math.clamp(Math.floor(this.time/t),0,this.length-1);n!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[n]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=n);var r=this.time%t/t;this.directionBackwards&&(r=1-r),this.morphTargetInfluences[this.currentKeyframe]=r,this.morphTargetInfluences[this.lastKeyframe]=1-r},o.MorphAnimMesh.prototype.interpolateTargets=function(e,t,n){for(var r=this.morphTargetInfluences,o=0,i=r.length;o-1&&(r[e]=1-n),t>-1&&(r[t]=n)},o.MorphAnimMesh.prototype.clone=function(e){return void 0===e&&(e=new o.MorphAnimMesh(this.geometry,this.material)),e.duration=this.duration,e.mirroredLoop=this.mirroredLoop,e.time=this.time,e.lastKeyframe=this.lastKeyframe,e.currentKeyframe=this.currentKeyframe,e.direction=this.direction,e.directionBackwards=this.directionBackwards,o.Mesh.prototype.clone.call(this,e),e},o.LOD=function(){o.Object3D.call(this),this.objects=[]},o.LOD.prototype=Object.create(o.Object3D.prototype),o.LOD.prototype.constructor=o.LOD,o.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=0;n1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var r=e.distanceTo(t);this.objects[0].object.visible=!0;for(var o=1,i=this.objects.length;o=this.objects[o].distance;o++)this.objects[o-1].object.visible=!1,this.objects[o].object.visible=!0;for(;othis.scale.x||n.push({distance:r,point:this.position,face:null,object:this})}}(),o.Sprite.prototype.clone=function(e){return void 0===e&&(e=new o.Sprite(this.material)),o.Object3D.prototype.clone.call(this,e),e},o.Particle=o.Sprite,o.LensFlare=function(e,t,n,r,i){o.Object3D.call(this),this.lensFlares=[],this.positionScreen=new o.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,r,i)},o.LensFlare.prototype=Object.create(o.Object3D.prototype),o.LensFlare.prototype.constructor=o.LensFlare,o.LensFlare.prototype.add=function(e,t,n,r,i,a){void 0===t&&(t=-1),void 0===n&&(n=0),void 0===a&&(a=1),void 0===i&&(i=new o.Color(16777215)),void 0===r&&(r=o.NormalBlending),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:e,size:t,distance:n,x:0,y:0,z:0,scale:1,rotation:1,opacity:a,color:i,blending:r})},o.LensFlare.prototype.updateLensFlares=function(){var e,t,n=this.lensFlares.length,r=2*-this.positionScreen.x,o=2*-this.positionScreen.y;for(e=0;e 0.0 ) {\n\t return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n\t}\n\treturn 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\n",o.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",o.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack += ambientLightColor;\n\n#endif\n",o.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n\n#endif\n",o.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n\tvec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",o.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif",o.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n\t#endif\n\n#endif\n";o.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif";o.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif",o.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n\t#endif\n\n#else\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\ttotalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\ttotalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\ttotalDiffuseLight += hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\n#ifdef METAL\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n", +o.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif",o.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif",o.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n",o.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",o.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n",o.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n",o.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif",o.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif",o.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif",o.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\n\tdiffuseColor *= texelColor;\n\n#endif",o.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\n\n#endif",o.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",o.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",o.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\tvColor.xyz = inputToLinear( color.xyz );\n\n#endif",o.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n",o.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n",o.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n",o.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif",o.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n",o.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n",o.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",o.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif",o.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif",o.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif",o.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif",o.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n\t\tfogFactor = whiteCompliment( fogFactor );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",o.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",o.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n\tvec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n\tvec3 objectNormal = morphedNormal;\n\n#else\n\n\tvec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",o.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n",o.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",o.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",o.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\toutgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif",o.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",o.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif",o.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif",o.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n",o.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n\tshadowColor = inputToLinear( shadowColor );\n\n\toutgoingLight = outgoingLight * shadowColor;\n\n#endif\n",o.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#elif defined( USE_MORPHTARGETS )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n#endif\n",o.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n#endif",o.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",o.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif",o.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",o.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",o.UniformsUtils={merge:function(e){for(var t={},n=0;n dashSize ) {","\t\tdiscard;","\t}","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",o.ShaderChunk.logdepthbuf_fragment,o.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",o.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[o.ShaderChunk.common,o.ShaderChunk.morphtarget_pars_vertex,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",o.ShaderChunk.morphtarget_vertex,o.ShaderChunk.default_vertex,o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",o.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;","\t#else","\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;","\t#endif","\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );","\tgl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",o.ShaderChunk.common,o.ShaderChunk.morphtarget_pars_vertex,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvNormal = normalize( normalMatrix * normal );",o.ShaderChunk.morphtarget_vertex,o.ShaderChunk.default_vertex,o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",o.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvWorldPosition = transformDirection( position, modelMatrix );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",o.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvWorldPosition = transformDirection( position, modelMatrix );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",o.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[o.ShaderChunk.common,o.ShaderChunk.morphtarget_pars_vertex,o.ShaderChunk.skinning_pars_vertex,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",o.ShaderChunk.skinbase_vertex,o.ShaderChunk.morphtarget_vertex,o.ShaderChunk.skinning_vertex,o.ShaderChunk.default_vertex,o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {","\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );","\tres -= res.xxyz * bit_mask;","\treturn res;","}","void main() {",o.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );","\t#else","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );","\t#endif","}"].join("\n")}},o.WebGLRenderer=function(e){function t(e){e.__webglVertexBuffer=Oe.createBuffer(),e.__webglColorBuffer=Oe.createBuffer(),Re.info.memory.geometries++}function n(e){e.__webglVertexBuffer=Oe.createBuffer(),e.__webglColorBuffer=Oe.createBuffer(),e.__webglLineDistanceBuffer=Oe.createBuffer(),Re.info.memory.geometries++}function r(e){e.__webglVertexBuffer=Oe.createBuffer(),e.__webglNormalBuffer=Oe.createBuffer(),e.__webglTangentBuffer=Oe.createBuffer(),e.__webglColorBuffer=Oe.createBuffer(),e.__webglUVBuffer=Oe.createBuffer(),e.__webglUV2Buffer=Oe.createBuffer(),e.__webglSkinIndicesBuffer=Oe.createBuffer(),e.__webglSkinWeightsBuffer=Oe.createBuffer(),e.__webglFaceBuffer=Oe.createBuffer(),e.__webglLineBuffer=Oe.createBuffer();var t=e.numMorphTargets;if(t){e.__webglMorphTargetsBuffers=[];for(var n=0,r=t;n1&&(e.__uv2Array=new Float32Array(2*o)),n.hasTangents&&(e.__tangentArray=new Float32Array(4*o)),t.geometry.skinWeights.length&&t.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*o),e.__skinWeightArray=new Float32Array(4*o));var u=null!==et.get("OES_element_index_uint")&&i>21845?Uint32Array:Uint16Array;e.__typeArray=u,e.__faceArray=new u(3*i),e.__lineArray=new u(2*a);var c=e.numMorphTargets;if(c){e.__morphTargetsArrays=[];for(var h=0,p=c;h0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),Oe.bufferData(Oe.ARRAY_BUFFER,fe,n),Oe.bindBuffer(Oe.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),Oe.bufferData(Oe.ARRAY_BUFFER,me,n))}if(Te){for(a=0,s=Pe.length;a0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,e.__webglColorBuffer),Oe.bufferData(Oe.ARRAY_BUFFER,de,n))}if(Se&&xe.hasTangents){for(a=0,s=Pe.length;a0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,e.__webglUVBuffer),Oe.bufferData(Oe.ARRAY_BUFFER,le,n))}if(Me&&Le){for(a=0,s=Pe.length;a0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,e.__webglUV2Buffer),Oe.bufferData(Oe.ARRAY_BUFFER,ce,n))}if(Ee){for(a=0,s=Pe.length;a=0){var h=o[l];if(void 0!==h){var p=h.itemSize;Oe.bindBuffer(Oe.ARRAY_BUFFER,h.buffer),$e.enableAttribute(c),Oe.vertexAttribPointer(c,p,Oe.FLOAT,!1,0,r*p*4)}else void 0!==e.defaultAttributeValues&&(2===e.defaultAttributeValues[l].length?Oe.vertexAttrib2fv(c,e.defaultAttributeValues[l]):3===e.defaultAttributeValues[l].length&&Oe.vertexAttrib3fv(c,e.defaultAttributeValues[l]))}}$e.disableUnusedAttributes()}function m(e,t,n){var r=e.program.attributes;if(n.morphTargetBase!==-1&&r.position>=0?(Oe.bindBuffer(Oe.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[n.morphTargetBase]),$e.enableAttribute(r.position),Oe.vertexAttribPointer(r.position,3,Oe.FLOAT,!1,0,0)):r.position>=0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,t.__webglVertexBuffer),$e.enableAttribute(r.position),Oe.vertexAttribPointer(r.position,3,Oe.FLOAT,!1,0,0)),n.morphTargetForcedOrder.length)for(var o,i=0,a=n.morphTargetForcedOrder,s=n.morphTargetInfluences;i=0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[a[i]]),$e.enableAttribute(o),Oe.vertexAttribPointer(o,3,Oe.FLOAT,!1,0,0)),o=r["morphNormal"+i],o>=0&&e.morphNormals&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[a[i]]),$e.enableAttribute(o),Oe.vertexAttribPointer(o,3,Oe.FLOAT,!1,0,0)),n.__webglMorphTargetInfluences[i]=s[a[i]],i++;else{var u=[],s=n.morphTargetInfluences,l=n.geometry.morphTargets;s.length>l.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),s.length=l.length);for(var c=0,h=s.length;ce.numSupportedMorphTargets?(u.sort(y),u.length=e.numSupportedMorphTargets):u.length>e.numSupportedMorphNormals?u.sort(y):0===u.length&&u.push([0,0]);for(var o,i=0,d=e.numSupportedMorphTargets;i=0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[f]),$e.enableAttribute(o),Oe.vertexAttribPointer(o,3,Oe.FLOAT,!1,0,0)),o=r["morphNormal"+i],o>=0&&e.morphNormals&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[f]),$e.enableAttribute(o),Oe.vertexAttribPointer(o,3,Oe.FLOAT,!1,0,0)),n.__webglMorphTargetInfluences[i]=s[f]}else n.__webglMorphTargetInfluences[i]=0}null!==e.program.uniforms.morphTargetInfluences&&Oe.uniform1fv(e.program.uniforms.morphTargetInfluences,n.__webglMorphTargetInfluences)}function v(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function g(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function y(e,t){return t[0]-e[0]}function _(e){if(e.visible!==!1){if(e instanceof o.Scene||e instanceof o.Group);else if(M(e),e instanceof o.Light)Me.push(e);else if(e instanceof o.Sprite)Ne.push(e);else if(e instanceof o.LensFlare)Pe.push(e);else{var t=Ce[e.id];if(t&&(e.frustumCulled===!1||qe.intersectsObject(e)===!0))for(var n=0,r=t.length;no&&(i[d].counter+=1,n=i[d].hash+"_"+i[d].counter,n in u||(r={id:Ot++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:a,numMorphNormals:s},u[n]=r,l.push(r))),u[n].faces3.push(c),u[n].vertices+=3}return l}function S(e,t){var n=e.material,i=!1;void 0!==Pt[t.id]&&t.groupsNeedUpdate!==!0||(delete Ce[e.id],Pt[t.id]=C(t,n instanceof o.MeshFaceMaterial),t.groupsNeedUpdate=!1);for(var a=Pt[t.id],s=0,l=a.length;s=0;n--)e[n].object===t&&e.splice(n,1)}function L(e,t,n,r){e.addEventListener("dispose",Mt);var i=Rt[e.type];if(i){var a=o.ShaderLib[i];e.__webglShader={uniforms:o.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}}else e.__webglShader={uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};var s=le(t),u=ce(t),l=ue(r),c={precision:fe,supportsVertexTextures:ut,map:!!e.map,envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,lightMap:!!e.lightMap,bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,combine:e.combine,vertexColors:e.vertexColors,fog:n,useFog:e.fog,fogExp:n instanceof o.FogExp2,flatShading:e.shading===o.FlatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:xe,skinning:e.skinning,maxBones:l,useVertexTexture:lt&&r&&r.skeleton&&r.skeleton.useVertexTexture,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:Re.maxMorphTargets,maxMorphNormals:Re.maxMorphNormals,maxDirLights:s.directional,maxPointLights:s.point,maxSpotLights:s.spot,maxHemiLights:s.hemi,maxShadows:u,shadowMapEnabled:Re.shadowMapEnabled&&r.receiveShadow&&u>0,shadowMapType:Re.shadowMapType,shadowMapDebug:Re.shadowMapDebug,shadowMapCascade:Re.shadowMapCascade,alphaTest:e.alphaTest,metal:e.metal,wrapAround:e.wrapAround,doubleSided:e.side===o.DoubleSide,flipSided:e.side===o.BackSide},h=[];if(i?h.push(i):(h.push(e.fragmentShader),h.push(e.vertexShader)),void 0!==e.defines)for(var p in e.defines)h.push(p),h.push(e.defines[p]);for(var p in c)h.push(p),h.push(c[p]);for(var d,f=h.join(),m=0,v=De.length;m=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;var _,b="morphNormal";for(x=0;x=0&&e.numSupportedMorphNormals++}e.uniformsList=[];for(var w in e.__webglShader.uniforms){var E=e.program.uniforms[w];E&&e.uniformsList.push([e.__webglShader.uniforms[w],E])}}function k(e){e.transparent===!0?$e.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha):$e.setBlending(o.NoBlending),$e.setDepthTest(e.depthTest),$e.setDepthWrite(e.depthWrite),$e.setColorWrite(e.colorWrite),$e.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function F(e,t,n,r,i){Ue=0,r.needsUpdate&&(r.program&&Nt(r),L(r,t,n,i),r.needsUpdate=!1),r.morphTargets&&(i.__webglMorphTargetInfluences||(i.__webglMorphTargetInfluences=new Float32Array(Re.maxMorphTargets)));var a=!1,s=!1,u=!1,l=r.program,c=l.uniforms,h=r.__webglShader.uniforms;if(l.id!==Le&&(Oe.useProgram(l.program),Le=l.id,a=!0,s=!0,u=!0),r.id!==Fe&&(Fe===-1&&(u=!0),Fe=r.id,s=!0),(a||e!==Ve)&&(Oe.uniformMatrix4fv(c.projectionMatrix,!1,e.projectionMatrix.elements),xe&&Oe.uniform1f(c.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==Ve&&(Ve=e),(r instanceof o.ShaderMaterial||r instanceof o.MeshPhongMaterial||r.envMap)&&null!==c.cameraPosition&&(Ye.setFromMatrixPosition(e.matrixWorld),Oe.uniform3f(c.cameraPosition,Ye.x,Ye.y,Ye.z)),(r instanceof o.MeshPhongMaterial||r instanceof o.MeshLambertMaterial||r instanceof o.MeshBasicMaterial||r instanceof o.ShaderMaterial||r.skinning)&&null!==c.viewMatrix&&Oe.uniformMatrix4fv(c.viewMatrix,!1,e.matrixWorldInverse.elements)),r.skinning)if(i.bindMatrix&&null!==c.bindMatrix&&Oe.uniformMatrix4fv(c.bindMatrix,!1,i.bindMatrix.elements),i.bindMatrixInverse&&null!==c.bindMatrixInverse&&Oe.uniformMatrix4fv(c.bindMatrixInverse,!1,i.bindMatrixInverse.elements),lt&&i.skeleton&&i.skeleton.useVertexTexture){if(null!==c.boneTexture){var p=Y();Oe.uniform1i(c.boneTexture,p),Re.setTexture(i.skeleton.boneTexture,p)}null!==c.boneTextureWidth&&Oe.uniform1i(c.boneTextureWidth,i.skeleton.boneTextureWidth),null!==c.boneTextureHeight&&Oe.uniform1i(c.boneTextureHeight,i.skeleton.boneTextureHeight)}else i.skeleton&&i.skeleton.boneMatrices&&null!==c.boneGlobalMatrices&&Oe.uniformMatrix4fv(c.boneGlobalMatrices,!1,i.skeleton.boneMatrices);return s&&(n&&r.fog&&B(h,n),(r instanceof o.MeshPhongMaterial||r instanceof o.MeshLambertMaterial||r.lights)&&(Qe&&(u=!0,J(t),Qe=!1),u?(W(h,Ze),G(h,!0)):G(h,!1)),(r instanceof o.MeshBasicMaterial||r instanceof o.MeshLambertMaterial||r instanceof o.MeshPhongMaterial)&&I(h,r),r instanceof o.LineBasicMaterial?V(h,r):r instanceof o.LineDashedMaterial?(V(h,r),U(h,r)):r instanceof o.PointCloudMaterial?j(h,r):r instanceof o.MeshPhongMaterial?z(h,r):r instanceof o.MeshLambertMaterial?H(h,r):r instanceof o.MeshDepthMaterial?(h.mNear.value=e.near,h.mFar.value=e.far,h.opacity.value=r.opacity):r instanceof o.MeshNormalMaterial&&(h.opacity.value=r.opacity),i.receiveShadow&&!r._shadowPass&&q(h,t),K(r.uniformsList)),X(c,i),null!==c.modelMatrix&&Oe.uniformMatrix4fv(c.modelMatrix,!1,i.matrixWorld.elements),l}function I(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,e.map.value=t.map,e.lightMap.value=t.lightMap,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));var n;if(t.map?n=t.map:t.specularMap?n=t.specularMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.alphaMap&&(n=t.alphaMap),void 0!==n){var r=n.offset,i=n.repeat;e.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof o.WebGLRenderTargetCube?1:-1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function V(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function U(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function j(e,t){if(e.psColor.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size,e.scale.value=he.height/2,e.map.value=t.map,null!==t.map){var n=t.map.offset,r=t.map.repeat;e.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function B(e,t){e.fogColor.value=t.color,t instanceof o.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof o.FogExp2&&(e.fogDensity.value=t.density)}function z(e,t){e.shininess.value=t.shininess,e.emissive.value=t.emissive,e.specular.value=t.specular,t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function H(e,t){e.emissive.value=t.emissive,t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function W(e,t){e.ambientLightColor.value=t.ambient,e.directionalLightColor.value=t.directional.colors,e.directionalLightDirection.value=t.directional.positions,e.pointLightColor.value=t.point.colors,e.pointLightPosition.value=t.point.positions,e.pointLightDistance.value=t.point.distances,e.pointLightDecay.value=t.point.decays,e.spotLightColor.value=t.spot.colors,e.spotLightPosition.value=t.spot.positions,e.spotLightDistance.value=t.spot.distances,e.spotLightDirection.value=t.spot.directions,e.spotLightAngleCos.value=t.spot.anglesCos,e.spotLightExponent.value=t.spot.exponents,e.spotLightDecay.value=t.spot.decays,e.hemisphereLightSkyColor.value=t.hemi.skyColors,e.hemisphereLightGroundColor.value=t.hemi.groundColors,e.hemisphereLightDirection.value=t.hemi.positions}function G(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLightColor.needsUpdate=t,e.directionalLightDirection.needsUpdate=t,e.pointLightColor.needsUpdate=t,e.pointLightPosition.needsUpdate=t,e.pointLightDistance.needsUpdate=t,e.pointLightDecay.needsUpdate=t,e.spotLightColor.needsUpdate=t,e.spotLightPosition.needsUpdate=t,e.spotLightDistance.needsUpdate=t,e.spotLightDirection.needsUpdate=t,e.spotLightAngleCos.needsUpdate=t,e.spotLightExponent.needsUpdate=t,e.spotLightDecay.needsUpdate=t,e.hemisphereLightSkyColor.needsUpdate=t,e.hemisphereLightGroundColor.needsUpdate=t,e.hemisphereLightDirection.needsUpdate=t}function q(e,t){if(e.shadowMatrix)for(var n=0,r=0,i=t.length;r=ot&&o.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+ot),Ue+=1,e}function K(e){for(var t,n,r,i=0,a=e.length;i1||t.__currentAnisotropy)&&(Oe.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,Re.getMaxAnisotropy())),t.__currentAnisotropy=t.anisotropy)}function ee(e,t){if(e.width>t||e.height>t){var n=t/Math.max(e.width,e.height),r=document.createElement("canvas");r.width=Math.floor(e.width*n),r.height=Math.floor(e.height*n);var i=r.getContext("2d");return i.drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),o.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height,e),r}return e}function te(e,t){if(6===e.image.length)if(e.needsUpdate){e.image.__webglTextureCube||(e.addEventListener("dispose",wt),e.image.__webglTextureCube=Oe.createTexture(),Re.info.memory.textures++),Oe.activeTexture(Oe.TEXTURE0+t),Oe.bindTexture(Oe.TEXTURE_CUBE_MAP,e.image.__webglTextureCube),Oe.pixelStorei(Oe.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var n=e instanceof o.CompressedTexture,r=e.image[0]instanceof o.DataTexture,i=[],a=0;a<6;a++)!Re.autoScaleCubemaps||n||r?i[a]=r?e.image[a].image:e.image[a]:i[a]=ee(e.image[a],st);var s=i[0],u=o.Math.isPowerOfTwo(s.width)&&o.Math.isPowerOfTwo(s.height),l=se(e.format),c=se(e.type);$(Oe.TEXTURE_CUBE_MAP,e,u);for(var a=0;a<6;a++)if(n)for(var h,p=i[a].mipmaps,d=0,f=p.length;d-1?Oe.compressedTexImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+a,d,l,h.width,h.height,0,h.data):o.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):Oe.texImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+a,d,l,h.width,h.height,0,l,c,h.data);else r?Oe.texImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,l,i[a].width,i[a].height,0,l,c,i[a].data):Oe.texImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,l,l,c,i[a]);e.generateMipmaps&&u&&Oe.generateMipmap(Oe.TEXTURE_CUBE_MAP),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()}else Oe.activeTexture(Oe.TEXTURE0+t),Oe.bindTexture(Oe.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}function ne(e,t){Oe.activeTexture(Oe.TEXTURE0+t),Oe.bindTexture(Oe.TEXTURE_CUBE_MAP,e.__webglTexture)}function re(e,t,n){Oe.bindFramebuffer(Oe.FRAMEBUFFER,e),Oe.framebufferTexture2D(Oe.FRAMEBUFFER,Oe.COLOR_ATTACHMENT0,n,t.__webglTexture,0)}function oe(e,t){Oe.bindRenderbuffer(Oe.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(Oe.renderbufferStorage(Oe.RENDERBUFFER,Oe.DEPTH_COMPONENT16,t.width,t.height),Oe.framebufferRenderbuffer(Oe.FRAMEBUFFER,Oe.DEPTH_ATTACHMENT,Oe.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(Oe.renderbufferStorage(Oe.RENDERBUFFER,Oe.DEPTH_STENCIL,t.width,t.height),Oe.framebufferRenderbuffer(Oe.FRAMEBUFFER,Oe.DEPTH_STENCIL_ATTACHMENT,Oe.RENDERBUFFER,e)):Oe.renderbufferStorage(Oe.RENDERBUFFER,Oe.RGBA4,t.width,t.height)}function ie(e){e instanceof o.WebGLRenderTargetCube?(Oe.bindTexture(Oe.TEXTURE_CUBE_MAP,e.__webglTexture),Oe.generateMipmap(Oe.TEXTURE_CUBE_MAP),Oe.bindTexture(Oe.TEXTURE_CUBE_MAP,null)):(Oe.bindTexture(Oe.TEXTURE_2D,e.__webglTexture),Oe.generateMipmap(Oe.TEXTURE_2D),Oe.bindTexture(Oe.TEXTURE_2D,null))}function ae(e){return e===o.NearestFilter||e===o.NearestMipMapNearestFilter||e===o.NearestMipMapLinearFilter?Oe.NEAREST:Oe.LINEAR}function se(e){var t;if(e===o.RepeatWrapping)return Oe.REPEAT;if(e===o.ClampToEdgeWrapping)return Oe.CLAMP_TO_EDGE;if(e===o.MirroredRepeatWrapping)return Oe.MIRRORED_REPEAT;if(e===o.NearestFilter)return Oe.NEAREST;if(e===o.NearestMipMapNearestFilter)return Oe.NEAREST_MIPMAP_NEAREST;if(e===o.NearestMipMapLinearFilter)return Oe.NEAREST_MIPMAP_LINEAR;if(e===o.LinearFilter)return Oe.LINEAR;if(e===o.LinearMipMapNearestFilter)return Oe.LINEAR_MIPMAP_NEAREST;if(e===o.LinearMipMapLinearFilter)return Oe.LINEAR_MIPMAP_LINEAR;if(e===o.UnsignedByteType)return Oe.UNSIGNED_BYTE;if(e===o.UnsignedShort4444Type)return Oe.UNSIGNED_SHORT_4_4_4_4;if(e===o.UnsignedShort5551Type)return Oe.UNSIGNED_SHORT_5_5_5_1;if(e===o.UnsignedShort565Type)return Oe.UNSIGNED_SHORT_5_6_5;if(e===o.ByteType)return Oe.BYTE;if(e===o.ShortType)return Oe.SHORT;if(e===o.UnsignedShortType)return Oe.UNSIGNED_SHORT;if(e===o.IntType)return Oe.INT;if(e===o.UnsignedIntType)return Oe.UNSIGNED_INT;if(e===o.FloatType)return Oe.FLOAT;if(t=et.get("OES_texture_half_float"),null!==t&&e===o.HalfFloatType)return t.HALF_FLOAT_OES;if(e===o.AlphaFormat)return Oe.ALPHA;if(e===o.RGBFormat)return Oe.RGB;if(e===o.RGBAFormat)return Oe.RGBA;if(e===o.LuminanceFormat)return Oe.LUMINANCE;if(e===o.LuminanceAlphaFormat)return Oe.LUMINANCE_ALPHA;if(e===o.AddEquation)return Oe.FUNC_ADD;if(e===o.SubtractEquation)return Oe.FUNC_SUBTRACT;if(e===o.ReverseSubtractEquation)return Oe.FUNC_REVERSE_SUBTRACT;if(e===o.ZeroFactor)return Oe.ZERO;if(e===o.OneFactor)return Oe.ONE;if(e===o.SrcColorFactor)return Oe.SRC_COLOR;if(e===o.OneMinusSrcColorFactor)return Oe.ONE_MINUS_SRC_COLOR;if(e===o.SrcAlphaFactor)return Oe.SRC_ALPHA;if(e===o.OneMinusSrcAlphaFactor)return Oe.ONE_MINUS_SRC_ALPHA;if(e===o.DstAlphaFactor)return Oe.DST_ALPHA;if(e===o.OneMinusDstAlphaFactor)return Oe.ONE_MINUS_DST_ALPHA;if(e===o.DstColorFactor)return Oe.DST_COLOR;if(e===o.OneMinusDstColorFactor)return Oe.ONE_MINUS_DST_COLOR;if(e===o.SrcAlphaSaturateFactor)return Oe.SRC_ALPHA_SATURATE;if(t=et.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===o.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===o.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===o.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===o.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=et.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===o.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===o.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===o.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===o.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=et.get("EXT_blend_minmax"),null!==t){if(e===o.MinEquation)return t.MIN_EXT;if(e===o.MaxEquation)return t.MAX_EXT}return 0}function ue(e){if(lt&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var t=Oe.getParameter(Oe.MAX_VERTEX_UNIFORM_VECTORS),n=Math.floor((t-20)/4),r=n;return void 0!==e&&e instanceof o.SkinnedMesh&&(r=Math.min(e.skeleton.bones.length,r),r0,lt=ut&&et.get("OES_texture_float"),ct=Oe.getShaderPrecisionFormat(Oe.VERTEX_SHADER,Oe.HIGH_FLOAT),ht=Oe.getShaderPrecisionFormat(Oe.VERTEX_SHADER,Oe.MEDIUM_FLOAT),pt=Oe.getShaderPrecisionFormat(Oe.FRAGMENT_SHADER,Oe.HIGH_FLOAT),dt=Oe.getShaderPrecisionFormat(Oe.FRAGMENT_SHADER,Oe.MEDIUM_FLOAT),ft=function(){var e;return function(){if(void 0!==e)return e;if(e=[],et.get("WEBGL_compressed_texture_pvrtc")||et.get("WEBGL_compressed_texture_s3tc"))for(var t=Oe.getParameter(Oe.COMPRESSED_TEXTURE_FORMATS),n=0;n0&&pt.precision>0,vt=ht.precision>0&&dt.precision>0;"highp"!==fe||mt||(vt?(fe="mediump",o.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(fe="lowp",o.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==fe||vt||(fe="lowp",o.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var gt=new o.ShadowMapPlugin(this,Me,Ce,Se),yt=new o.SpritePlugin(this,Ne),_t=new o.LensFlarePlugin(this,Pe);this.getContext=function(){return Oe},this.forceContextLoss=function(){et.get("WEBGL_lose_context").loseContext()},this.supportsVertexTextures=function(){return ut},this.supportsFloatTextures=function(){return et.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return et.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return et.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return et.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return et.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return et.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=et.get("EXT_texture_filter_anisotropic");return e=null!==t?Oe.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return fe},this.getPixelRatio=function(){return de},this.setPixelRatio=function(e){de=e},this.setSize=function(e,t,n){he.width=e*de,he.height=t*de,n!==!1&&(he.style.width=e+"px",he.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,n,r){je=e*de,Be=t*de,ze=n*de,He=r*de,Oe.viewport(je,Be,ze,He)},this.setScissor=function(e,t,n,r){Oe.scissor(e*de,t*de,n*de,r*de)},this.enableScissorTest=function(e){e?Oe.enable(Oe.SCISSOR_TEST):Oe.disable(Oe.SCISSOR_TEST)},this.getClearColor=function(){return we},this.setClearColor=function(e,t){we.set(e),Ee=void 0!==t?t:1,tt(we.r,we.g,we.b,Ee)},this.getClearAlpha=function(){return Ee},this.setClearAlpha=function(e){Ee=e,tt(we.r,we.g,we.b,Ee)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=Oe.COLOR_BUFFER_BIT),(void 0===t||t)&&(r|=Oe.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=Oe.STENCIL_BUFFER_BIT),Oe.clear(r)},this.clearColor=function(){Oe.clear(Oe.COLOR_BUFFER_BIT)},this.clearDepth=function(){Oe.clear(Oe.DEPTH_BUFFER_BIT)},this.clearStencil=function(){Oe.clear(Oe.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,n,r){this.setRenderTarget(e),this.clear(t,n,r)},this.resetGLState=rt;var bt=function(e){var t=e.target;t.traverse(function(e){e.removeEventListener("remove",bt),R(e)})},xt=function(e){var t=e.target;t.removeEventListener("dispose",xt),St(t)},wt=function(e){var t=e.target;t.removeEventListener("dispose",wt),Tt(t),Re.info.memory.textures--},Et=function(e){var t=e.target;t.removeEventListener("dispose",Et),At(t),Re.info.memory.textures--},Mt=function(e){var t=e.target;t.removeEventListener("dispose",Mt),Nt(t)},Ct=function(e){for(var t=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],n=0,r=t.length;n1&&(u=!0);for(var g=0,y=v.length;g1&&(u=!0);for(var g=0,y=v.length;g=0?l&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglVertexBuffer),$e.enableAttribute(u.position),Oe.vertexAttribPointer(u.position,3,Oe.FLOAT,!1,0,0)):a.morphTargetBase&&m(r,i,a),l){if(i.__webglCustomAttributesList)for(var p=0,d=i.__webglCustomAttributesList.length;p=0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,f.buffer),$e.enableAttribute(u[f.buffer.belongsToAttribute]),Oe.vertexAttribPointer(u[f.buffer.belongsToAttribute],f.size,Oe.FLOAT,!1,0,0))}u.color>=0&&(a.geometry.colors.length>0||a.geometry.faces.length>0?(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglColorBuffer),$e.enableAttribute(u.color),Oe.vertexAttribPointer(u.color,3,Oe.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&Oe.vertexAttrib3fv(u.color,r.defaultAttributeValues.color)),u.normal>=0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglNormalBuffer),$e.enableAttribute(u.normal),Oe.vertexAttribPointer(u.normal,3,Oe.FLOAT,!1,0,0)),u.tangent>=0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglTangentBuffer),$e.enableAttribute(u.tangent),Oe.vertexAttribPointer(u.tangent,4,Oe.FLOAT,!1,0,0)),u.uv>=0&&(a.geometry.faceVertexUvs[0]?(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglUVBuffer),$e.enableAttribute(u.uv),Oe.vertexAttribPointer(u.uv,2,Oe.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&Oe.vertexAttrib2fv(u.uv,r.defaultAttributeValues.uv)),u.uv2>=0&&(a.geometry.faceVertexUvs[1]?(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglUV2Buffer),$e.enableAttribute(u.uv2),Oe.vertexAttribPointer(u.uv2,2,Oe.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&Oe.vertexAttrib2fv(u.uv2,r.defaultAttributeValues.uv2)),r.skinning&&u.skinIndex>=0&&u.skinWeight>=0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglSkinIndicesBuffer),$e.enableAttribute(u.skinIndex),Oe.vertexAttribPointer(u.skinIndex,4,Oe.FLOAT,!1,0,0),Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglSkinWeightsBuffer),$e.enableAttribute(u.skinWeight),Oe.vertexAttribPointer(u.skinWeight,4,Oe.FLOAT,!1,0,0)),u.lineDistance>=0&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.__webglLineDistanceBuffer),$e.enableAttribute(u.lineDistance),Oe.vertexAttribPointer(u.lineDistance,1,Oe.FLOAT,!1,0,0))}if($e.disableUnusedAttributes(),a instanceof o.Mesh){var v=i.__typeArray===Uint32Array?Oe.UNSIGNED_INT:Oe.UNSIGNED_SHORT;r.wireframe?($e.setLineWidth(r.wireframeLinewidth*de),l&&Oe.bindBuffer(Oe.ELEMENT_ARRAY_BUFFER,i.__webglLineBuffer),Oe.drawElements(Oe.LINES,i.__webglLineCount,v,0)):(l&&Oe.bindBuffer(Oe.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),Oe.drawElements(Oe.TRIANGLES,i.__webglFaceCount,v,0)),Re.info.render.calls++,Re.info.render.vertices+=i.__webglFaceCount,Re.info.render.faces+=i.__webglFaceCount/3}else if(a instanceof o.Line){var g=a.mode===o.LineStrip?Oe.LINE_STRIP:Oe.LINES;$e.setLineWidth(r.linewidth*de),Oe.drawArrays(g,0,i.__webglLineCount),Re.info.render.calls++}else a instanceof o.PointCloud&&(Oe.drawArrays(Oe.POINTS,0,i.__webglParticleCount),Re.info.render.calls++,Re.info.render.points+=i.__webglParticleCount)}},this.render=function(e,t,n,r){if(t instanceof o.Camera==!1)return void o.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var i=e.fog;Ie="",Fe=-1,Ve=null,Qe=!0,e.autoUpdate===!0&&e.updateMatrixWorld(),void 0===t.parent&&t.updateMatrixWorld(),e.traverse(function(e){e instanceof o.SkinnedMesh&&e.skeleton.update()}),t.matrixWorldInverse.getInverse(t.matrixWorld),Xe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),qe.setFromMatrix(Xe),Me.length=0,Te.length=0,Ae.length=0,Ne.length=0,Pe.length=0,_(e),Re.sortObjects===!0&&(Te.sort(v),Ae.sort(g)),gt.render(e,t),Re.info.render.calls=0,Re.info.render.vertices=0,Re.info.render.faces=0,Re.info.render.points=0,this.setRenderTarget(n),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var a=0,s=Se.length;a0&&n){for(var u=0,l=s.length;u-1?Oe.compressedTexImage2D(Oe.TEXTURE_2D,u,r,a.width,a.height,0,a.data):o.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Oe.texImage2D(Oe.TEXTURE_2D,u,r,a.width,a.height,0,r,i,a.data);else if(s.length>0&&n){for(var u=0,l=s.length;u0?i.gammaFactor:1,M=t(h),C=c.createProgram();s instanceof o.RawShaderMaterial?(x="",w=""):(x=["precision "+u.precision+" float;","precision "+u.precision+" int;",M,u.supportsVertexTextures?"#define VERTEX_TEXTURES":"",l.gammaInput?"#define GAMMA_INPUT":"",l.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+E,"#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_SPOT_LIGHTS "+u.maxSpotLights,"#define MAX_HEMI_LIGHTS "+u.maxHemiLights,"#define MAX_SHADOWS "+u.maxShadows,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.envMap?"#define "+_:"",u.lightMap?"#define USE_LIGHTMAP":"",u.bumpMap?"#define USE_BUMPMAP":"",u.normalMap?"#define USE_NORMALMAP":"",u.specularMap?"#define USE_SPECULARMAP":"",u.alphaMap?"#define USE_ALPHAMAP":"",u.vertexColors?"#define USE_COLOR":"",u.flatShading?"#define FLAT_SHADED":"",u.skinning?"#define USE_SKINNING":"",u.useVertexTexture?"#define BONE_TEXTURE":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.morphNormals?"#define USE_MORPHNORMALS":"",u.wrapAround?"#define WRAP_AROUND":"",u.doubleSided?"#define DOUBLE_SIDED":"",u.flipSided?"#define FLIP_SIDED":"",u.shadowMapEnabled?"#define USE_SHADOWMAP":"",u.shadowMapEnabled?"#define "+g:"",u.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",u.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",u.sizeAttenuation?"#define USE_SIZEATTENUATION":"",u.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","attribute vec2 uv2;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif",""].join("\n"),w=["precision "+u.precision+" float;","precision "+u.precision+" int;",u.bumpMap||u.normalMap||u.flatShading?"#extension GL_OES_standard_derivatives : enable":"",M,"#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_SPOT_LIGHTS "+u.maxSpotLights,"#define MAX_HEMI_LIGHTS "+u.maxHemiLights,"#define MAX_SHADOWS "+u.maxShadows,u.alphaTest?"#define ALPHATEST "+u.alphaTest:"",l.gammaInput?"#define GAMMA_INPUT":"",l.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+E,u.useFog&&u.fog?"#define USE_FOG":"",u.useFog&&u.fogExp?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.envMap?"#define "+y:"",u.envMap?"#define "+_:"",u.envMap?"#define "+b:"",u.lightMap?"#define USE_LIGHTMAP":"",u.bumpMap?"#define USE_BUMPMAP":"",u.normalMap?"#define USE_NORMALMAP":"",u.specularMap?"#define USE_SPECULARMAP":"",u.alphaMap?"#define USE_ALPHAMAP":"",u.vertexColors?"#define USE_COLOR":"",u.flatShading?"#define FLAT_SHADED":"",u.metal?"#define METAL":"",u.wrapAround?"#define WRAP_AROUND":"",u.doubleSided?"#define DOUBLE_SIDED":"",u.flipSided?"#define FLIP_SIDED":"",u.shadowMapEnabled?"#define USE_SHADOWMAP":"",u.shadowMapEnabled?"#define "+g:"",u.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",u.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",u.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var S=new o.WebGLShader(c,c.VERTEX_SHADER,x+f),T=new o.WebGLShader(c,c.FRAGMENT_SHADER,w+m);c.attachShader(C,S),c.attachShader(C,T),void 0!==v&&c.bindAttribLocation(C,0,v),c.linkProgram(C);var A=c.getProgramInfoLog(C);c.getProgramParameter(C,c.LINK_STATUS)===!1&&o.error("THREE.WebGLProgram: shader error: "+c.getError(),"gl.VALIDATE_STATUS",c.getProgramParameter(C,c.VALIDATE_STATUS),"gl.getPRogramInfoLog",A),""!==A&&o.warn("THREE.WebGLProgram: gl.getProgramInfoLog()"+A),c.deleteShader(S),c.deleteShader(T);var N=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];u.useVertexTexture?(N.push("boneTexture"),N.push("boneTextureWidth"),N.push("boneTextureHeight")):N.push("boneGlobalMatrices"),u.logarithmicDepthBuffer&&N.push("logDepthBufFC");for(var P in p)N.push(P);this.uniforms=n(c,C,N),N=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var O=0;O0;var o;o=l?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},a=n(o),s={vertex:p.getAttribLocation(a,"position"),uv:p.getAttribLocation(a,"uv")},u={renderType:p.getUniformLocation(a,"renderType"),map:p.getUniformLocation(a,"map"),occlusionMap:p.getUniformLocation(a,"occlusionMap"),opacity:p.getUniformLocation(a,"opacity"),color:p.getUniformLocation(a,"color"),scale:p.getUniformLocation(a,"scale"),rotation:p.getUniformLocation(a,"rotation"),screenPosition:p.getUniformLocation(a,"screenPosition")}};this.render=function(n,f,m,v){if(0!==t.length){var g=new o.Vector3,y=v/m,_=.5*m,b=.5*v,x=16/v,w=new o.Vector2(x*y,x),E=new o.Vector3(1,1,0),M=new o.Vector2(1,1);void 0===a&&d(),p.useProgram(a),p.enableVertexAttribArray(s.vertex),p.enableVertexAttribArray(s.uv),p.uniform1i(u.occlusionMap,0),p.uniform1i(u.map,1),p.bindBuffer(p.ARRAY_BUFFER,r),p.vertexAttribPointer(s.vertex,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(s.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,i),p.disable(p.CULL_FACE),p.depthMask(!1);for(var C=0,S=t.length;C0&&M.x0&&M.y.001&&P.scale>.001&&(E.x=P.x,E.y=P.y,E.z=P.z,x=P.size*P.scale/v,w.x=x*y,w.y=x,p.uniform3f(u.screenPosition,E.x,E.y,E.z),p.uniform2f(u.scale,w.x,w.y),p.uniform1f(u.rotation,P.rotation),p.uniform1f(u.opacity,P.opacity),p.uniform3f(u.color,P.color.r,P.color.g,P.color.b),e.state.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),e.setTexture(P.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}p.enable(p.CULL_FACE),p.enable(p.DEPTH_TEST),p.depthMask(!0),e.resetGLState()}}},o.ShadowMapPlugin=function(e,t,n,r){function i(e,t,r){if(t.visible){var o=n[t.id];if(o&&t.castShadow&&(t.frustumCulled===!1||m.intersectsObject(t)===!0))for(var a=0,s=o.length;ay.x&&(y.x=a.x),a.yy.y&&(y.y=a.y),a.zy.z&&(y.z=a.z)}n.left=g.x,n.right=y.x,n.top=y.y,n.bottom=g.y,n.updateProjectionMatrix()}function l(e){return e.material instanceof o.MeshFaceMaterial?e.material.materials[0]:e.material}var c,h,p,d,f=e.context,m=new o.Frustum,v=new o.Matrix4,g=new o.Vector3,y=new o.Vector3,_=new o.Vector3,b=[],x=o.ShaderLib.depthRGBA,w=o.UniformsUtils.clone(x.uniforms); +c=new o.ShaderMaterial({uniforms:w,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader}),h=new o.ShaderMaterial({uniforms:w,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,morphTargets:!0}),p=new o.ShaderMaterial({uniforms:w,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,skinning:!0}),d=new o.ShaderMaterial({uniforms:w,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,morphTargets:!0,skinning:!0}),c._shadowPass=!0,h._shadowPass=!0,p._shadowPass=!0,d._shadowPass=!0,this.render=function(n,g){if(e.shadowMapEnabled!==!1){var y,x,w,E,M,C,S,T,A,N,P,O,R,D=[],L=0,k=null;for(f.clearColor(1,1,1,1),f.disable(f.BLEND),f.enable(f.CULL_FACE),f.frontFace(f.CCW),e.shadowMapCullFace===o.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK),e.state.setDepthTest(!0),y=0,x=t.length;y0&&j.morphTargets,z=O instanceof o.SkinnedMesh&&j.skinning,N=O.customDepthMaterial?O.customDepthMaterial:z?B?d:p:B?h:c,e.setMaterialFaces(j),A instanceof o.BufferGeometry?e.renderBufferDirect(T,t,k,N,A,O):e.renderBuffer(T,t,k,N,A,O);for(w=0,E=r.length;w 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),h.compileShader(n),h.compileShader(r),h.attachShader(t,n),h.attachShader(t,r),h.linkProgram(t),t}function r(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var i,a,s,u,l,c,h=e.context,p=new o.Vector3,d=new o.Quaternion,f=new o.Vector3,m=function(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);i=h.createBuffer(),a=h.createBuffer(),h.bindBuffer(h.ARRAY_BUFFER,i),h.bufferData(h.ARRAY_BUFFER,e,h.STATIC_DRAW),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,a),h.bufferData(h.ELEMENT_ARRAY_BUFFER,t,h.STATIC_DRAW),s=n(),u={position:h.getAttribLocation(s,"position"),uv:h.getAttribLocation(s,"uv")},l={uvOffset:h.getUniformLocation(s,"uvOffset"),uvScale:h.getUniformLocation(s,"uvScale"),rotation:h.getUniformLocation(s,"rotation"),scale:h.getUniformLocation(s,"scale"),color:h.getUniformLocation(s,"color"),map:h.getUniformLocation(s,"map"),opacity:h.getUniformLocation(s,"opacity"),modelViewMatrix:h.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:h.getUniformLocation(s,"projectionMatrix"),fogType:h.getUniformLocation(s,"fogType"),fogDensity:h.getUniformLocation(s,"fogDensity"),fogNear:h.getUniformLocation(s,"fogNear"),fogFar:h.getUniformLocation(s,"fogFar"),fogColor:h.getUniformLocation(s,"fogColor"),alphaTest:h.getUniformLocation(s,"alphaTest")};var r=document.createElement("canvas");r.width=8,r.height=8;var p=r.getContext("2d");p.fillStyle="white",p.fillRect(0,0,8,8),c=new o.Texture(r),c.needsUpdate=!0};this.render=function(n,v){if(0!==t.length){void 0===s&&m(),h.useProgram(s),h.enableVertexAttribArray(u.position),h.enableVertexAttribArray(u.uv),h.disable(h.CULL_FACE),h.enable(h.BLEND),h.bindBuffer(h.ARRAY_BUFFER,i),h.vertexAttribPointer(u.position,2,h.FLOAT,!1,16,0),h.vertexAttribPointer(u.uv,2,h.FLOAT,!1,16,8),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,a),h.uniformMatrix4fv(l.projectionMatrix,!1,v.projectionMatrix.elements),h.activeTexture(h.TEXTURE0),h.uniform1i(l.map,0);var g=0,y=0,_=n.fog;_?(h.uniform3f(l.fogColor,_.color.r,_.color.g,_.color.b),_ instanceof o.Fog?(h.uniform1f(l.fogNear,_.near),h.uniform1f(l.fogFar,_.far),h.uniform1i(l.fogType,1),g=1,y=1):_ instanceof o.FogExp2&&(h.uniform1f(l.fogDensity,_.density),h.uniform1i(l.fogType,2),g=2,y=2)):(h.uniform1i(l.fogType,0),g=0,y=0);for(var b=0,x=t.length;ba-1?a-1:d+1,v=p-1<0?0:p-1,g=p+1>i-1?i-1:p+1,y=[],_=[0,0,l[4*(d*i+p)]/255*t];y.push([-1,0,l[4*(d*i+v)]/255*t]),y.push([-1,-1,l[4*(f*i+v)]/255*t]),y.push([0,-1,l[4*(f*i+p)]/255*t]),y.push([1,-1,l[4*(f*i+g)]/255*t]),y.push([1,0,l[4*(d*i+g)]/255*t]),y.push([1,1,l[4*(m*i+g)]/255*t]),y.push([0,1,l[4*(m*i+p)]/255*t]),y.push([-1,1,l[4*(m*i+v)]/255*t]);for(var b=[],x=y.length,w=0;w0)for(s=0;s2;){if(d--<=0)return o.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()"),t?h:l;if(a=s,p<=a&&(a=0),s=a+1,p<=s&&(s=0),u=s+1,p<=u&&(u=0),i(e,a,s,u,p,c)){var f,m,v,g,y;for(f=c[a],m=c[s],v=c[u],l.push([e[f],e[m],e[v]]),h.push([c[a],c[s],c[u]]),g=s,y=s+1;y(c-u)*(d-l)-(h-l)*(p-u))return!1;var v,g,y,_,b,x,w,E,M,C,S,T,A,N,P;for(v=p-c,g=d-h,y=u-p,_=l-d,b=c-u,x=h-l,s=0;s=-t&&N>=-t&&A>=-t))return!1;return!0};return e.Triangulate=n,e.Triangulate.area=r,e}(o.FontUtils),r._typeface_js={faces:o.FontUtils.faces,loadFace:o.FontUtils.loadFace},o.typeface_js=r._typeface_js,o.Audio=function(e){o.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.panner=this.context.createPanner(),this.panner.connect(this.gain),this.autoplay=!1,this.startTime=0,this.isPlaying=!1},o.Audio.prototype=Object.create(o.Object3D.prototype),o.Audio.prototype.constructor=o.Audio,o.Audio.prototype.load=function(e){var t=this,n=new XMLHttpRequest;return n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(e){t.context.decodeAudioData(this.response,function(e){t.source.buffer=e,t.autoplay&&t.play()})},n.send(),this},o.Audio.prototype.play=function(){if(this.isPlaying===!0)return void o.warn("THREE.Audio: Audio is already playing.");var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.connect(this.panner),e.start(0,this.startTime),this.isPlaying=!0,this.source=e},o.Audio.prototype.pause=function(){this.source.stop(),this.startTime=this.context.currentTime},o.Audio.prototype.stop=function(){this.source.stop(),this.startTime=0},o.Audio.prototype.onEnded=function(){this.isPlaying=!1},o.Audio.prototype.setLoop=function(e){this.source.loop=e},o.Audio.prototype.setRefDistance=function(e){this.panner.refDistance=e},o.Audio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},o.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},o.Audio.prototype.updateMatrixWorld=function(){var e=new o.Vector3;return function(t){o.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),o.AudioListener=function(){o.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext)},o.AudioListener.prototype=Object.create(o.Object3D.prototype),o.AudioListener.prototype.constructor=o.AudioListener,o.AudioListener.prototype.updateMatrixWorld=function(){var e=new o.Vector3,t=new o.Quaternion,n=new o.Vector3,r=new o.Vector3,i=new o.Vector3,a=new o.Vector3;return function(s){o.Object3D.prototype.updateMatrixWorld.call(this,s);var u=this.context.listener,l=this.up;this.matrixWorld.decompose(e,t,n),r.set(0,0,-1).applyQuaternion(t),i.subVectors(e,a),u.setPosition(e.x,e.y,e.z),u.setOrientation(r.x,r.y,r.z,l.x,l.y,l.z),u.setVelocity(i.x,i.y,i.z),a.copy(e)}}(),o.Curve=function(){},o.Curve.prototype.getPoint=function(e){return o.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},o.Curve.prototype.getPointAt=function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},o.Curve.prototype.getPoints=function(e){e||(e=5);var t,n=[];for(t=0;t<=e;t++)n.push(this.getPoint(t/e));return n},o.Curve.prototype.getSpacedPoints=function(e){e||(e=5);var t,n=[];for(t=0;t<=e;t++)n.push(this.getPointAt(t/e));return n},o.Curve.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},o.Curve.prototype.getLengths=function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length==e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,r=[],o=this.getPoint(0),i=0;for(r.push(0),n=1;n<=e;n++)t=this.getPoint(n/e),i+=t.distanceTo(o),r.push(i),o=t;return this.cacheArcLengths=r,r},o.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},o.Curve.prototype.getUtoTmapping=function(e,t){var n,r=this.getLengths(),o=0,i=r.length;n=t?t:e*r[i-1];for(var a,s=0,u=i-1;s<=u;)if(o=Math.floor(s+(u-s)/2),a=r[o]-n,a<0)s=o+1;else{if(!(a>0)){u=o;break}u=o-1}if(o=u,r[o]==n){var l=o/(i-1);return l}var c=r[o],h=r[o+1],p=h-c,d=(n-c)/p,l=(o+d)/(i-1);return l},o.Curve.prototype.getTangent=function(e){var t=1e-4,n=e-t,r=e+t;n<0&&(n=0),r>1&&(r=1);var o=this.getPoint(n),i=this.getPoint(r),a=i.clone().sub(o);return a.normalize()},o.Curve.prototype.getTangentAt=function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},o.Curve.Utils={tangentQuadraticBezier:function(e,t,n,r){return 2*(1-e)*(n-t)+2*e*(r-n)},tangentCubicBezier:function(e,t,n,r,o){return-3*t*(1-e)*(1-e)+3*n*(1-e)*(1-e)-6*e*n*(1-e)+6*e*r*(1-e)-3*e*e*r+3*e*e*o},tangentSpline:function(e,t,n,r,o){var i=6*e*e-6*e,a=3*e*e-4*e+1,s=-6*e*e+6*e,u=3*e*e-2*e;return i+a+s+u},interpolate:function(e,t,n,r,o){var i=.5*(n-e),a=.5*(r-t),s=o*o,u=o*s;return(2*t-2*n+i+a)*u+(-3*t+3*n-2*i-a)*s+i*o+t}},o.Curve.create=function(e,t){return e.prototype=Object.create(o.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},o.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},o.CurvePath.prototype=Object.create(o.Curve.prototype),o.CurvePath.prototype.constructor=o.CurvePath,o.CurvePath.prototype.add=function(e){this.curves.push(e)},o.CurvePath.prototype.checkConnection=function(){},o.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new o.LineCurve(t,e))},o.CurvePath.prototype.getPoint=function(e){for(var t,n,r=e*this.getLength(),o=this.getCurveLengths(),i=0;i=r){t=o[i]-r,n=this.curves[i];var a=1-t/n.getLength();return n.getPointAt(a)}i++}return null},o.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},o.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var e,t=[],n=0,r=this.curves.length;for(e=0;ee?e=u.x:u.xt?t=u.y:u.yn?n=u.z:u.z0?(v=x[x.length-1],f=v.x,m=v.y):(v=this.actions[n-1].args,f=v[v.length-2],m=v[v.length-1]),g=1;g<=e;g++)y=g/e,_=o.Shape.Utils.b2(y,f,p,u),b=o.Shape.Utils.b2(y,m,d,l),x.push(new o.Vector2(_,b));break;case o.PathActions.BEZIER_CURVE_TO:for(u=s[4],l=s[5],p=s[0],d=s[1],c=s[2],h=s[3],x.length>0?(v=x[x.length-1],f=v.x,m=v.y):(v=this.actions[n-1].args,f=v[v.length-2],m=v[v.length-1]),g=1;g<=e;g++)y=g/e,_=o.Shape.Utils.b3(y,f,p,c,u),b=o.Shape.Utils.b3(y,m,d,h,l),x.push(new o.Vector2(_,b));break;case o.PathActions.CSPLINE_THRU:v=this.actions[n-1].args;var w=new o.Vector2(v[v.length-2],v[v.length-1]),E=[w],M=e*s[0].length;E=E.concat(s[0]);var C=new o.SplineCurve(E);for(g=1;g<=M;g++)x.push(C.getPointAt(g/M));break;case o.PathActions.ARC:var S,T=s[0],A=s[1],N=s[2],P=s[3],O=s[4],R=!!s[5],D=O-P,L=2*e;for(g=1;g<=L;g++)y=g/L,R||(y=1-y),S=P+y*D,_=T+N*Math.cos(S),b=A+N*Math.sin(S),x.push(new o.Vector2(_,b));break;case o.PathActions.ELLIPSE:var S,T=s[0],A=s[1],k=s[2],F=s[3],P=s[4],O=s[5],R=!!s[6],D=O-P,L=2*e;for(g=1;g<=L;g++)y=g/L,R||(y=1-y),S=P+y*D,_=T+k*Math.cos(S),b=A+F*Math.sin(S),x.push(new o.Vector2(_,b))}var I=x[x.length-1],V=1e-10;return Math.abs(I.x-x[0].x)n){if(c<0&&(s=t[a],l=-l,u=t[i],c=-c),e.yu.y)continue;if(e.y==s.y){if(e.x==s.x)return!0}else{var h=c*(e.x-s.x)-l*(e.y-s.y);if(0==h)return!0;if(h<0)continue;o=!o}}else{if(e.y!=s.y)continue;if(u.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=u.x)return!0}}return o}var a=n(this.actions);if(0==a.length)return[];if(t===!0)return r(a);var s,u,l,c=[];if(1==a.length)return u=a[0],l=new o.Shape,l.actions=u.actions,l.curves=u.curves,c.push(l),c;var h=!o.Shape.Utils.isClockWise(a[0].getPoints());h=e?!h:h;var p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];var g,y;for(g=0,y=a.length;g1){for(var _=!1,b=[],x=0,w=f.length;x0&&(_||(m=d))}var A,N,P;for(g=0,y=f.length;ga){var m;if(d>0){if(f<0||f>d)return[];if(m=c*h-l*p,m<0||m>d)return[]}else{if(f>0||f0||mS?[]:x==S?i?[]:[_]:w<=S?[_,b]:[_,M]}function i(e,t,n,r){var o=1e-10,i=t.x-e.x,a=t.y-e.y,s=n.x-e.x,u=n.y-e.y,l=r.x-e.x,c=r.y-e.y,h=i*u-a*s,p=i*c-a*l;if(Math.abs(h)>o){var d=l*u-c*s;return h>0?p>=0&&d>=0:p>=0||d>=0}return p>0}function a(e,t){function n(e,t){var n=y.length-1,r=e-1;r<0&&(r=n);var o=e+1;o>n&&(o=0);var a=i(y[e],y[r],y[o],s[t]);if(!a)return!1;var u=s.length-1,l=t-1;l<0&&(l=u);var c=t+1;return c>u&&(c=0),a=i(s[t],s[l],s[c],y[e]),!!a}function o(e,t){var n,o,i;for(n=0;n0)return!0;return!1}function a(e,n){var o,i,a,s,u;for(o=0;o<_.length;o++)for(i=t[_[o]],a=0;a0)return!0;return!1}for(var s,u,l,c,h,p,d,f,m,v,g,y=e.concat(),_=[],b=[],x=0,w=t.length;x0;){if(M--,M<0){console.log("Infinite Loop! Holes left:"+_.length+", Probably Hole outside Shape!"); +break}for(l=E;l=0)break;b[d]=!0}if(u>=0)break}}return y}for(var s,u,l,c,h,p,d={},f=e.concat(),m=0,v=t.length;mt.length-2?t.length-1:r+1],l=t[r>t.length-3?t.length-1:r+2],c=new o.Vector2;return c.x=o.Curve.Utils.interpolate(a.x,s.x,u.x,l.x,i),c.y=o.Curve.Utils.interpolate(a.y,s.y,u.y,l.y,i),c},o.EllipseCurve=function(e,t,n,r,o,i,a){this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=o,this.aEndAngle=i,this.aClockwise=a},o.EllipseCurve.prototype=Object.create(o.Curve.prototype),o.EllipseCurve.prototype.constructor=o.EllipseCurve,o.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;t<0&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI);var n;n=this.aClockwise===!0?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t;var r=new o.Vector2;return r.x=this.aX+this.xRadius*Math.cos(n),r.y=this.aY+this.yRadius*Math.sin(n),r},o.ArcCurve=function(e,t,n,r,i,a){o.EllipseCurve.call(this,e,t,n,n,r,i,a)},o.ArcCurve.prototype=Object.create(o.EllipseCurve.prototype),o.ArcCurve.prototype.constructor=o.ArcCurve,o.LineCurve3=o.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new o.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),o.QuadraticBezierCurve3=o.Curve.create(function(e,t,n){this.v0=e,this.v1=t,this.v2=n},function(e){var t=new o.Vector3;return t.x=o.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=o.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t.z=o.Shape.Utils.b2(e,this.v0.z,this.v1.z,this.v2.z),t}),o.CubicBezierCurve3=o.Curve.create(function(e,t,n,r){this.v0=e,this.v1=t,this.v2=n,this.v3=r},function(e){var t=new o.Vector3;return t.x=o.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t.y=o.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t.z=o.Shape.Utils.b3(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z),t}),o.SplineCurve3=o.Curve.create(function(e){this.points=void 0==e?[]:e},function(e){var t=this.points,n=(t.length-1)*e,r=Math.floor(n),i=n-r,a=t[0==r?r:r-1],s=t[r],u=t[r>t.length-2?t.length-1:r+1],l=t[r>t.length-3?t.length-1:r+2],c=new o.Vector3;return c.x=o.Curve.Utils.interpolate(a.x,s.x,u.x,l.x,i),c.y=o.Curve.Utils.interpolate(a.y,s.y,u.y,l.y,i),c.z=o.Curve.Utils.interpolate(a.z,s.z,u.z,l.z,i),c}),o.ClosedSplineCurve3=o.Curve.create(function(e){this.points=void 0==e?[]:e},function(e){var t=this.points,n=(t.length-0)*e,r=Math.floor(n),i=n-r;r+=r>0?0:(Math.floor(Math.abs(r)/t.length)+1)*t.length;var a=t[(r-1)%t.length],s=t[r%t.length],u=t[(r+1)%t.length],l=t[(r+2)%t.length],c=new o.Vector3;return c.x=o.Curve.Utils.interpolate(a.x,s.x,u.x,l.x,i),c.y=o.Curve.Utils.interpolate(a.y,s.y,u.y,l.y,i),c.z=o.Curve.Utils.interpolate(a.z,s.z,u.z,l.z,i),c}),o.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){o.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){o.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){o.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(e){if(e.initialized===!0)return e;for(var t=0;tu.index;)u=l,l=this.getNextKeyWith(s,e,l.index+1);i.prevKey[s]=u,i.nextKey[s]=l}}},resetBlendWeights:function(){for(var e=0,t=this.hierarchy.length;ee.length-2?r:r+1,p[3]=r>e.length-3?r:r+2,u=e[p[0]],l=e[p[1]],c=e[p[2]],h=e[p[3]],i=o*o,s=o*i,d[0]=a(u[0],l[0],c[0],h[0],o,i,s),d[1]=a(u[1],l[1],c[1],h[1],o,i,s),d[2]=a(u[2],l[2],c[2],h[2],o,i,s),d},a=function(e,t,n,r,o,i,a){var s=.5*(n-e),u=.5*(r-t);return(2*(t-n)+s+u)*a+(-3*(t-n)-2*s-u)*i+s*o+t};return function(a){if(this.isPlaying!==!1&&(this.currentTime+=a*this.timeScale,0!==this.weight)){var s=this.data.length;(this.currentTime>s||this.currentTime<0)&&(this.loop?(this.currentTime%=s,this.currentTime<0&&(this.currentTime+=s),this.reset()):this.stop());for(var u=0,l=this.hierarchy.length;u0&&v.time<=this.currentTime||this.timeScale<0&&m.time>=this.currentTime){for(m=this.data.hierarchy[u].keys[0],v=this.getNextKeyWith(f,u,1);v.timem.index;)m=v,v=this.getNextKeyWith(f,u,v.index+1);h.prevKey[f]=m,h.nextKey[f]=v}var g=(this.currentTime-m.time)/(v.time-m.time),y=m[f],_=v[f];if(g<0&&(g=0),g>1&&(g=1),"pos"===f){if(this.interpolationType===o.AnimationHandler.LINEAR){n.x=y[0]+(_[0]-y[0])*g,n.y=y[1]+(_[1]-y[1])*g,n.z=y[2]+(_[2]-y[2])*g;var b=this.weight/(this.weight+p.positionWeight);c.position.lerp(n,b),p.positionWeight+=this.weight}else if(this.interpolationType===o.AnimationHandler.CATMULLROM||this.interpolationType===o.AnimationHandler.CATMULLROM_FORWARD){e[0]=this.getPrevKeyWith("pos",u,m.index-1).pos,e[1]=y,e[2]=_,e[3]=this.getNextKeyWith("pos",u,v.index+1).pos,g=.33*g+.33;var x=i(e,g),b=this.weight/(this.weight+p.positionWeight);p.positionWeight+=this.weight;var w=c.position;if(w.x=w.x+(x[0]-w.x)*b,w.y=w.y+(x[1]-w.y)*b,w.z=w.z+(x[2]-w.z)*b,this.interpolationType===o.AnimationHandler.CATMULLROM_FORWARD){var E=i(e,1.01*g);t.set(E[0],E[1],E[2]),t.sub(w),t.y=0,t.normalize();var M=Math.atan2(t.x,t.z);c.rotation.set(0,M,0)}}}else if("rot"===f)if(o.Quaternion.slerp(y,_,r,g),0===p.quaternionWeight)c.quaternion.copy(r),p.quaternionWeight=this.weight;else{var b=this.weight/(this.weight+p.quaternionWeight);o.Quaternion.slerp(c.quaternion,r,c.quaternion,b),p.quaternionWeight+=this.weight}else if("scl"===f){n.x=y[0]+(_[0]-y[0])*g,n.y=y[1]+(_[1]-y[1])*g,n.z=y[2]+(_[2]-y[2])*g;var b=this.weight/(this.weight+p.scaleWeight);c.scale.lerp(n,b),p.scaleWeight+=this.weight}}return!0}}}(),getNextKeyWith:function(e,t,n){var r=this.data.hierarchy[t].keys;for(this.interpolationType===o.AnimationHandler.CATMULLROM||this.interpolationType===o.AnimationHandler.CATMULLROM_FORWARD?n=n0?n:0:n>=0?n:n+r.length;n>=0;n--)if(void 0!==r[n][e])return r[n];return this.data.hierarchy[t].keys[r.length-1]}},o.KeyFrameAnimation=function(e){this.root=e.node,this.data=o.AnimationHandler.init(e),this.hierarchy=o.AnimationHandler.parse(this.root),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.isPaused=!0,this.loop=!0;for(var t=0,n=this.hierarchy.length;tt&&(this.currentTime%=t),this.currentTime=Math.min(this.currentTime,t);for(var n=0,r=this.hierarchy.length;nu.index;)u=l,l=a[u.index+1];s.prevKey=u,s.nextKey=l}l.time>=this.currentTime?u.interpolate(l,this.currentTime):u.interpolate(l,l.time),this.data.hierarchy[n].node.updateMatrix(),o.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(e,t,n){var r=this.data.hierarchy[t].keys;for(n%=r.length;n=0?n:n+r.length;n>=0;n--)if(r[n].hasTarget(e))return r[n];return r[r.length-1]}},o.MorphAnimation=function(e){this.mesh=e,this.frames=e.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.lastFrame=0,this.currentFrame=0,this.isPlaying=!1},o.MorphAnimation.prototype={constructor:o.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(e){if(this.isPlaying!==!1){this.currentTime+=e,this.loop===!0&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration);var t=this.duration/this.frames,n=Math.floor(this.currentTime/t),r=this.mesh.morphTargetInfluences;n!=this.currentFrame&&(r[this.lastFrame]=0,r[this.currentFrame]=1,r[n]=0,this.lastFrame=this.currentFrame,this.currentFrame=n),r[n]=this.currentTime%t/t,r[this.lastFrame]=1-r[n]}}},o.BoxGeometry=function(e,t,n,r,i,a){function s(e,t,n,r,i,a,s,l){var c,h,p,d=u.widthSegments,f=u.heightSegments,m=i/2,v=a/2,g=u.vertices.length;"x"===e&&"y"===t||"y"===e&&"x"===t?c="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(c="y",f=u.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(c="x",d=u.depthSegments);var y=d+1,_=f+1,b=i/d,x=a/f,w=new o.Vector3;for(w[c]=s>0?1:-1,p=0;p<_;p++)for(h=0;h0)for(this.vertices.push(new o.Vector3(0,h,0)),l=0;l0)for(this.vertices.push(new o.Vector3(0,-h,0)),l=0;la){var f=Math.sqrt(p),m=Math.sqrt(c*c+h*h),v=t.x-l/f,g=t.y+u/f,y=n.x-h/m,_=n.y+c/m,b=((y-v)*h-(_-g)*c)/(u*h-l*c);r=v+u*b-e.x,i=g+l*b-e.y;var x=r*r+i*i;if(x<=2)return new o.Vector2(r,i);s=Math.sqrt(x/2)}else{var w=!1;u>a?c>a&&(w=!0):u<-a?c<-a&&(w=!0):Math.sign(l)==Math.sign(h)&&(w=!0),w?(r=-l,i=u,s=Math.sqrt(p)):(r=u,i=l,s=Math.sqrt(p/2))}return new o.Vector2(r/s,i/s)}function i(){if(b){var e=0,t=G*e;for(Y=0;Y=0;){n=Y,r=Y-1,r<0&&(r=e.length-1);var o=0,i=w+2*_;for(o=0;o=0;U--){for(B=U/_,z=g*(1-B),j=y*Math.sin(B*Math.PI/2),Y=0,K=V.length;Y65535?Uint32Array:Uint16Array)(s*u*6),y=0;y_&&(v.normalize(),i=Math.acos(o.Math.clamp(d[c-1].dot(d[c]),-1,1)),f[c].applyMatrix4(g.makeRotationAxis(v,i))),m[c].crossVectors(d[c],f[c]);if(n)for(i=Math.acos(o.Math.clamp(f[0].dot(f[y-1]),-1,1)),i/=y-1,d[0].dot(v.crossVectors(f[0],f[y-1]))>0&&(i=-i),c=1;c.9&&S<.1&&(w<.2&&(x[0].x+=1),E<.2&&(x[1].x+=1),M<.2&&(x[2].x+=1))}for(var p=0,d=this.vertices.length;p.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(n.z,0,-n.x).normalize(),e=Math.acos(n.y),this.quaternion.setFromAxisAngle(t,e))}}(),o.ArrowHelper.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,e-t,1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},o.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},o.BoxHelper=function(e){var t=new o.BufferGeometry;t.addAttribute("position",new o.BufferAttribute(new Float32Array(72),3)),o.Line.call(this,t,new o.LineBasicMaterial({color:16776960}),o.LinePieces),void 0!==e&&this.update(e)},o.BoxHelper.prototype=Object.create(o.Line.prototype),o.BoxHelper.prototype.constructor=o.BoxHelper,o.BoxHelper.prototype.update=function(e){var t=e.geometry;null===t.boundingBox&&t.computeBoundingBox();var n=t.boundingBox.min,r=t.boundingBox.max,o=this.geometry.attributes.position.array;o[0]=r.x,o[1]=r.y,o[2]=r.z,o[3]=n.x,o[4]=r.y,o[5]=r.z,o[6]=n.x,o[7]=r.y,o[8]=r.z,o[9]=n.x,o[10]=n.y,o[11]=r.z,o[12]=n.x,o[13]=n.y,o[14]=r.z,o[15]=r.x,o[16]=n.y,o[17]=r.z,o[18]=r.x,o[19]=n.y,o[20]=r.z,o[21]=r.x,o[22]=r.y,o[23]=r.z,o[24]=r.x,o[25]=r.y,o[26]=n.z,o[27]=n.x,o[28]=r.y,o[29]=n.z,o[30]=n.x,o[31]=r.y,o[32]=n.z,o[33]=n.x,o[34]=n.y,o[35]=n.z,o[36]=n.x,o[37]=n.y,o[38]=n.z,o[39]=r.x,o[40]=n.y,o[41]=n.z,o[42]=r.x,o[43]=n.y,o[44]=n.z,o[45]=r.x,o[46]=r.y,o[47]=n.z,o[48]=r.x,o[49]=r.y,o[50]=r.z,o[51]=r.x,o[52]=r.y,o[53]=n.z,o[54]=n.x,o[55]=r.y,o[56]=r.z,o[57]=n.x,o[58]=r.y,o[59]=n.z,o[60]=n.x,o[61]=n.y,o[62]=r.z,o[63]=n.x,o[64]=n.y,o[65]=n.z,o[66]=r.x,o[67]=n.y,o[68]=r.z,o[69]=r.x,o[70]=n.y,o[71]=n.z,this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingSphere(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},o.BoundingBoxHelper=function(e,t){var n=void 0!==t?t:8947848;this.object=e,this.box=new o.Box3,o.Mesh.call(this,new o.BoxGeometry(1,1,1),new o.MeshBasicMaterial({color:n,wireframe:!0}))},o.BoundingBoxHelper.prototype=Object.create(o.Mesh.prototype),o.BoundingBoxHelper.prototype.constructor=o.BoundingBoxHelper,o.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},o.CameraHelper=function(e){function t(e,t,r){n(e,r),n(t,r)}function n(e,t){r.vertices.push(new o.Vector3),r.colors.push(new o.Color(t)),void 0===a[e]&&(a[e]=[]),a[e].push(r.vertices.length-1)}var r=new o.Geometry,i=new o.LineBasicMaterial({color:16777215,vertexColors:o.FaceColors}),a={},s=16755200,u=16711680,l=43775,c=16777215,h=3355443;t("n1","n2",s),t("n2","n4",s),t("n4","n3",s),t("n3","n1",s),t("f1","f2",s),t("f2","f4",s),t("f4","f3",s),t("f3","f1",s),t("n1","f1",s),t("n2","f2",s),t("n3","f3",s),t("n4","f4",s),t("p","n1",u),t("p","n2",u),t("p","n3",u),t("p","n4",u),t("u1","u2",l),t("u2","u3",l),t("u3","u1",l),t("c","t",c),t("p","c",h),t("cn1","cn2",h),t("cn3","cn4",h),t("cf1","cf2",h),t("cf3","cf4",h),o.Line.call(this,r,i,o.LinePieces),this.camera=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()},o.CameraHelper.prototype=Object.create(o.Line.prototype),o.CameraHelper.prototype.constructor=o.CameraHelper,o.CameraHelper.prototype.update=function(){var e,t,n=new o.Vector3,r=new o.Camera,i=function(o,i,a,s){n.set(i,a,s).unproject(r);var u=t[o];if(void 0!==u)for(var l=0,c=u.length;l1){var l=u[1];r[l]||(r[l]={start:1/0,end:-(1/0)});var c=r[l];ic.end&&(c.end=i),t||(t=l)}}for(var l in r){var c=r[l];this.createAnimation(l,c.start,c.end,e)}this.firstAnimation=t},o.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},o.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},o.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var n=this.animationsMap[e];n&&(n.fps=t,n.duration=(n.end-n.start)/n.fps)},o.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var n=this.animationsMap[e];n&&(n.duration=t,n.fps=(n.end-n.start)/n.duration)},o.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var n=this.animationsMap[e];n&&(n.weight=t)},o.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var n=this.animationsMap[e];n&&(n.time=t)},o.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,n=this.animationsMap[e];return n&&(t=n.time),t},o.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,n=this.animationsMap[e];return n&&(t=n.duration),t},o.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):o.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},o.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},o.MorphBlendMesh.prototype.update=function(e){for(var t=0,n=this.animationsList.length;tr.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var a=r.startFrame+o.Math.clamp(Math.floor(r.time/i),0,r.length-1),s=r.weight;a!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*s,this.morphTargetInfluences[a]=0,r.lastFrame=r.currentFrame,r.currentFrame=a);var u=r.time%i/i;r.directionBackwards&&(u=1-u),this.morphTargetInfluences[r.currentFrame]=u*s,this.morphTargetInfluences[r.lastFrame]=(1-u)*s}}},"undefined"!=typeof e&&e.exports&&(t=e.exports=o),t.THREE=o},function(e,t,n){"use strict";var r=n(92),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=n(52),u=function(e){return"function"==typeof e&&"[object Function]"===i.call(e)},l=n(55)(),c=function(e,t,n,r){if(t in e)if(r===!0){if(e[t]===n)return}else if(!u(r)||!r())return;l?s(e,t,n,!0):s(e,t,n)},h=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s1&&"boolean"!=typeof t)throw new l('"allowMissing" argument must be a boolean');if(null===O(/^%?[^%]*%?$/,e))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=L(e),o=n.length>0?n[0]:"",i=k("%"+o+"%",t),a=i.name,s=i.value,c=!1,h=i.alias;h&&(o=h[0],A(n,T([0,1],h)));for(var p=1,f=!0;p=n.length){var y=d(s,m);f=!!y,s=f&&"get"in y&&!("originalValue"in y.get)?y.get:s[m]}else f=S(s,m),s=s[m];f&&!c&&(x[a]=s)}}return s}},function(e,t,n){(function(t){"use strict";var n={};"production"!==t.env.NODE_ENV&&Object.freeze(n),e.exports=n}).call(t,n(1))},function(e,t){"use strict";t.__esModule=!0;var n="PUSH";t.PUSH=n;var r="REPLACE";t.REPLACE=r;var o="POP";t.POP=o,t.default={PUSH:n,REPLACE:r,POP:o}},function(e,t,n){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i(e){return o(e).replace(/\/+/g,"/+")}function a(e){for(var t="",n=[],r=[],o=void 0,a=0,s=/:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)/g;o=s.exec(e);)o.index!==a&&(r.push(e.slice(a,o.index)),t+=i(e.slice(a,o.index))),o[1]?(t+="([^/?#]+)",n.push(o[1])):"**"===o[0]?(t+="([\\s\\S]*)",n.push("splat")):"*"===o[0]?(t+="([\\s\\S]*?)",n.push("splat")):"("===o[0]?t+="(?:":")"===o[0]&&(t+=")?"),r.push(o[0]),a=s.lastIndex;return a!==e.length&&(r.push(e.slice(a,e.length)),t+=i(e.slice(a,e.length))),{pattern:e,regexpSource:t,paramNames:n,tokens:r}}function s(e){return e in f||(f[e]=a(e)),f[e]}function u(e,t){"/"!==e.charAt(0)&&(e="/"+e),"/"!==t.charAt(0)&&(t="/"+t);var n=s(e),r=n.regexpSource,o=n.paramNames,i=n.tokens;r+="/*";var a="*"!==i[i.length-1];a&&(r+="([\\s\\S]*?)");var u=t.match(new RegExp("^"+r+"$","i")),l=void 0,c=void 0;if(null!=u){if(a){l=u.pop();var h=u[0].substr(0,u[0].length-l.length);if(l&&"/"!==h.charAt(h.length-1))return{remainingPathname:null,paramNames:o,paramValues:null}}else l="";c=u.slice(1).map(function(e){return null!=e?decodeURIComponent(e):e})}else l=c=null;return{remainingPathname:l,paramNames:o,paramValues:c}}function l(e){return s(e).paramNames}function c(e,t){var n=u(e,t),r=n.paramNames,o=n.paramValues;return null!=o?r.reduce(function(e,t,n){return e[t]=o[n],e},{}):null}function h(t,n){n=n||{};for(var r=s(t),o=r.tokens,i=0,a="",u=0,l=void 0,c=void 0,h=void 0,p=0,f=o.length;p0?void 0:"production"!==e.env.NODE_ENV?d.default(!1,'Missing splat #%s for path "%s"',u,t):d.default(!1),null!=h&&(a+=encodeURI(h))):"("===l?i+=1:")"===l?i-=1:":"===l.charAt(0)?(c=l.substring(1),h=n[c],null!=h||i>0?void 0:"production"!==e.env.NODE_ENV?d.default(!1,'Missing "%s" parameter for path "%s"',c,t):d.default(!1),null!=h&&(a+=encodeURIComponent(h))):a+=l;return a.replace(/\/+/g,"/")}t.__esModule=!0,t.compilePattern=s,t.matchPattern=u,t.getParamNames=l,t.getParams=c,t.formatPattern=h;var p=n(14),d=r(p),f={}}).call(t,n(1))},function(e,t,n){(function(t){"use strict";function r(){var e=v&&v.traverseTwoPhase&&v.traverseEnterLeave;"production"!==t.env.NODE_ENV?c(e,"InstanceHandle not injected before use!"):void 0}var o=n(112),i=n(258),a=n(125),s=n(134),u=n(135),l=n(2),c=n(5),h={},p=null,d=function(e,t){e&&(i.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},f=function(e){return d(e,!0)},m=function(e){return d(e,!1)},v=null,g={injection:{injectMount:i.injection.injectMount,injectInstanceHandle:function(e){v=e,"production"!==t.env.NODE_ENV&&r()},getInstanceHandle:function(){return"production"!==t.env.NODE_ENV&&r(),v},injectEventPluginOrder:o.injectEventPluginOrder,injectEventPluginsByName:o.injectEventPluginsByName},eventNameDispatchConfigs:o.eventNameDispatchConfigs,registrationNameModules:o.registrationNameModules,putListener:function(e,n,r){"function"!=typeof r?"production"!==t.env.NODE_ENV?l(!1,"Expected %s listener to be a function, instead got type %s",n,typeof r):l(!1):void 0;var i=h[n]||(h[n]={});i[e]=r;var a=o.registrationNameModules[n];a&&a.didPutListener&&a.didPutListener(e,n,r)},getListener:function(e,t){var n=h[t];return n&&n[e]},deleteListener:function(e,t){var n=o.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var r=h[t];r&&delete r[e]},deleteAllListeners:function(e){for(var t in h)if(h[t][e]){var n=o.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t),delete h[t][e]}},extractEvents:function(e,t,n,r,i){for(var a,u=o.plugins,l=0;l":">","<":"<",'"':""","'":"'"},i=/[&><"']/g;e.exports=r},function(e,t,n){"use strict";var r=n(7),o=/^[ \r\n\t\f]/,i=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&i.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(){function e(){return E.scale}function t(){return E.manifestVersion}function n(){return E.maxVisibleDistance*E.maxVisibleDistance*E.scale}function r(){return E.pos}function o(){d(!E.showLinks)}function s(){return E.lookAt}function l(){return E.showLinks}function h(){var e=x(window.location.hash),t=!b(e.pos,E.pos)||!b(e.lookAt,E.lookAt),n=E.showLinks!==e.showLinks;t&&(g(e.pos,e.lookAt),M.fire("camera")),n&&d(e.showLinks),v(e.manifestVersion)}function d(e){e!==E.showLinks&&(E.showLinks=e,M.fire("showLinks"),y())}function v(e){if(e!==E.manifestVersion){E=x(window.location.hash),E.manifestVersion=e,y();var t=p.default.getGraphName();u.default.downloadGraphRequested.fire(t)}}function g(e,t){b(e,E.pos)&&b(t,E.lookAt)&&t.w===E.lookAt.w||(E.pos.x=e.x,E.pos.y=e.y,E.pos.z=e.z,E.lookAt.x=t.x,E.lookAt.y=t.y,E.lookAt.z=t.z,E.lookAt.w=t.w,y())}function y(){var e=p.default.getGraphName(),t=E.pos,n=E.lookAt,r="#/galaxy/"+e+"?cx="+Math.round(t.x)+"&cy="+Math.round(t.y)+"&cz="+Math.round(t.z)+"&lx="+n.x.toFixed(4)+"&ly="+n.y.toFixed(4)+"&lz="+n.z.toFixed(4)+"&lw="+n.w.toFixed(4)+"&ml="+E.maxVisibleDistance+"&s="+E.scale+"&l="+(E.showLinks?"1":"0")+"&v="+E.manifestVersion;_(r)}function _(e){w&&window.clearTimeout(w),w=setTimeout(function(){window.history?window.history.replaceState(void 0,void 0,e):window.location.replace(e),w=null},400)}function b(e,t){return!(!e||!t)&&(e.x===t.x&&e.y===t.y&&e.z===t.z)}function x(e){if(!e)return m;var t=f.default.parse(e.split("?")[1]),n={x:t.cx||0,y:t.cy||0,z:t.cz||0},r={x:t.lx||0,y:t.ly||0,z:t.lz||0,w:a(t.lw||1)},o="1"===t.l;return{pos:i(n),lookAt:i(r),showLinks:o,maxVisibleDistance:a(t.ml,m.maxVisibleDistance),scale:a(t.s,m.scale),manifestVersion:t.v||m.manifestVersion}}var w,E=x(window.location.hash),M={getCameraPosition:r,getCameraLookAt:s,getShowLinks:l,getScaleFactor:e,getMaxVisibleEdgeLength:n,setCameraConfig:g,setShowLinks:d,getManifestVersion:t,setManifestVersion:v};return u.default.toggleLinks.on(o),u.default.queryChanged.on(h),(0,c.default)(M),M}function i(e){return e?(e.x=a(e.x),e.y=a(e.y),e.z=a(e.z),e):e}function a(e,t){return void 0===t&&(t=0),e=parseFloat(e),isNaN(e)?t:e}Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),u=r(s),l=n(17),c=r(l),h=n(11),p=r(h),d=n(228),f=r(d),m={pos:{x:0,y:0,z:0},lookAt:{x:0,y:0,z:0,w:1},showLinks:!0,maxVisibleDistance:1e3,scale:1.75,manifestVersion:0};t.default=o(),e.exports=t.default},function(e,t,n){"use strict";var r=n(54),o=n(32),i=n(203),a=n(27),s=o("%Function.prototype.apply%"),u=o("%Function.prototype.call%"),l=o("%Reflect.apply%",!0)||r.call(u,s),c=n(53),h=o("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=l(r,u,arguments);return i(t,1+h(0,e.length-(arguments.length-1)),!0)};var p=function(){return l(r,s,arguments)};c?c(e.exports,"apply",{value:p}):e.exports.apply=p},function(e,t,n){"use strict";var r=n(53),o=n(87),i=n(27),a=n(88);e.exports=function(e,t,n){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new i("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],h=!!a&&a(e,t);if(r)r(e,t,{configurable:null===l&&h?h.configurable:!l,enumerable:null===s&&h?h.enumerable:!s,value:n,writable:null===u&&h?h.writable:!u});else{if(!c&&(s||u||l))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=n}}},function(e,t,n){"use strict";var r=n(32),o=r("%Object.defineProperty%",!0)||!1;if(o)try{o({},"a",{value:1})}catch(e){o=!1}e.exports=o},function(e,t,n){"use strict";var r=n(190);e.exports=Function.prototype.bind||r},function(e,t,n){"use strict";var r=n(53),o=function(){return!!r};o.hasArrayLengthDefineBug=function(){if(!r)return null;try{return 1!==r([],"length",{value:1}).length}catch(e){return!0}},e.exports=o},function(e,t,n){"use strict";var r=n(89);e.exports=function(){return r()&&!!Symbol.toStringTag}},function(e,t){"use strict";t.__esModule=!0;var n=!("undefined"==typeof window||!window.document||!window.document.createElement);t.canUseDOM=n},function(e,t){"use strict";function n(e){return e}t.__esModule=!0,t.default=n,e.exports=t.default},function(e,t,n){(function(r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){var o=e(t,n);e.length<2?n(o):"production"!==r.env.NODE_ENV?s.default(void 0===o,'You should not "return" in a transition hook with a callback argument; call the callback instead'):void 0}t.__esModule=!0;var a=n(13),s=o(a);t.default=i,e.exports=t.default}).call(t,n(1))},function(e,t,n){"use strict";e.exports=n(116)},function(e,t){"use strict";function n(e,t,n){function r(){a=!0,n.apply(this,arguments)}function o(){a||(i=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e){for(var t in e)if(e.hasOwnProperty(t))return!0;return!1}function s(e){return function(){function t(e,t){var n=!(arguments.length<=2||void 0===arguments[2])&&arguments[2];return y.default(e,t,n,T.location,T.routes,T.params)}function n(e){var t=e.pathname,n=e.query,r=e.state;return S.createLocation(S.createPath(t,n),r,h.REPLACE)}function o(e,t){A&&A.location===e?s(A,t):w.default(M,e,function(n,r){n?t(n):r?s(u({},r,{location:e}),t):t()})}function s(e,t){var r=m.default(T,e),o=r.leaveRoutes,i=r.enterRoutes;v.runLeaveHooks(o),v.runEnterHooks(i,e,function(r,o){r?t(r):o?t(null,n(o)):b.default(e,function(n,r){n?t(n):t(null,null,T=u({},e,{components:r}))})})}function l(e){return e.__id__||(e.__id__=N++)}function p(e){return e.reduce(function(e,t){return e.push.apply(e,P[l(t)]),e},[])}function f(e,t){w.default(M,e,function(n,r){if(null==r)return void t();A=u({},r,{location:e});for(var o=p(m.default(T,A).leaveRoutes),i=void 0,a=0,s=o.length;null==i&&a=32||13===t?t:0}e.exports=n},function(e,t){"use strict";function n(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=o[e];return!!r&&!!n[r]}function r(e){return n}var o={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};e.exports=r},function(e,t){"use strict";function n(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}e.exports=n},function(e,t){"use strict";function n(e){var t=e&&(r&&e[r]||e[o]);if("function"==typeof t)return t}var r="function"==typeof Symbol&&Symbol.iterator,o="@@iterator";e.exports=n},function(e,t,n){(function(t){"use strict";function r(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}function o(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function i(e){var n;if(null===e||e===!1)n=new s(i);else if("object"==typeof e){var a=e;!a||"function"!=typeof a.type&&"string"!=typeof a.type?"production"!==t.env.NODE_ENV?c(!1,"Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",null==a.type?a.type:typeof a.type,r(a._owner)):c(!1):void 0,n="string"==typeof a.type?u.createInternalComponent(a):o(a.type)?new a.type(a):new p}else"string"==typeof e||"number"==typeof e?n=u.createInstanceForText(e):"production"!==t.env.NODE_ENV?c(!1,"Encountered invalid React node of type %s",typeof e):c(!1);return"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?h("function"==typeof n.construct&&"function"==typeof n.mountComponent&&"function"==typeof n.receiveComponent&&"function"==typeof n.unmountComponent,"Only React Components can be mounted."):void 0),n.construct(e),n._mountIndex=0,n._mountImage=null,"production"!==t.env.NODE_ENV&&(n._isOwnerNecessary=!1,n._warnedAboutRefsInRender=!1),"production"!==t.env.NODE_ENV&&Object.preventExtensions&&Object.preventExtensions(n),n}var a=n(264),s=n(123),u=n(129),l=n(4),c=n(2),h=n(5),p=function(){};l(p.prototype,a.Mixin,{_instantiateReactComponent:i}),e.exports=i}).call(t,n(1))},function(e,t,n){"use strict";/** + * Checks if an event is supported in the current execution environment. + * + * NOTE: This will not work correctly for non-generic events such as `change`, + * `reset`, `load`, `error`, and `select`. + * + * Borrows from Modernizr. + * + * @param {string} eventNameSuffix Event name, e.g. "click". + * @param {?boolean} capture Check if the capture phase is supported. + * @return {boolean} True if the event is supported. + * @internal + * @license Modernizr 3.0.0pre (Custom Build) | MIT + */ +function r(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,i=n(7);i.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=r},function(e,t,n){"use strict";var r=n(7),o=n(48),i=n(49),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){i(e,o(t))})),e.exports=a},function(e,t){"use strict";function n(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var o=typeof e,i=typeof t;return"string"===o||"number"===o?"string"===i||"number"===i:"object"===i&&e.type===t.type&&e.key===t.key}e.exports=n},function(e,t,n){(function(t){"use strict";function r(e){return g[e]}function o(e,t){return e&&null!=e.key?a(e.key):t.toString(36)}function i(e){return(""+e).replace(y,r)}function a(e){return"$"+i(e)}function s(e,n,r,i){var u=typeof e;if("undefined"!==u&&"boolean"!==u||(e=null),null===e||"string"===u||"number"===u||c.isValidElement(e))return r(i,e,""===n?m+o(e,0):n),1;var h,g,y=0,b=""===n?m:n+v;if(Array.isArray(e))for(var x=0;x "),A=!!s+"|"+e+"|"+p+"|"+T;if(v[A])return;if(v[A]=!0,s){var N="";"table"===p&&"tr"===e&&(N+=" Add a to your code to match the DOM tree generated by the browser."),"production"!==t.env.NODE_ENV?i(!1,"validateDOMNesting(...): <%s> cannot appear as a child of <%s>. See %s.%s",e,p,T,N):void 0}else"production"!==t.env.NODE_ENV?i(!1,"validateDOMNesting(...): <%s> cannot appear as a descendant of <%s>. See %s.",e,p,T):void 0}},a.ancestorInfoContextKey="__validateDOMNesting_ancestorInfo$"+Math.random().toString(36).slice(2),a.updatedAncestorInfo=p,a.isTagValidInContext=function(e,t){t=t||h;var n=t.parentTag,r=n&&n.tag;return d(e,r)&&!f(e,t)}}e.exports=a}).call(t,n(1))},function(e,t){function n(e){if(void 0===e)return e;var t=typeof e;return"number"===t?e:"string"===t?r(e):3===e.length?e[0]<<16|e[1]<<8|e[2]:void 0}function r(e){return"#"===e[0]?Number.parseInt(e.substring(1),16):Number.parseInt(e,16)}e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=u.default.getGraphName(),n=(0,a.default)(t),r=u.default.getNodeInfo(e);return{name:r.name,id:r.id,inDegree:(0,c.default)(r.in),inDegreeLabel:n.getInDegreeLabel(r.in),outDegree:(0,c.default)(r.out),outDegreeLabel:n.getOutDegreeLabel(r.out)}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(175),a=r(i),s=n(11),u=r(s),l=n(40),c=r(l);t.default=o,e.exports=t.default},function(e,t){"use strict";function n(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}Object.defineProperty(t,"__esModule",{value:!0}),t.default={isModifier:n,H:72,L:76,Space:32,"/":191},e.exports=t.default},function(e,t,n){(function(t,n,r){/* @preserve + * The MIT License (MIT) + * + * Copyright (c) 2013-2015 Petka Antonov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ +!function(t){e.exports=t()}(function(){var e,o,i;return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof _dereq_&&_dereq_;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof _dereq_&&_dereq_,a=0;a0},r.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")}},c.hasDevTools?(u.isStatic&&(u=function(e){setTimeout(e,0)}),r.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?o.call(this,e,t,n):this._schedule(function(){setTimeout(function(){e.call(t,n)},100)})},r.prototype.invoke=function(e,t,n){this._trampolineEnabled?i.call(this,e,t,n):this._schedule(function(){e.call(t,n)})},r.prototype.settlePromises=function(e){this._trampolineEnabled?a.call(this,e):this._schedule(function(){e._settlePromises()})}):(r.prototype.invokeLater=o,r.prototype.invoke=i,r.prototype.settlePromises=a),r.prototype.invokeFirst=function(e,t,n){this._normalQueue.unshift(e,t,n),this._queueTick()},r.prototype._drainQueue=function(e){for(;e.length()>0;){var t=e.shift();if("function"==typeof t){var n=e.shift(),r=e.shift();t.call(n,r)}else t._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},t.exports=new r,t.exports.firstLineError=s},{"./queue.js":28,"./schedule.js":31,"./util.js":38}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r=function(e,t){this._reject(t)},o=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(r,r,null,this,e)},i=function(e,t){this._isPending()&&this._resolveCallback(t.target)},a=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(r){var s=n(r),u=new e(t);u._propagateFrom(this,1);var l=this._target();if(u._setBoundTo(s),s instanceof e){var c={promiseRejectionQueued:!1,promise:u,target:l,bindingPromise:s};l._then(t,o,u._progress,u,c),s._then(i,a,u._progress,u,c)}else u._resolveCallback(l);return u},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=131072|this._bitField,this._boundTo=e):this._bitField=this._bitField&-131073},e.prototype._isBound=function(){return 131072===(131072&this._bitField)},e.bind=function(r,o){var i=n(r),a=new e(t);return a._setBoundTo(i),i instanceof e?i._then(function(){a._resolveCallback(o)},a._reject,a._progress,a,null):a._resolveCallback(o),a}}},{}],4:[function(e,t,n){"use strict";function r(){try{Promise===i&&(Promise=o)}catch(e){}return i}var o;"undefined"!=typeof Promise&&(o=Promise);var i=e("./promise.js")();i.noConflict=r,t.exports=i},{"./promise.js":23}],5:[function(e,t,n){"use strict";var r=Object.create;if(r){var o=r(null),i=r(null);o[" size"]=i[" size"]=0}t.exports=function(t){function n(e,n){var r;if(null!=e&&(r=e[n]),"function"!=typeof r){var o="Object "+s.classString(e)+" has no method '"+s.toString(n)+"'";throw new t.TypeError(o)}return r}function r(e){var t=this.pop(),r=n(e,t);return r.apply(e,this)}function o(e){return e[this]}function i(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}var a,s=e("./util.js"),u=s.canEvaluate;s.isIdentifier;t.prototype.call=function(e){for(var t=arguments.length,n=new Array(t-1),o=1;o32&&this.uncycle()}function r(e,t){for(var n=0;n=0;--s)if(r[s]===i){a=s;break}for(var s=a;s>=0;--s){var u=r[s];if(t[o]!==u)break;t.pop(),o--}t=r}}function a(e){for(var t=[],n=0;n0&&(t=t.slice(n)),t}function u(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{t=e.toString();var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(t))try{var r=JSON.stringify(e);t=r}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+l(t)+">, no stack trace)"}function l(e){var t=41;return e.length=0;--r){var i=t[r].stack;void 0===n[i]&&(n[i]=r)}for(var r=0;r0&&(t[s-1]._parent=void 0,t[s-1]._length=1),t[r]._parent=void 0,t[r]._length=1;var u=r>0?t[r-1]:this;s=0;--c)t[c]._length=l,l++;return}}}},n.prototype.parent=function(){return this._parent},n.prototype.hasParent=function(){return void 0!==this._parent},n.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=n.parseStackAndMessage(e),s=t.message,u=[t.stack],l=this;void 0!==l;)u.push(a(l.stack.split("\n"))),l=l._parent;i(u),o(u),d.notEnumerableProp(e,"stack",r(s,u)),d.notEnumerableProp(e,"__stackCleaned__",!0)}},n.parseStackAndMessage=function(e){var t=e.stack,n=e.toString();return t="string"==typeof t&&t.length>0?s(e):[" (No stack trace)"],{message:n,stack:a(t)}},n.formatAndLogError=function(e,t){if("undefined"!=typeof console){var n;if("object"==typeof e||"function"==typeof e){var r=e.stack;n=t+v(r,e)}else n=t+String(e);"function"==typeof h?h(n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}},n.unhandledRejection=function(e){n.formatAndLogError(e,"^--- With additional stack trace: ")},n.isSupported=function(){return"function"==typeof x},n.fireRejectionEvent=function(e,t,r,o){var i=!1;try{"function"==typeof t&&(i=!0,"rejectionHandled"===e?t(o):t(r,o))}catch(e){p.throwLater(e)}var a=!1;try{a=w(e,r,o)}catch(e){a=!0,p.throwLater(e)}var s=!1;if(b)try{s=b(e.toLowerCase(),{reason:r,promise:o})}catch(e){s=!0,p.throwLater(e)}a||i||s||"unhandledRejection"!==e||n.formatAndLogError(r,"Unhandled rejection ")};var y=function(){return!1},_=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;n.setBounds=function(e,t){if(n.isSupported()){for(var r,o,i=e.stack.split("\n"),a=t.stack.split("\n"),s=-1,u=-1,l=0;l=u||(y=function(e){if(f.test(e))return!0;var t=c(e);return!!(t&&t.fileName===r&&s<=t.line&&t.line<=u)})}};var b,x=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():u(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit=Error.stackTraceLimit+6,m=e,v=t;var n=Error.captureStackTrace;return y=function(e){return f.test(e)},function(e,t){Error.stackTraceLimit=Error.stackTraceLimit+6,n(e,t),Error.stackTraceLimit=Error.stackTraceLimit-6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return m=/@/,v=t,g=!0,function(e){e.stack=(new Error).stack};var o;try{throw new Error}catch(e){o="stack"in e}return"stack"in r||!o||"number"!=typeof Error.stackTraceLimit?(v=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?u(t):t.toString()},null):(m=e,v=t,function(e){Error.stackTraceLimit=Error.stackTraceLimit+6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit=Error.stackTraceLimit-6})}([]),w=function(){if(d.isNode)return function(e,n,r){return"rejectionHandled"===e?t.emit(e,r):t.emit(e,n,r)};var e=!1,n=!0;try{var r=new self.CustomEvent("test");e=r instanceof CustomEvent}catch(e){}if(!e)try{var o=document.createEvent("CustomEvent");o.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(o)}catch(e){n=!1}n&&(b=function(t,n){var r;return e?r=new self.CustomEvent(t,{detail:n,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(r=document.createEvent("CustomEvent"),r.initCustomEvent(t,!1,!0,n)),!!r&&!self.dispatchEvent(r)});var i={};return i.unhandledRejection="onunhandledRejection".toLowerCase(),i.rejectionHandled="onrejectionHandled".toLowerCase(),function(e,t,n){var r=i[e],o=self[r];return!!o&&("rejectionHandled"===e?o.call(self,n):o.call(self,t,n),!0)}}();return"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(h=function(e){console.warn(e)},d.isNode&&t.stderr.isTTY?h=function(e){t.stderr.write(""+e+"\n")}:d.isNode||"string"!=typeof(new Error).stack||(h=function(e){console.warn("%c"+e,"color: red")})),n}},{"./async.js":2,"./util.js":38}],8:[function(e,t,n){"use strict";t.exports=function(t){function n(e,t,n){this._instances=e,this._callback=t,this._promise=n}function r(e,t){var n={},r=a(e).call(n,t);if(r===s)return r;var o=u(n);return o.length?(s.e=new l("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"),s):r}var o=e("./util.js"),i=e("./errors.js"),a=o.tryCatch,s=o.errorObj,u=e("./es5.js").keys,l=i.TypeError;return n.prototype.doFilter=function(e){for(var n=this._callback,o=this._promise,i=o._boundValue(),u=0,l=this._instances.length;u=0)return a[e]}var a=[];return r.prototype._pushContext=function(){n()&&void 0!==this._trace&&a.push(this._trace)},r.prototype._popContext=function(){n()&&void 0!==this._trace&&a.pop()},e.prototype._peekContext=i,e.prototype._pushContext=r.prototype._pushContext,e.prototype._popContext=r.prototype._popContext,o}},{}],10:[function(e,n,r){"use strict";n.exports=function(n,r){var o,i,a=n._getDomain,s=e("./async.js"),u=e("./errors.js").Warning,l=e("./util.js"),c=l.canAttachTrace,h=l.isNode&&(!!t.env.BLUEBIRD_DEBUG||"development"===t.env.NODE_ENV);return l.isNode&&0==t.env.BLUEBIRD_DEBUG&&(h=!1),h&&s.disableTrampolineIfNecessary(),n.prototype._ignoreRejections=function(){this._unsetRejectionIsUnhandled(),this._bitField=16777216|this._bitField},n.prototype._ensurePossibleRejectionHandled=function(){0===(16777216&this._bitField)&&(this._setRejectionIsUnhandled(),s.invokeLater(this._notifyUnhandledRejection,this,void 0))},n.prototype._notifyUnhandledRejectionIsHandled=function(){r.fireRejectionEvent("rejectionHandled",o,void 0,this)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._getCarriedStackTrace()||this._settledValue;this._setUnhandledRejectionIsNotified(),r.fireRejectionEvent("unhandledRejection",i,e,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=524288|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&-524289},n.prototype._isUnhandledRejectionNotified=function(){return(524288&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=2097152|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&-2097153,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(2097152&this._bitField)>0},n.prototype._setCarriedStackTrace=function(e){this._bitField=1048576|this._bitField,this._fulfillmentHandler0=e},n.prototype._isCarryingStackTrace=function(){return(1048576&this._bitField)>0},n.prototype._getCarriedStackTrace=function(){return this._isCarryingStackTrace()?this._fulfillmentHandler0:void 0},n.prototype._captureStackTrace=function(){return h&&(this._trace=new r(this._peekContext())),this},n.prototype._attachExtraTrace=function(e,t){if(h&&c(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var o=r.parseStackAndMessage(e);l.notEnumerableProp(e,"stack",o.message+"\n"+o.stack.join("\n")),l.notEnumerableProp(e,"__stackCleaned__",!0)}}},n.prototype._warn=function(e){var t=new u(e),n=this._peekContext();if(n)n.attachExtraTrace(t);else{var o=r.parseStackAndMessage(t);t.stack=o.message+"\n"+o.stack.join("\n")}r.formatAndLogError(t,"")},n.onPossiblyUnhandledRejection=function(e){var t=a();i="function"==typeof e?null===t?e:t.bind(e):void 0},n.onUnhandledRejectionHandled=function(e){var t=a();o="function"==typeof e?null===t?e:t.bind(e):void 0},n.longStackTraces=function(){if(s.haveItemsQueued()&&h===!1)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/DT1qyG\n");h=r.isSupported(),h&&s.disableTrampolineIfNecessary()},n.hasLongStackTraces=function(){return h&&r.isSupported()},r.isSupported()||(n.longStackTraces=function(){},h=!1),function(){return h}}},{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(e,t,n){"use strict";var r=e("./util.js"),o=r.isPrimitive;t.exports=function(e){var t=function(){return this},n=function(){throw this},r=function(){},i=function(){throw void 0},a=function(e,t){return 1===t?function(){throw e}:2===t?function(){return e}:void 0};e.prototype.return=e.prototype.thenReturn=function(n){return void 0===n?this.then(r):o(n)?this._then(a(n,2),void 0,void 0,void 0,void 0):(n instanceof e&&n._ignoreRejections(),this._then(t,void 0,void 0,n,void 0))},e.prototype.throw=e.prototype.thenThrow=function(e){return void 0===e?this.then(i):o(e)?this._then(a(e,1),void 0,void 0,void 0,void 0):this._then(n,void 0,void 0,e,void 0)}}},{"./util.js":38}],12:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.reduce;e.prototype.each=function(e){return n(this,e,null,t)},e.each=function(e,r){return n(e,r,null,t)}}},{}],13:[function(e,t,n){"use strict";function r(e,t){function n(r){return this instanceof n?(h(this,"message","string"==typeof r?r:t),h(this,"name",e),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return c(n,Error),n}function o(e){return this instanceof o?(h(this,"name","OperationalError"),h(this,"message",e),this.cause=e,this.isOperational=!0,void(e instanceof Error?(h(this,"message",e.message),h(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new o(e)}var i,a,s=e("./es5.js"),u=s.freeze,l=e("./util.js"),c=l.inherits,h=l.notEnumerableProp,p=r("Warning","warning"),d=r("CancellationError","cancellation error"),f=r("TimeoutError","timeout error"),m=r("AggregateError","aggregate error");try{i=TypeError,a=RangeError}catch(e){i=r("TypeError","type error"),a=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g0&&"function"==typeof arguments[t]){e=arguments[t];var r}for(var o=arguments.length,i=new Array(o),a=0;a=1?[]:m,c.invoke(s,this,void 0)}function s(){this._init$(void 0,-2)}function u(e,t,n,r){var o="object"==typeof n&&null!==n?n.concurrency:0;return o="number"==typeof o&&isFinite(o)&&o>=1?o:0,new a(e,t,o,r)}var l=t._getDomain,c=e("./async.js"),h=e("./util.js"),p=h.tryCatch,d=h.errorObj,f={},m=[];h.inherits(a,n),a.prototype._init=function(){},a.prototype._promiseFulfilled=function(e,n){var r=this._values,i=this.length(),a=this._preservedValues,s=this._limit;if(r[n]===f){if(r[n]=e,s>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return}else{if(s>=1&&this._inFlight>=s)return r[n]=e,void this._queue.push(n);null!==a&&(a[n]=e);var u=this._callback,l=this._promise._boundValue();this._promise._pushContext();var c=p(u).call(l,e,n,i);if(this._promise._popContext(),c===d)return this._reject(c.e);var h=o(c,this._promise);if(h instanceof t){if(h=h._target(),h._isPending())return s>=1&&this._inFlight++,r[n]=f,h._proxyPromiseArray(this,n);if(!h._isFulfilled())return this._reject(h._reason());c=h._value()}r[n]=c}var m=++this._totalResolved;m>=i&&(null!==a?this._filter(r,a):this._resolve(r))},a.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight1){var n,o=new Array(t-1),i=0;for(n=0;n0&&"function"!=typeof e&&"function"!=typeof t){var r=".then() only accepts functions but was passed: "+l.classString(e);arguments.length>1&&(r+=", "+l.classString(t)),this._warn(r)}return this._then(e,t,n,void 0,void 0)},r.prototype.done=function(e,t,n){var r=this._then(e,t,n,void 0,void 0);r._setIsFinal()},r.prototype.spread=function(e,t){return this.all()._then(e,t,void 0,m,void 0)},r.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable()},r.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1, +fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},r.prototype.all=function(){return new y(this).promise()},r.prototype.error=function(e){return this.caught(l.originatesFromRejection,e)},r.getNewLibraryCopy=n.exports,r.is=function(e){return e instanceof r},r.fromNode=function(e){var t=new r(f),n=S(e)(M(t));return n===C&&t._rejectCallback(n.e,!0,!0),t},r.all=function(e){return new y(e).promise()},r.defer=r.pending=function(){var e=new r(f);return new E(e)},r.cast=function(e){var t=g(e);if(!(t instanceof r)){var n=t;t=new r(f),t._fulfillUnchecked(n)}return t},r.resolve=r.fulfilled=r.cast,r.reject=r.rejected=function(e){var t=new r(f);return t._captureStackTrace(),t._rejectCallback(e,!0),t},r.setScheduler=function(e){if("function"!=typeof e)throw new d("fn must be a function\n\n See http://goo.gl/916lJJ\n");var t=h._schedule;return h._schedule=e,t},r.prototype._then=function(e,t,n,o,a){var s=void 0!==a,u=s?a:new r(f);s||(u._propagateFrom(this,5),u._captureStackTrace());var l=this._target();l!==this&&(void 0===o&&(o=this._boundTo),s||u._setIsMigrated());var c=l._addCallbacks(e,t,n,u,o,i());return l._isResolved()&&!l._isSettlePromisesQueued()&&h.invoke(l._settlePromiseAtPostResolution,l,c),u},r.prototype._settlePromiseAtPostResolution=function(e){this._isRejectionUnhandled()&&this._unsetRejectionIsUnhandled(),this._settlePromiseAt(e)},r.prototype._length=function(){return 131071&this._bitField},r.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},r.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},r.prototype._setLength=function(e){this._bitField=this._bitField&-131072|131071&e},r.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},r.prototype._setRejected=function(){this._bitField=134217728|this._bitField},r.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},r.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},r.prototype._isFinal=function(){return(33554432&this._bitField)>0},r.prototype._cancellable=function(){return(67108864&this._bitField)>0},r.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},r.prototype._unsetCancellable=function(){this._bitField=this._bitField&-67108865},r.prototype._setIsMigrated=function(){this._bitField=4194304|this._bitField},r.prototype._unsetIsMigrated=function(){this._bitField=this._bitField&-4194305},r.prototype._isMigrated=function(){return(4194304&this._bitField)>0},r.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[5*e-5+4];if(t!==c)return void 0===t&&this._isBound()?this._boundValue():t},r.prototype._promiseAt=function(e){return 0===e?this._promise0:this[5*e-5+3]},r.prototype._fulfillmentHandlerAt=function(e){return 0===e?this._fulfillmentHandler0:this[5*e-5+0]},r.prototype._rejectionHandlerAt=function(e){return 0===e?this._rejectionHandler0:this[5*e-5+1]},r.prototype._boundValue=function(){var e=this._boundTo;return void 0!==e&&e instanceof r?e.isFulfilled()?e.value():void 0:e},r.prototype._migrateCallbacks=function(e,t){var n=e._fulfillmentHandlerAt(t),o=e._rejectionHandlerAt(t),i=e._progressHandlerAt(t),a=e._promiseAt(t),s=e._receiverAt(t);a instanceof r&&a._setIsMigrated(),void 0===s&&(s=c),this._addCallbacks(n,o,i,a,s,null)},r.prototype._addCallbacks=function(e,t,n,r,o,i){var a=this._length();if(a>=131066&&(a=0,this._setLength(0)),0===a)this._promise0=r,void 0!==o&&(this._receiver0=o),"function"!=typeof e||this._isCarryingStackTrace()||(this._fulfillmentHandler0=null===i?e:i.bind(e)),"function"==typeof t&&(this._rejectionHandler0=null===i?t:i.bind(t)),"function"==typeof n&&(this._progressHandler0=null===i?n:i.bind(n));else{var s=5*a-5;this[s+3]=r,this[s+4]=o,"function"==typeof e&&(this[s+0]=null===i?e:i.bind(e)),"function"==typeof t&&(this[s+1]=null===i?t:i.bind(t)),"function"==typeof n&&(this[s+2]=null===i?n:i.bind(n))}return this._setLength(a+1),a},r.prototype._setProxyHandlers=function(e,t){var n=this._length();if(n>=131066&&(n=0,this._setLength(0)),0===n)this._promise0=t,this._receiver0=e;else{var r=5*n-5;this[r+3]=t,this[r+4]=e}this._setLength(n+1)},r.prototype._proxyPromiseArray=function(e,t){this._setProxyHandlers(e,t)},r.prototype._resolveCallback=function(e,t){if(!this._isFollowingOrFulfilledOrRejected()){if(e===this)return this._rejectCallback(a(),!1,!0);var n=g(e,this);if(!(n instanceof r))return this._fulfill(e);var o=1|(t?4:0);this._propagateFrom(n,o);var i=n._target();if(i._isPending()){for(var s=this._length(),u=0;u0&&e._cancellable()&&(this._setCancellable(),this._cancellationParent=e),(4&t)>0&&e._isBound()&&this._setBoundTo(e._boundTo)},r.prototype._fulfill=function(e){this._isFollowingOrFulfilledOrRejected()||this._fulfillUnchecked(e)},r.prototype._reject=function(e,t){this._isFollowingOrFulfilledOrRejected()||this._rejectUnchecked(e,t)},r.prototype._settlePromiseAt=function(e){var t=this._promiseAt(e),n=t instanceof r;if(n&&t._isMigrated())return t._unsetIsMigrated(),h.invoke(this._settlePromiseAt,this,e);var o=this._isFulfilled()?this._fulfillmentHandlerAt(e):this._rejectionHandlerAt(e),i=this._isCarryingStackTrace()?this._getCarriedStackTrace():void 0,a=this._settledValue,s=this._receiverAt(e);this._clearCallbackDataAtIndex(e),"function"==typeof o?n?this._settlePromiseFromHandler(o,s,a,t):o.call(s,a,t):s instanceof y?s._isResolved()||(this._isFulfilled()?s._promiseFulfilled(a,t):s._promiseRejected(a,t)):n&&(this._isFulfilled()?t._fulfill(a):t._reject(a,i)),e>=4&&4===(31&e)&&h.invokeLater(this._setLength,this,0)},r.prototype._clearCallbackDataAtIndex=function(e){if(0===e)this._isCarryingStackTrace()||(this._fulfillmentHandler0=void 0),this._rejectionHandler0=this._progressHandler0=this._receiver0=this._promise0=void 0;else{var t=5*e-5;this[t+3]=this[t+4]=this[t+0]=this[t+1]=this[t+2]=void 0}},r.prototype._isSettlePromisesQueued=function(){return(this._bitField&-1073741824)===-1073741824},r.prototype._setSettlePromisesQueued=function(){this._bitField=this._bitField|-1073741824},r.prototype._unsetSettlePromisesQueued=function(){this._bitField=1073741823&this._bitField},r.prototype._queueSettlePromises=function(){h.settlePromises(this),this._setSettlePromisesQueued()},r.prototype._fulfillUnchecked=function(e){if(e===this){var t=a();return this._attachExtraTrace(t),this._rejectUnchecked(t,void 0)}this._setFulfilled(),this._settledValue=e,this._cleanValues(),this._length()>0&&this._queueSettlePromises()},r.prototype._rejectUncheckedCheckError=function(e){var t=l.ensureErrorObject(e);this._rejectUnchecked(e,t===e?void 0:t)},r.prototype._rejectUnchecked=function(e,t){if(e===this){var n=a();return this._attachExtraTrace(n),this._rejectUnchecked(n)}return this._setRejected(),this._settledValue=e,this._cleanValues(),this._isFinal()?void h.throwLater(function(e){throw"stack"in e&&h.invokeFirst(_.unhandledRejection,void 0,e),e},void 0===t?e:t):(void 0!==t&&t!==e&&this._setCarriedStackTrace(t),void(this._length()>0?this._queueSettlePromises():this._ensurePossibleRejectionHandled()))},r.prototype._settlePromises=function(){this._unsetSettlePromisesQueued();for(var e=this._length(),t=0;t=this._length&&this._resolve(this._values)},a.prototype._promiseRejected=function(e,t){this._totalResolved++,this._reject(e)},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(e){return e},a}},{"./util.js":38}],25:[function(e,t,n){"use strict";function r(e){return e instanceof Error&&d.getPrototypeOf(e)===Error.prototype}function o(e){var t;if(r(e)){t=new h(e),t.name=e.name,t.message=e.message,t.stack=e.stack;for(var n=d.keys(e),o=0;o2){for(var i=arguments.length,a=new Array(i-1),s=1;s=this._length){for(var r={},o=this.length(),i=0,a=this.length();i>1},t.prototype.props=function(){return a(this)},t.props=function(e){return a(e)}}},{"./es5.js":14,"./util.js":38}],28:[function(e,t,n){"use strict";function r(e,t,n,r,o){for(var i=0;i=this._length&&this._resolve(this._values)},r.prototype._promiseFulfilled=function(e,t){var n=new o;n._bitField=268435456,n._settledValue=e,this._promiseResolved(t,n)},r.prototype._promiseRejected=function(e,t){var n=new o;n._bitField=134217728,n._settledValue=e,this._promiseResolved(t,n)},t.settle=function(e){return new r(e).promise()},t.prototype.settle=function(){return new r(this).promise()}}},{"./util.js":38}],33:[function(e,t,n){"use strict";t.exports=function(t,n,r){function o(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function i(e,t){if((0|t)!==t||t<0)return r("expecting a positive integer\n\n See http://goo.gl/1wAmHx\n");var n=new o(e),i=n.promise();return n.setHowMany(t),n.init(),i}var a=e("./util.js"),s=e("./errors.js").RangeError,u=e("./errors.js").AggregateError,l=a.isArray;a.inherits(o,n),o.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var e=l(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},o.prototype.init=function(){this._initialized=!0,this._init()},o.prototype.setUnwrap=function(){this._unwrap=!0},o.prototype.howMany=function(){return this._howMany},o.prototype.setHowMany=function(e){this._howMany=e},o.prototype._promiseFulfilled=function(e){this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values))},o.prototype._promiseRejected=function(e){if(this._addRejected(e),this.howMany()>this._canPossiblyFulfill()){for(var t=new u,n=this.length();n0},t.prototype.isRejected=e.prototype._isRejected=function(){return(134217728&this._bitField)>0},t.prototype.isPending=e.prototype._isPending=function(){return 0===(402653184&this._bitField)},t.prototype.isResolved=e.prototype._isResolved=function(){return(402653184&this._bitField)>0},e.prototype.isPending=function(){return this._target()._isPending()},e.prototype.isRejected=function(){return this._target()._isRejected()},e.prototype.isFulfilled=function(){return this._target()._isFulfilled()},e.prototype.isResolved=function(){return this._target()._isResolved()},e.prototype._value=function(){return this._settledValue},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue},e.prototype.value=function(){var e=this._target();if(!e.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n");return e._settledValue},e.prototype.reason=function(){var e=this._target();if(!e.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n");return e._unsetRejectionIsUnhandled(),e._settledValue},e.PromiseInspection=t}},{}],35:[function(e,t,n){"use strict";t.exports=function(t,n){function r(e,r){if(l(e)){if(e instanceof t)return e;if(i(e)){var c=new t(n);return e._then(c._fulfillUnchecked,c._rejectUncheckedCheckError,c._progressUnchecked,c,null),c}var h=s.tryCatch(o)(e);if(h===u){r&&r._pushContext();var c=t.reject(h.e);return r&&r._popContext(),c}if("function"==typeof h)return a(e,h,r)}return e}function o(e){return e.then}function i(e){return c.call(e,"_promise0")}function a(e,r,o){function i(e){c&&(c._resolveCallback(e),c=null)}function a(e){c&&(c._rejectCallback(e,p,!0),c=null)}function l(e){c&&"function"==typeof c._progress&&c._progress(e)}var c=new t(n),h=c;o&&o._pushContext(),c._captureStackTrace(),o&&o._popContext();var p=!0,d=s.tryCatch(r).call(e,i,a,l);return p=!1,c&&d===u&&(c._rejectCallback(d.e,!0,!0),c=null),h}var s=e("./util.js"),u=s.errorObj,l=s.isObject,c={}.hasOwnProperty;return r}},{"./util.js":38}],36:[function(e,t,n){"use strict";t.exports=function(t,n){function r(e){var t=this;return t instanceof Number&&(t=+t),clearTimeout(t),e}function o(e){var t=this;throw t instanceof Number&&(t=+t),clearTimeout(t),e}var i=e("./util.js"),a=t.TimeoutError,s=function(e,t){if(e.isPending()){var n;!i.isPrimitive(t)&&t instanceof Error?n=t:("string"!=typeof t&&(t="operation timed out"),n=new a(t)),i.markAsOriginatingFromRejection(n),e._attachExtraTrace(n),e._cancel(n)}},u=function(e){return l(+this).thenReturn(e)},l=t.delay=function(e,r){if(void 0===r){r=e,e=void 0;var o=new t(n);return setTimeout(function(){o._fulfill()},r),o}return r=+r,t.resolve(e)._then(u,null,null,r,void 0)};t.prototype.delay=function(e){return l(this,e)},t.prototype.timeout=function(e,t){e=+e;var n=this.then().cancellable();n._cancellationParent=this;var i=setTimeout(function(){s(n,t)},e);return n._then(r,o,void 0,i,void 0)}}},{"./util.js":38}],37:[function(e,t,n){"use strict";t.exports=function(t,n,r,o){function i(e){for(var n=e.length,r=0;r=u)return l.resolve();var c=s(e[i++]);if(c instanceof t&&c._isDisposable()){try{c=r(c._getDisposer().tryDispose(n),e.promise)}catch(e){return a(e)}if(c instanceof t)return c._then(o,a,null,null,null)}o()}var i=0,u=e.length,l=t.defer();return o(),l.promise}function l(e){var t=new v;return t._settledValue=e,t._bitField=268435456,u(this,t).thenReturn(e)}function c(e){var t=new v;return t._settledValue=e,t._bitField=134217728,u(this,t).thenThrow(e)}function h(e,t,n){this._data=e,this._promise=t,this._context=n}function p(e,t,n){this.constructor$(e,t,n)}function d(e){return h.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}var f=e("./errors.js").TypeError,m=e("./util.js").inherits,v=t.PromiseInspection;h.prototype.data=function(){return this._data},h.prototype.promise=function(){return this._promise},h.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},h.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=null!==t?this.doDispose(t,e):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},h.isDisposer=function(e){return null!=e&&"function"==typeof e.resource&&"function"==typeof e.tryDispose},m(p,h),p.prototype.doDispose=function(e,t){var n=this.data();return n.call(e,e,t)},t.using=function(){var e=arguments.length;if(e<2)return n("you must pass at least 2 arguments to Promise.using");var o=arguments[e-1];if("function"!=typeof o)return n("fn must be a function\n\n See http://goo.gl/916lJJ\n");var a,s=!0;2===e&&Array.isArray(arguments[0])?(a=arguments[0],e=a.length,s=!1):(a=arguments,e--);for(var u=new Array(e),p=0;p0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=this._bitField&-262145,this._disposer=void 0},t.prototype.disposer=function(e){if("function"==typeof e)return new p(e,this,o());throw new f}}},{"./errors.js":13,"./util.js":38}],38:[function(e,n,r){"use strict";function o(){try{var e=T;return T=null,e.apply(this,arguments)}catch(e){return S.e=e,S}}function i(e){return T=e,o}function a(e){return null==e||e===!0||e===!1||"string"==typeof e||"number"==typeof e}function s(e){return!a(e)}function u(e){return a(e)?new Error(g(e)):e}function l(e,t){var n,r=e.length,o=new Array(r+1);for(n=0;n1,r=t.length>0&&!(1===t.length&&"constructor"===t[0]),o=P.test(e+"")&&E.names(e).length>0;if(n||r||o)return!0}return!1}catch(e){return!1}}function f(e){function t(){}t.prototype=e;for(var n=8;n--;)new t;return e}function m(e){return O.test(e)}function v(e,t,n){for(var r=new Array(e),o=0;o10||e[0]>0}(),D.isNode&&D.toFastProperties(t);try{throw new Error}catch(e){D.lastLineError=e}n.exports=D},{"./es5.js":14}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(t,n(1),function(){return this}(),n(323).setImmediate)},function(e,t,n){"use strict";var r=n(32),o=n(51),i=o(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"==typeof n&&i(e,".prototype.")>-1?o(n):n}},function(e,t){"use strict";e.exports=SyntaxError},function(e,t,n){"use strict";var r=n(32),o=r("%Object.getOwnPropertyDescriptor%",!0);if(o)try{o([],"length")}catch(e){o=null}e.exports=o},function(e,t){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;var r=42;e[t]=r;for(t in e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var o=Object.getOwnPropertySymbols(e);if(1!==o.length||o[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(i.value!==r||i.enumerable!==!0)return!1}return!0}},function(e,t){"use strict";var n=function(e){return e!==e};e.exports=function(e,t){return 0===e&&0===t?1/e===1/t:e===t||!(!n(e)||!n(t))}},function(e,t,n){"use strict";var r=n(90);e.exports=function(){return"function"==typeof Object.is?Object.is:r}},function(e,t,n){"use strict";var r=Array.prototype.slice,o=n(93),i=Object.keys,a=i?function(e){return i(e)}:n(200),s=Object.keys;a.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return s(o(e)?r.call(e):e)})}else Object.keys=a;return Object.keys||a},e.exports=a},function(e,t){"use strict";var n=Object.prototype.toString;e.exports=function(e){var t=n.call(e),r="[object Arguments]"===t;return r||(r="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===n.call(e.callee)),r}},function(e,t,n){"use strict";var r=n(204),o=n(27),i=Object;e.exports=r(function(){if(null==this||this!==i(this))throw new o("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)},function(e,t,n){"use strict";var r=n(94),o=n(31).supportsDescriptors,i=Object.getOwnPropertyDescriptor;e.exports=function(){if(o&&"gim"===/a/gim.flags){var e=i(RegExp.prototype,"flags");if(e&&"function"==typeof e.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var t="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(n,"sticky",{get:function(){t+="y"}}),"dy"===t)return e.get}}return r}},function(e,t,n){(function(t){"use strict";var r=n(16),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,n,o){return e.addEventListener?(e.addEventListener(n,o,!0),{remove:function(){e.removeEventListener(n,o,!0)}}):("production"!==t.env.NODE_ENV&&console.error("Attempted to listen to events during the capture phase on a browser that does not support the capture phase. Your application will not receive some events."),{remove:r})},registerDefault:function(){}};e.exports=o}).call(t,n(1))},function(e,t,n){"use strict";function r(e,t){var n=!0;e:for(;n;){var r=e,i=t;if(n=!1,r&&i){if(r===i)return!0;if(o(r))return!1;if(o(i)){e=r,t=i.parentNode,n=!0;continue e}return r.contains?r.contains(i):!!r.compareDocumentPosition&&!!(16&r.compareDocumentPosition(i))}return!1}}var o=n(214);e.exports=r},function(e,t){"use strict";function n(e){try{e.focus()}catch(e){}}e.exports=n},function(e,t){"use strict";function n(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}e.exports=n},function(e,t,n){(function(t){"use strict";function r(e){return a?void 0:"production"!==t.env.NODE_ENV?i(!1,"Markup wrapping node not initialized"):i(!1),p.hasOwnProperty(e)||(e="*"),s.hasOwnProperty(e)||("*"===e?a.innerHTML="":a.innerHTML="<"+e+">",s[e]=!a.firstChild),s[e]?p[e]:null}var o=n(7),i=n(2),a=o.canUseDOM?document.createElement("div"):null,s={},u=[1,'"],l=[1,"","
"],c=[3,"","
"],h=[1,'',""],p={"*":[1,"?

"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:u,option:u,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c},d=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];d.forEach(function(e){p[e]=h,s[e]=!0}),e.exports=r}).call(t,n(1))},function(e,t){"use strict";function n(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var i=r.bind(t),a=0;a=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122?t+=e[r]:i<128?t+=n.hexTable[i]:i<2048?t+=n.hexTable[192|i>>6]+n.hexTable[128|63&i]:i<55296||i>=57344?t+=n.hexTable[224|i>>12]+n.hexTable[128|i>>6&63]+n.hexTable[128|63&i]:(++r,i=65536+((1023&i)<<10|1023&e.charCodeAt(r)),t+=n.hexTable[240|i>>18]+n.hexTable[128|i>>12&63]+n.hexTable[128|i>>6&63]+n.hexTable[128|63&i])}return t},t.compact=function(e,n){if("object"!=typeof e||null===e)return e;n=n||[];var r=n.indexOf(e);if(r!==-1)return n[r];if(n.push(e),Array.isArray(e)){for(var o=[],i=0,a=e.length;i=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return 0===e.button}function u(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function l(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}t.__esModule=!0;var c=Object.assign||function(e){for(var t=1;t elements are for router configuration only and should not be rendered"):u.default(!1)},t}(l.Component);g.createRouteFromReactElement=function(e){var t=h.createRouteFromReactElement(e);return t.from&&(t.path=t.from),t.onEnter=function(e,n){var r=e.location,o=e.params,i=void 0;if("/"===t.to.charAt(0))i=p.formatPattern(t.to,o);else if(t.to){var a=e.routes.indexOf(t),s=g.getRoutePattern(e.routes,a-1),u=s.replace(/\/*$/,"/")+t.to;i=p.formatPattern(u,o)}else i=r.pathname;n(t.state||r.state,i,t.query||r.query)},t},g.getRoutePattern=function(e,t){for(var n="",r=t;r>=0;r--){var o=e[r],i=o.path||"";if(n=i.replace(/\/*$/,"/")+n,0===i.indexOf("/"))break}return"/"+n},g.propTypes={path:m,from:m,to:m.isRequired,query:v,state:v,onEnter:d.falsy,children:d.falsy},t.default=g,e.exports=t.default}).call(t,n(1))},function(e,t,n){(function(r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=Object.assign||function(e){for(var t=1;t=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var o=n(255),i=n(128),a=n(12),s=n(49),u=n(78),l=n(2),c={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:u,processUpdates:function(e,n){for(var a,c=null,h=null,p=0;p when using tables, nesting tags like ,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",d,m):l(!1),c=c||{},c[m]=c[m]||[],c[m][d]=f,h=h||[],h.push(f)}var v;if(v=n.length&&"string"==typeof n[0]?o.dangerouslyRenderMarkup(n):n,h)for(var g=0;g-1?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):a(!1),!l.plugins[r]){n.extractEvents?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):a(!1),l.plugins[r]=n;var i=n.eventTypes;for(var c in i)o(i[c],n,c)?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",c,e):a(!1)}}}function o(e,n,r){l.eventNameDispatchConfigs.hasOwnProperty(r)?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",r):a(!1):void 0,l.eventNameDispatchConfigs[r]=e;var o=e.phasedRegistrationNames;if(o){for(var s in o)if(o.hasOwnProperty(s)){var u=o[s];i(u,n,r)}return!0}return!!e.registrationName&&(i(e.registrationName,n,r),!0)}function i(e,n,r){l.registrationNameModules[e]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):a(!1):void 0,l.registrationNameModules[e]=n,l.registrationNameDependencies[e]=n.eventTypes[r].dependencies}var a=n(2),s=null,u={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):a(!1):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var n=!1;for(var o in e)if(e.hasOwnProperty(o)){var i=e[o];u.hasOwnProperty(o)&&u[o]===i||(u[o]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",o):a(!1):void 0,u[o]=i,n=!0)}n&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in u)u.hasOwnProperty(e)&&delete u[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};e.exports=l}).call(t,n(1))},function(e,t,n){"use strict";function r(e){return(""+e).replace(b,"//")}function o(e,t){this.func=e,this.context=t,this.count=0}function i(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function a(e,t,n){if(null==e)return e;var r=o.getPooled(t,n);g(e,i,r),o.release(r)}function s(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function u(e,t,n){var o=e.result,i=e.keyPrefix,a=e.func,s=e.context,u=a.call(s,t,e.count++);Array.isArray(u)?l(u,o,n,v.thatReturnsArgument):null!=u&&(m.isValidElement(u)&&(u=m.cloneAndReplaceKey(u,i+(u!==t?r(u.key||"")+"/":"")+n)),o.push(u))}function l(e,t,n,o,i){var a="";null!=n&&(a=r(n)+"/");var l=s.getPooled(t,a,o,i);g(e,u,l),s.release(l)}function c(e,t,n){if(null==e)return e;var r=[];return l(e,r,null,t,n),r}function h(e,t,n){return null}function p(e,t){return g(e,h,null)}function d(e){var t=[];return l(e,t,null,v.thatReturnsArgument),t}var f=n(22),m=n(10),v=n(16),g=n(80),y=f.twoArgumentPooler,_=f.fourArgumentPooler,b=/\/(?!\/)/g;o.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},f.addPoolingTo(o,y),s.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},f.addPoolingTo(s,_);var x={forEach:a,map:c,mapIntoWithKeyPrefixInternal:l,count:p,toArray:d};e.exports=x},function(e,t,n){(function(t){"use strict";function r(){T||(T=!0,"production"!==t.env.NODE_ENV?E(!1,"setProps(...) and replaceProps(...) are deprecated. Instead, call render again at the top level."):void 0)}function o(e,n,r){for(var o in n)n.hasOwnProperty(o)&&("production"!==t.env.NODE_ENV?E("function"==typeof n[o],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",v[r],o):void 0)}function i(e,n){var r=A.hasOwnProperty(n)?A[n]:null;P.hasOwnProperty(n)&&(r!==C.OVERRIDE_BASE?"production"!==t.env.NODE_ENV?b(!1,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",n):b(!1):void 0),e.hasOwnProperty(n)&&(r!==C.DEFINE_MANY&&r!==C.DEFINE_MANY_MERGED?"production"!==t.env.NODE_ENV?b(!1,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n):b(!1):void 0)}function a(e,n){if(n){"function"==typeof n?"production"!==t.env.NODE_ENV?b(!1,"ReactClass: You're attempting to use a component class as a mixin. Instead, just use a regular object."):b(!1):void 0,f.isValidElement(n)?"production"!==t.env.NODE_ENV?b(!1,"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object."):b(!1):void 0;var r=e.prototype;n.hasOwnProperty(M)&&N.mixins(e,n.mixins);for(var o in n)if(n.hasOwnProperty(o)&&o!==M){var a=n[o];if(i(r,o),N.hasOwnProperty(o))N[o](e,a);else{var s=A.hasOwnProperty(o),u=r.hasOwnProperty(o),h="function"==typeof a,p=h&&!s&&!u&&n.autobind!==!1;if(p)r.__reactAutoBindMap||(r.__reactAutoBindMap={}),r.__reactAutoBindMap[o]=a,r[o]=a;else if(u){var d=A[o];!s||d!==C.DEFINE_MANY_MERGED&&d!==C.DEFINE_MANY?"production"!==t.env.NODE_ENV?b(!1,"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",d,o):b(!1):void 0,d===C.DEFINE_MANY_MERGED?r[o]=l(r[o],a):d===C.DEFINE_MANY&&(r[o]=c(r[o],a))}else r[o]=a,"production"!==t.env.NODE_ENV&&"function"==typeof a&&n.displayName&&(r[o].displayName=n.displayName+"_"+o)}}}}function s(e,n){if(n)for(var r in n){var o=n[r];if(n.hasOwnProperty(r)){var i=r in N;i?"production"!==t.env.NODE_ENV?b(!1,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',r):b(!1):void 0;var a=r in e;a?"production"!==t.env.NODE_ENV?b(!1,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",r):b(!1):void 0,e[r]=o}}}function u(e,n){e&&n&&"object"==typeof e&&"object"==typeof n?void 0:"production"!==t.env.NODE_ENV?b(!1,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects."):b(!1); +for(var r in n)n.hasOwnProperty(r)&&(void 0!==e[r]?"production"!==t.env.NODE_ENV?b(!1,"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",r):b(!1):void 0,e[r]=n[r]);return e}function l(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return u(o,n),u(o,r),o}}function c(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function h(e,n){var r=n.bind(e);if("production"!==t.env.NODE_ENV){r.__reactBoundContext=e,r.__reactBoundMethod=n,r.__reactBoundArguments=null;var o=e.constructor.displayName,i=r.bind;r.bind=function(a){for(var s=arguments.length,u=Array(s>1?s-1:0),l=1;l-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)&&console.debug("Download the React DevTools for a better development experience: https://fb.me/react-devtools");var y=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV?f(!y,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: '):void 0;for(var _=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim,Object.create,Object.freeze],b=0;b<_.length;b++)if(!_[b]){console.error("One or more ES5 shim/shams expected by React are not available: https://fb.me/react-warning-polyfills");break}}}e.exports=v}).call(t,n(1))},function(e,t){"use strict";var n={useCreateElement:!1};e.exports=n},function(e,t,n){(function(t){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=u.getValue(e);null!=t&&a(this,Boolean(e.multiple),t)}}function o(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}function i(e,n){var r=e._currentElement._owner;u.checkPropTypes("select",n,r);for(var i=0;i must be an array if `multiple` is true.%s",a,o(r)):void 0:"production"!==t.env.NODE_ENV?p(!Array.isArray(n[a]),"The `%s` prop supplied to + + + + + + + + ); + }; + + function runSearch(e) { + searchBoxModel.search(e.target.value); + } + + function runSubmit(e) { + var searchText = React.findDOMNode(x.refs.searchText).value; + searchBoxModel.submit(searchText); + e.preventDefault(); + } +} diff --git a/src/galaxy/service/appEvents.js b/src/galaxy/service/appEvents.js new file mode 100644 index 0000000..b7bc297 --- /dev/null +++ b/src/galaxy/service/appEvents.js @@ -0,0 +1,91 @@ +/** + * Defines list of global events transmitted inside the application. + * + * Views should never listen to these, instead stores and native renderer + * consume these, transform them to view-friendly format and fire store-specific + * events. + */ +import eventify from 'ngraph.events'; +import eventMirror from './eventMirror.js'; + +var appEvents = eventify({}); + +export default eventMirror([ + /** + * Fired when labels are downloaded + */ + 'labelsDownloaded', + + /** + * Fired when positions are downloaded + */ + 'positionsDownloaded', + + /** + * Fired when links are downloaded + */ + 'linksDownloaded', + + /** + * Fired when entire graph is downloaded + */ + 'graphDownloaded', + + /** + * Fired when new galaxy page is opened and graph download is required + */ + 'downloadGraphRequested', + + /** + * Fired when user hover mouse over a node + */ + 'nodeHover', + + /** + * Fired when user wants to select a node + */ + 'selectNode', + + /** + * Fired when user wants to toggle camera steering mode. In steering + * mode camera will always try to focus on mouse position. Thus + * middle point of the screen is the only stable point. + */ + 'toggleSteering', + + /** + * Fired when user wants to show or hide links + */ + 'toggleLinks', + + /** + * Requests the application to show "Steering mode" indicator. + */ + 'showSteeringMode', + + /** + * fired when user inputs a text into the search bar + */ + 'commandBarChanged', + + /** + * fired when user requesed to show or hide help screen + */ + 'toggleHelp', + + // These events are not documented since I'm not sure whether to keep them + 'showNodeListWindow', + 'hideNodeListWindow', + 'showDegree', + 'focusOnNode', + 'focusScene', + 'highlightQuery', + 'queryHighlighted', + 'highlightLinks', + 'cls', + 'around', + 'queryChanged', + + 'accelerateNavigation' +], appEvents); + diff --git a/src/galaxy/service/edgeFinder.js b/src/galaxy/service/edgeFinder.js new file mode 100644 index 0000000..0d0b86f --- /dev/null +++ b/src/galaxy/service/edgeFinder.js @@ -0,0 +1,92 @@ +export default edgeFinder; + +function edgeFinder(from, to, outL, inL, labels) { + var result = []; + var anyFrom = typeof from === 'boolean'; + var anyTo = typeof to === 'boolean'; + if (anyFrom && anyTo) { + // it's either all or nothing: + if (from && to) { + addAllEdges(); + } + return result; + } + + if (anyFrom && !anyTo) { + if (!from) return result; + + addAnyFrom(to, inL); + return result; + } else if (anyTo && !anyFrom) { + if (!to) return result; + + addAnyTo(from, outL); + return result; + } + var indexSource = from; + var iterateSource = to; + var iterateDeps = inL; + + if (from.length > to.length) { + indexSource = to; + iterateSource = from; + iterateDeps = outL; + } + var index = buildIndex(indexSource); + + compositeSearch(); + + return result; + + function buildIndex(src) { + var index = Object.create(null); + for (var i = 0; i < src.length; ++i) { + index[src[i].id] = true; + } + return index; + } + + function compositeSearch() { + for (var i = 0; i < iterateSource.length; ++i) { + var item = iterateSource[i].id; + addIndexed(item, iterateDeps[item]); + } + } + + function addIndexed(nodeId, neighbours) { + if (!neighbours) return; + for (var i = 0; i < neighbours.length; ++i) { + if (index[neighbours[i]]) { + result.push(nodeId, neighbours[i]); + } + } + } + + function addAnyFrom(to, inL) { + for (var i = 0; i < to.length; ++i) { + var nodeId = to[i].id; + addEdges(nodeId, inL[nodeId]); + } + } + + function addAnyTo(from, outL) { + for (var i = 0; i < from.length; ++i) { + var nodeId = from[i].id; + addEdges(nodeId, outL[nodeId]); + } + } + + function addAllEdges() { + for (var i = 0; i < labels.length; ++i) { + addEdges(i, outL[i]); + addEdges(i, inL[i]); + } + } + + function addEdges(node, edges) { + if (!edges) return; + for (var i = 0; i < edges.length; ++i) { + result.push(node, edges[i]); + } + } +} diff --git a/src/galaxy/service/eventMirror.js b/src/galaxy/service/eventMirror.js new file mode 100644 index 0000000..c7263c5 --- /dev/null +++ b/src/galaxy/service/eventMirror.js @@ -0,0 +1,61 @@ +/** + * This is a syntax sugar wrapper which allows consumer to register events on + * a given event bus, later clients can have rich API to consume events. + * + * For example: + * + * // Create a simple event bus: + * var myBus = require('ngraph.events')({}); + * + * // Register several events on this bus: + * var events = eventMirror(['sayHi', 'sayBye'], myBus); + * + * // Now consumers can do: + * events.sayHi.fire('world'); // fire 'sayHi' event, and pass 'world' argument + * + * // this will listen to 'sayHi' event, and will print "Hello world" + * events.sayHi.on(function (name) { console.log('Hello ' + name); }) + * + * // it is also equivalent to + * myBus.fire('sayHi', 'world'); + * myBus.on('sayHi', function (name) { console.log('Hello ' + name); }); + * + * Why? I think having explicit place with all registered events can be + * beneficial for the reader. You can easily find and document all possible + * events in the system. + */ +export default eventMirror; + +function eventMirror(eventNames, eventBus) { + var events = Object.create(null); + eventNames.forEach(setActiveCommand); + + return events; + + function setActiveCommand(eventName, idx) { + events[eventName] = { + id: eventName, + fire: fire(eventName), + on: on(eventName), + off: off(eventName) + }; + } + + function fire(name) { + return function () { + eventBus.fire.apply(this, [name].concat(Array.prototype.slice.call(arguments))); + } + } + + function on(name) { + return function (callback) { + eventBus.on(name, callback); + } + } + + function off(name) { + return function (callback) { + eventBus.off(name, callback); + } + } +} diff --git a/src/galaxy/service/graph.js b/src/galaxy/service/graph.js new file mode 100644 index 0000000..ae22028 --- /dev/null +++ b/src/galaxy/service/graph.js @@ -0,0 +1,111 @@ +/** + * Wrapper on top of graph data. Not sure where it will go yet. + */ +import linkFinder from './edgeFinder.js'; +export default graph; + +function graph(rawGraphLoaderData) { + var {labels, outLinks, inLinks, positions} = rawGraphLoaderData; + var empty = []; + + var api = { + getNodeInfo: getNodeInfo, + getConnected: getConnected, + find: find, + findLinks: findLinks + }; + + return api; + + function findLinks(from, to) { + return linkFinder(from, to, outLinks, inLinks, labels); + } + + function find(query) { + var result = []; + if (!labels) return result; + + if (typeof query === 'string') { + // short circuit if it's blank string - no results + if (!query) return result; + query = regexMatcher(query); + } + + for (var i = 0; i < labels.length; ++i) { + if (query(i, labels, outLinks, inLinks, positions)) { + result.push(getNodeInfo(i)); + } + } + + return result; + } + + function regexMatcher(str) { + var regex = compileRegex(str); + if (!regex) return no; + + return function (i, labels, outLinks, inLinks, pos) { + var label = labels[i]; + if (typeof label === 'string') { + return label.match(regex); + } + return label.toString().match(regex); + } + } + + function no() { return false; } + + function compileRegex(pattern) { + try { + return new RegExp(pattern, 'ig'); + } catch (e) { + // this cannot be compiled. Ignore it. + } + } + + function getConnected(startId, connectionType) { + if (connectionType === 'out') { + return outLinks[startId] || empty; + } else if (connectionType === 'in') { + return inLinks[startId] || empty; + } + return empty; + } + + function getNodeInfo(id) { + if (!labels) return; + + var outLinksCount = 0; + if (outLinks[id]) { + outLinksCount = outLinks[id].length; + } + + var inLinksCount = 0; + if (inLinks[id]) { + inLinksCount = inLinks[id].length; + } + + return { + id: id, + name: labels[id], + out: outLinksCount, + in : inLinksCount + }; + } + + function getName(id) { + if (!labels) return ''; + if (id < 0 || id > labels.length) { + throw new Error(id + " is outside of labels range"); + } + return labels[id]; + } + + function getPositions() { + return positions; + } + + function getLinks() { + return links; + } +} diff --git a/src/galaxy/service/graphLoader.js b/src/galaxy/service/graphLoader.js new file mode 100644 index 0000000..9a69e2b --- /dev/null +++ b/src/galaxy/service/graphLoader.js @@ -0,0 +1,182 @@ +import config from '../../config.js'; +import request from './request.js'; +import createGraph from './graph.js'; +import appEvents from './appEvents.js'; +import appConfig from '../native/appConfig.js'; +import asyncFor from 'rafor'; +import Promise from 'bluebird'; + +export default loadGraph; + +/** + * @param {string} name of the graph to be downloaded + * @param {progressCallback} progress notifies when download progress event is + * received + * @param {completeCallback} complete notifies when all graph files are downloaded + * + */ +function loadGraph(name, progress) { + var positions, labels; + var outLinks = []; + var inLinks = []; + + // todo: handle errors + var manifestEndpoint = config.dataUrl + name; + var galaxyEndpoint = manifestEndpoint; + + var manifest; + + return loadManifest() + .then(loadPositions) + .then(loadLinks) + .then(loadLabels) + .then(convertToGraph); + + function convertToGraph() { + return createGraph({ + positions: positions, + labels: labels, + outLinks: outLinks, + inLinks: inLinks + }); + } + + function loadManifest() { + return request(manifestEndpoint + '/manifest.json?nocache=' + (+new Date()), { + responseType: 'json' + }).then(setManifest); + } + + function setManifest(response) { + manifest = response; + var version = getFromAppConfig(manifest) || manifest.last; + if (manifest.endpoint) { + // the endpoint is overridden. Since we trust manifest endpoint, we also + // trust overridden endpoint: + galaxyEndpoint = manifest.endpoint; + } else { + galaxyEndpoint = manifestEndpoint; + } + galaxyEndpoint += '/' + version; + appConfig.setManifestVersion(version); + } + + function getFromAppConfig(manifest) { + var appConfigVersion = appConfig.getManifestVersion(); + var approvedVersions = manifest && manifest.all; + + // default to the last version: + if (!approvedVersions || !appConfigVersion) return; + + // If this version is whitelisted, let it through: + if (approvedVersions.indexOf(appConfigVersion) >= 0) { + return appConfigVersion; + } + } + + function loadPositions() { + return request(galaxyEndpoint + '/positions.json', { + responseType: 'json', + progress: reportProgress(name, 'positions') + }).then(setPositions); + } + + function setPositions(buffer) { + positions = new Int32Array(buffer['data']); + var scaleFactor = appConfig.getScaleFactor(); + for (var i = 0; i < positions.length; ++i) { + positions[i] *= scaleFactor; + } + appEvents.positionsDownloaded.fire(positions); + } + + function loadLinks() { + return request(galaxyEndpoint + '/links.json', { + responseType: 'json', + progress: reportProgress(name, 'links') + }).then(setLinks); + } + + function setLinks(buffer) { + var links = new Int32Array(buffer['data']); + var lastArray = []; + outLinks[0] = lastArray; + var srcIndex; + var processed = 0; + var total = links.length; + + asyncFor(links, processLink, reportBack); + var deffered = defer(); + function processLink(link) { + if (link < 0) { + srcIndex = -link - 1; + lastArray = outLinks[srcIndex] = []; + } else { + var toNode = link - 1; + lastArray.push(toNode); + if (inLinks[toNode] === undefined) { + inLinks[toNode] = [srcIndex]; + } else { + inLinks[toNode].push(srcIndex); + } + } + processed += 1; + if (processed % 10000 === 0) { + reportLinkProgress(processed / total); + } + } + + function reportLinkProgress(percent) { + progress({ + message: name + ': initializing edges ', + completed: Math.round(percent * 100) + '%' + }); + } + + function reportBack() { + appEvents.linksDownloaded.fire(outLinks, inLinks); + deffered.resolve(); + } + + return deffered.promise; + } + + function loadLabels() { + return request(galaxyEndpoint + '/labels.json', { + responseType: 'json', + progress: reportProgress(name, 'labels') + }).then(setLabels); + } + + function setLabels(data) { + labels = data; + appEvents.labelsDownloaded.fire(labels); + } + + function reportProgress(name, file) { + return function(e) { + let progressInfo = { + message: name + ': downloading ' + file, + }; + if (e.percent !== undefined) { + progressInfo.completed = Math.round(e.percent * 100) + '%' + } else { + progressInfo.completed = Math.round(e.loaded) + ' bytes' + } + progress(progressInfo); + }; + } +} + +function defer() { + var resolve, reject; + var promise = new Promise(function() { + resolve = arguments[0]; + reject = arguments[1]; + }); + return { + resolve: resolve, + reject: reject, + promise: promise + }; +} diff --git a/src/galaxy/service/request.js b/src/galaxy/service/request.js new file mode 100644 index 0000000..5ef9c74 --- /dev/null +++ b/src/galaxy/service/request.js @@ -0,0 +1,67 @@ +/** + * A very basic ajax client with promises and progress reporting. + */ +import Promise from 'bluebird'; + +export default request; + +function request(url, options) { + if (!options) options = {}; + + return new Promise(download); + + function download(resolve, reject) { + var req = new XMLHttpRequest(); + + if (typeof options.progress === 'function') { + req.addEventListener("progress", updateProgress, false); + } + + req.addEventListener("load", transferComplete, false); + req.addEventListener("error", transferFailed, false); + req.addEventListener("abort", transferCanceled, false); + + req.open('GET', url); + if (options.responseType) { + req.responseType = options.responseType; + } + req.send(null); + + function updateProgress(e) { + if (e.lengthComputable) { + options.progress({ + loaded: e.loaded, + total: e.total, + percent: e.loaded / e.total + }); + } else { + options.progress({ + loaded: e.loaded, + }); + } + } + + function transferComplete() { + if (req.status !== 200) { + reject(`Unexpected status code ${req.status} when calling ${url}`); + return; + } + var response = req.response; + + if (options.responseType === 'json' && typeof response === 'string') { + // IE + response = JSON.parse(response); + } + + resolve(response); + } + + function transferFailed() { + reject(`Failed to download ${url}`); + } + + function transferCanceled() { + reject(`Cancelled download of ${url}`); + } + } +} diff --git a/src/galaxy/steeringIndicator.jsx b/src/galaxy/steeringIndicator.jsx new file mode 100644 index 0000000..a672960 --- /dev/null +++ b/src/galaxy/steeringIndicator.jsx @@ -0,0 +1,29 @@ +/** + * This component renders a huge steering wheel, which denotes we are in the + * steering mode (camera follows mouse cursor). + */ +import appEvents from './service/appEvents.js'; +import React from 'react'; + +module.exports = require('maco')(steeringIndicator, React); + +function steeringIndicator(x) { + var showSteeringMode = false; + appEvents.showSteeringMode.on(updateSteering); + + x.render = function () { + if (!showSteeringMode) return null; + + return ( +

+ ); + }; + + function updateSteering(isVisible) { + showSteeringMode = isVisible; + x.forceUpdate(); + } +} diff --git a/src/galaxy/store/baseNodeViewModel.js b/src/galaxy/store/baseNodeViewModel.js new file mode 100644 index 0000000..9af6fa1 --- /dev/null +++ b/src/galaxy/store/baseNodeViewModel.js @@ -0,0 +1,22 @@ +import getGraphSpecificInfo from './graphSepcific/graphSpecificInfo.js'; +import scene from './scene.js'; +import formatNumber from '../utils/formatNumber.js'; + +export default getBaseNodeViewModel; + +function getBaseNodeViewModel(nodeId) { + var graphName = scene.getGraphName(); + var graphSpecificInfo = getGraphSpecificInfo(graphName); + var nodeInfo = scene.getNodeInfo(nodeId); + + return { + name: nodeInfo.name, + id: nodeInfo.id, + + inDegree: formatNumber(nodeInfo.in), + inDegreeLabel: graphSpecificInfo.getInDegreeLabel(nodeInfo.in), + + outDegree: formatNumber(nodeInfo.out), + outDegreeLabel: graphSpecificInfo.getOutDegreeLabel(nodeInfo.out) + }; +} diff --git a/src/galaxy/store/graphSepcific/graphSpecificInfo.js b/src/galaxy/store/graphSepcific/graphSpecificInfo.js new file mode 100644 index 0000000..4433e91 --- /dev/null +++ b/src/galaxy/store/graphSepcific/graphSpecificInfo.js @@ -0,0 +1,48 @@ +export default graphSpecificInfo; + +function graphSpecificInfo(graphName) { + switch(graphName) { + case 'leetcode': + return new PackagesGraph(graphName); + } + return new DefaultGraph(graphName); +} + +function DefaultGraph(graphName) { + this.graphName = graphName; + this.getInDegreeLabel = function getInDegreeLabel(inDegreeValue) { + return 'in-degree'; + }; + + this.getOutDegreeLabel = function getInDegreeLabel(outDegreeValue) { + return 'out-degree'; + }; +} + +function PackagesGraph(graphName) { + DefaultGraph.call(this, graphName); + + this.getInDegreeLabel = function getInDegreeLabel(inDegreeValue) { + return inDegreeValue === 1 ? 'solution' : 'solutions'; + }; + + this.getOutDegreeLabel = function getInDegreeLabel(outDegreeValue) { + return outDegreeValue === 1 ? 'dependency' : 'dependencies'; + }; +} + +function GoGraph(graphName) { + PackagesGraph.call(this, graphName); +} + +function FollowersGraph(graphName) { + DefaultGraph.call(this, graphName); + + this.getInDegreeLabel = function getInDegreeLabel(inDegreeValue) { + return inDegreeValue === 1 ? 'follower' : 'followers'; + }; + + this.getOutDegreeLabel = function getInDegreeLabel(outDegreeValue) { + return 'following'; + }; +} diff --git a/src/galaxy/store/hover.js b/src/galaxy/store/hover.js new file mode 100644 index 0000000..8df39f5 --- /dev/null +++ b/src/galaxy/store/hover.js @@ -0,0 +1,52 @@ +import React from 'react'; +import eventify from 'ngraph.events'; + +import appEvents from '../service/appEvents.js'; +import scene from './scene.js'; +import getBaseNodeViewModel from './baseNodeViewModel.js'; + +export default hoverStore(); + +function hoverStore() { + var store = {}; + eventify(store); + + appEvents.nodeHover.on(prepareViewModelAndNotifyConsumers); + + return store; + + function prepareViewModelAndNotifyConsumers(hoverDetails) { + var hoverTemplate = null; + if (hoverDetails.nodeIndex !== undefined) { + var viewModel = createViewModel(hoverDetails); + hoverTemplate = createDefaultTemplate(viewModel); + } + + store.fire('changed', hoverTemplate); + } + + function createViewModel(model) { + if (model === null) throw new Error('Model is not expected to be null'); + + var hoverViewModel = getBaseNodeViewModel(model.nodeIndex); + hoverViewModel.left = model.mouseInfo.x; + hoverViewModel.top = model.mouseInfo.y; + + return hoverViewModel; + } +} + +function createDefaultTemplate(viewModel) { + var style = { + left: viewModel.left + 20, + top: viewModel.top - 35 + }; + + return ( +
+ {viewModel.name} + {viewModel.inDegree} + {viewModel.outDegree} +
+ ); +} diff --git a/src/galaxy/store/scene.js b/src/galaxy/store/scene.js new file mode 100644 index 0000000..6e00de3 --- /dev/null +++ b/src/galaxy/store/scene.js @@ -0,0 +1,92 @@ +/** + * Manages graph model life cycle. The low-level rendering of the particles + * is handled by ../native/renderer.js + */ +import loadGraph from '../service/graphLoader.js'; +import appEvents from '../service/appEvents.js'; + +import eventify from 'ngraph.events'; + +export default sceneStore(); + +function sceneStore() { + var loadInProgress = true; + var currentGraphName; + var unknownNodeInfo = { + inDegree: '?', + outDegree: '?' + } + + var graph; + + var api = { + isLoading: isLoading, + getGraph: getGraph, + getGraphName: getGraphName, + getNodeInfo: getNodeInfo, + getConnected: getConnected, + find: find + }; + + appEvents.downloadGraphRequested.on(downloadGraph); + + eventify(api); + + return api; + + function find(query) { + return graph.find(query); + } + + function isLoading() { + return loadInProgress; + } + + function downloadGraph(graphName) { + if (graphName === currentGraphName) return; + + loadInProgress = true; + currentGraphName = graphName; + loadGraph(graphName, reportProgress).then(loadComplete); + } + + function getGraph() { + return graph; + } + + function getGraphName() { + return currentGraphName; + } + + function getNodeInfo(nodeId) { + if (!graph) { + unknownNodeInfo.name = nodeId; + return unknownNodeInfo; + } + var nodeInfo = graph.getNodeInfo(nodeId); + // TODO: too tired, need to get this out from here + if (currentGraphName === 'github') { + nodeInfo.icon = 'https://avatars.githubusercontent.com/' + nodeInfo.name; + } + + return nodeInfo; + } + + function getConnected(nodeId, connectionType) { + if (!graph) { + return []; + } + return graph.getConnected(nodeId, connectionType).map(getNodeInfo); + } + + function reportProgress(progress) { + api.fire('loadProgress', progress); + } + + function loadComplete(model) { + loadInProgress = false; + graph = model; + api.fire('loadProgress', {}); + appEvents.graphDownloaded.fire(); + } +} diff --git a/src/galaxy/utils/formatNumber.js b/src/galaxy/utils/formatNumber.js new file mode 100644 index 0000000..4fc22e2 --- /dev/null +++ b/src/galaxy/utils/formatNumber.js @@ -0,0 +1,5 @@ +export default formatNumber; + +function formatNumber(x) { + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); +} diff --git a/src/galaxy/utils/key.js b/src/galaxy/utils/key.js new file mode 100644 index 0000000..9a51f42 --- /dev/null +++ b/src/galaxy/utils/key.js @@ -0,0 +1,12 @@ +export default { + isModifier, + + H: 72, + L: 76, + Space: 32, + '/': 191 +}; + +function isModifier(e) { + return e.altKey || e.ctrlKey || e.metaKey || e.shiftKey; +} diff --git a/src/galaxy/utils/resources.js b/src/galaxy/utils/resources.js new file mode 100644 index 0000000..a97cbae --- /dev/null +++ b/src/galaxy/utils/resources.js @@ -0,0 +1,11 @@ +export default getStaticResource; + +let resources = Object.create(null); + +getStaticResource.add = function add(key, value) { + resources[key] = value; +} + +function getStaticResource(name) { + return resources[name]; +} diff --git a/src/galaxy/windows/nodeInfoRow.jsx b/src/galaxy/windows/nodeInfoRow.jsx new file mode 100644 index 0000000..8504d77 --- /dev/null +++ b/src/galaxy/windows/nodeInfoRow.jsx @@ -0,0 +1,29 @@ +import React from 'react'; +import formatNumber from '../utils/formatNumber.js'; + +module.exports = require('maco').template(windowTitle, React); + +function windowTitle(props) { + var item = props.viewModel; + var image = ''; + if (item.icon) { + image = ; + } + + return ( +
+
+ {image} + + {item.name} + +
+
+ {formatNumber(item.in)} +
+
+ {formatNumber(item.out)} +
+
+ ); +} diff --git a/src/galaxy/windows/nodeListView.jsx b/src/galaxy/windows/nodeListView.jsx new file mode 100644 index 0000000..16647c4 --- /dev/null +++ b/src/galaxy/windows/nodeListView.jsx @@ -0,0 +1,59 @@ +/** + * This component renders list of packages in single window. + * There can be multiple lists opened at any time. The list is currently + * managed by windowCollectionView + */ +import React from 'react'; +import ReactList from 'react-list'; +import WindowTitle from './windowTitle.jsx'; +import NodeInfoRow from './nodeInfoRow.jsx'; + +module.exports = require('maco')(nodeListView, React); +var windowId = 0; + +function nodeListView(x) { + windowId += 1; + + x.render = function () { + var windowViewModel = x.props.viewModel; + var className = 'window-container'; + + if (windowViewModel.className) { + className += ' ' + windowViewModel.className; + } + + var items = windowViewModel.list; + var id = windowId + windowViewModel.className + items.length; + + return ( +
+ +
+ {content(items)} +
+
+ ); + + function renderItem(idx, key) { + var vm = items[idx]; + return ; + } + + function getHeight() { + // FIXME: Hardcoding is not good. + return 20; + } + + function content(items) { + if (items.length > 0) { + return ; + } else { + return null; + } + } + }; +} diff --git a/src/galaxy/windows/windowCollectionModel.js b/src/galaxy/windows/windowCollectionModel.js new file mode 100644 index 0000000..ebe6740 --- /dev/null +++ b/src/galaxy/windows/windowCollectionModel.js @@ -0,0 +1,46 @@ +import appEvents from '../service/appEvents.js'; +import eventify from 'ngraph.events'; + +export default windowCollectionModel(); + +function windowCollectionModel() { + + appEvents.showNodeListWindow.on(showWindow); + appEvents.hideNodeListWindow.on(hideWindow); + + var api = { + getWindows: getWindows + }; + + var registeredWindows = Object.create(null); + var allWindows = []; + + eventify(api); + + return api; + + function getWindows() { + return allWindows; + } + + function showWindow(viewModel, windowId) { + var windowIndex = registeredWindows[windowId]; + if (windowIndex === undefined) { + allWindows.push(viewModel); + windowIndex = registeredWindows[windowId] = allWindows.length - 1; + } else { + allWindows[windowIndex] = viewModel; + } + api.fire('changed'); + } + + function hideWindow(windowId) { + var windowIndex = registeredWindows[windowId]; + if (windowIndex !== undefined) { + delete registeredWindows[windowId]; + allWindows.splice(windowIndex, 1); + + api.fire('changed', windowIndex); + } + } +} diff --git a/src/galaxy/windows/windowCollectionView.jsx b/src/galaxy/windows/windowCollectionView.jsx new file mode 100644 index 0000000..170a062 --- /dev/null +++ b/src/galaxy/windows/windowCollectionView.jsx @@ -0,0 +1,33 @@ +/** + * Renders collection of windows + */ +import React from 'react'; +import NodeListView from './nodeListView.jsx'; +import windowCollectionModel from './windowCollectionModel.js'; + +module.exports = require('maco')(windowCollectionView, React); + +function windowCollectionView(x) { + x.render = function () { + var windows = windowCollectionModel.getWindows(); + if (windows.length === 0) return null; + + return
{windows.map(toWindowView)}
; + }; + + x.componentDidMount = function () { + windowCollectionModel.on('changed', update); + }; + + x.componentWillUnmount = function() { + windowCollectionModel.off('changed', update); + }; + + function toWindowView(windowViewModel, idx) { + return ; + } + + function update() { + x.forceUpdate(); + } +} diff --git a/src/galaxy/windows/windowTitle.jsx b/src/galaxy/windows/windowTitle.jsx new file mode 100644 index 0000000..845bbfb --- /dev/null +++ b/src/galaxy/windows/windowTitle.jsx @@ -0,0 +1,64 @@ +import React from 'react'; +import resource from '../utils/resources.js'; + +var maco = require('maco'); +registerDataTemplates(); + +module.exports = maco.template(windowTitle, React); + +var ContentControl = maco(contentControl, React); + +function windowTitle(props) { + // TODO: Close/drag? + var viewModel = props.viewModel; + return ; +} + + +function contentControl(x) { + x.render = function() { + var viewModel = x.props.viewModel; + var Template; + + if (viewModel) { + Template = contentTemplateSelector(viewModel); + } + if (!Template) { + return
{viewModel}
; + } + + return