Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle.
+
+
In Pascal's triangle, each number is the sum of the two numbers directly above it as shown:
+

+
+
Example 1:
+
Input: rowIndex = 3
+Output: [1,3,3,1]
+
Example 2:
+
Input: rowIndex = 0
+Output: [1]
+
Example 3:
+
Input: rowIndex = 1
+Output: [1,1]
+
+
+
Constraints:
+
+
+
+
+
Follow up: Could you optimize your algorithm to use only O(rowIndex) extra space?
+
\ No newline at end of file
diff --git a/0137-single-number-ii/NOTES.md b/0137-single-number-ii/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0137-single-number-ii/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0143-reorder-list/0143-reorder-list.cpp b/0143-reorder-list/0143-reorder-list.cpp
new file mode 100644
index 00000000..1795ab34
--- /dev/null
+++ b/0143-reorder-list/0143-reorder-list.cpp
@@ -0,0 +1,50 @@
+/**
+ * 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:
+ void reorderList(ListNode* head) {
+
+ if(!head or !head->next)
+ return;
+
+ ListNode* slow = head, *fast = head, *first = nullptr;
+
+ while(fast and fast->next)
+ {
+ first = slow;
+ slow = slow->next;
+ fast = fast->next->next;
+ }
+
+ first->next = nullptr;
+
+ ListNode* prev = nullptr;
+
+ while(slow)
+ {
+ ListNode* nex = slow->next;
+ slow->next = prev;
+ prev = slow;
+ slow = nex;
+ }
+
+ while(head)
+ {
+ ListNode* nex = head->next;
+ head->next = prev;
+ ListNode* nex2 = prev->next;
+ if(nex)
+ prev->next = nex;
+ head = nex;
+ prev = nex2;
+ }
+ }
+};
\ No newline at end of file
diff --git a/0143-reorder-list/README.md b/0143-reorder-list/README.md
new file mode 100644
index 00000000..fa1bf802
--- /dev/null
+++ b/0143-reorder-list/README.md
@@ -0,0 +1,33 @@
+You are given the head of a singly linked-list. The list can be represented as:
+
+
L0 → L1 → … → Ln - 1 → Ln
+
+
+
Reorder the list to be on the following form:
+
+
L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → …
+
+
+
You may not modify the values in the list's nodes. Only nodes themselves may be changed.
+
+
+
Example 1:
+

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

+
Input: head = [1,2,3,4,5]
+Output: [1,5,2,4,3]
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the list is in the range
[1, 5 * 104].
+ 1 <= Node.val <= 1000
+
+
\ No newline at end of file
diff --git a/0148-sort-list/0148-sort-list.cpp b/0148-sort-list/0148-sort-list.cpp
new file mode 100644
index 00000000..65a81cfc
--- /dev/null
+++ b/0148-sort-list/0148-sort-list.cpp
@@ -0,0 +1,55 @@
+/**
+ * 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* merge(ListNode* l1, ListNode* l2)
+ {
+ if(!l1)
+ return l2;
+
+ if(!l2)
+ return l1;
+
+ if(l1->val < l2->val)
+ {
+ l1->next = merge(l1->next, l2);
+ return l1;
+ }
+ else
+ {
+ l2->next = merge(l1, l2->next);
+ return l2;
+ }
+ }
+
+ ListNode* sortList(ListNode* head) {
+
+ if(!head or !head->next)
+ return head;
+
+ ListNode* slow = head, *fast = head, *prev = nullptr;
+
+ while(fast and fast->next)
+ {
+ prev = slow;
+ slow = slow->next;
+ fast = fast->next->next;
+ }
+
+ prev->next = nullptr;
+
+ ListNode* l1 = sortList(head);
+ ListNode* l2 = sortList(slow);
+
+ return merge(l1, l2);
+ }
+};
\ No newline at end of file
diff --git a/0148-sort-list/README.md b/0148-sort-list/README.md
new file mode 100644
index 00000000..e56bc9c9
--- /dev/null
+++ b/0148-sort-list/README.md
@@ -0,0 +1,32 @@
+Given the head of a linked list, return the list after sorting it in ascending order.
+
+
+
Example 1:
+

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

+
Input: head = [-1,5,3,4,0]
+Output: [-1,0,3,4,5]
+
+
+
Example 3:
+
+
Input: head = []
+Output: []
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the list is in the range
[0, 5 * 104].
+ -105 <= Node.val <= 105
+
+
+
+
Follow up: Can you sort the linked list in O(n logn) time and O(1) memory (i.e. constant space)?
+
\ No newline at end of file
diff --git a/0150-evaluate-reverse-polish-notation/NOTES.md b/0150-evaluate-reverse-polish-notation/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0150-evaluate-reverse-polish-notation/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0160-intersection-of-two-linked-lists/README.md b/0160-intersection-of-two-linked-lists/README.md
new file mode 100644
index 00000000..bf03bc16
--- /dev/null
+++ b/0160-intersection-of-two-linked-lists/README.md
@@ -0,0 +1,64 @@
+Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.
+
+
For example, the following two linked lists begin to intersect at node c1:
+

+
The test cases are generated such that there are no cycles anywhere in the entire linked structure.
+
+
Note that the linked lists must retain their original structure after the function returns.
+
+
Custom Judge:
+
+
The inputs to the judge are given as follows (your program is not given these inputs):
+
+
+ intersectVal - The value of the node where the intersection occurs. This is 0 if there is no intersected node.
+ listA - The first linked list.
+ listB - The second linked list.
+ skipA - The number of nodes to skip ahead in listA (starting from the head) to get to the intersected node.
+ skipB - The number of nodes to skip ahead in listB (starting from the head) to get to the intersected node.
+
+
+
The judge will then create the linked structure based on these inputs and pass the two heads, headA and headB to your program. If you correctly return the intersected node, then your solution will be accepted.
+
+
+
Example 1:
+

+
Input: intersectVal = 8, listA = [4,1,8,4,5], listB = [5,6,1,8,4,5], skipA = 2, skipB = 3
+Output: Intersected at '8'
+Explanation: The intersected node's value is 8 (note that this must not be 0 if the two lists intersect).
+From the head of A, it reads as [4,1,8,4,5]. From the head of B, it reads as [5,6,1,8,4,5]. There are 2 nodes before the intersected node in A; There are 3 nodes before the intersected node in B.
+- Note that the intersected node's value is not 1 because the nodes with value 1 in A and B (2nd node in A and 3rd node in B) are different node references. In other words, they point to two different locations in memory, while the nodes with value 8 in A and B (3rd node in A and 4th node in B) point to the same location in memory.
+
+
+
Example 2:
+

+
Input: intersectVal = 2, listA = [1,9,1,2,4], listB = [3,2,4], skipA = 3, skipB = 1
+Output: Intersected at '2'
+Explanation: The intersected node's value is 2 (note that this must not be 0 if the two lists intersect).
+From the head of A, it reads as [1,9,1,2,4]. From the head of B, it reads as [3,2,4]. There are 3 nodes before the intersected node in A; There are 1 node before the intersected node in B.
+
+
+
Example 3:
+

+
Input: intersectVal = 0, listA = [2,6,4], listB = [1,5], skipA = 3, skipB = 2
+Output: No intersection
+Explanation: From the head of A, it reads as [2,6,4]. From the head of B, it reads as [1,5]. Since the two lists do not intersect, intersectVal must be 0, while skipA and skipB can be arbitrary values.
+Explanation: The two lists do not intersect, so return null.
+
+
+
+
Constraints:
+
+
+ - The number of nodes of
listA is in the m.
+ - The number of nodes of
listB is in the n.
+ 1 <= m, n <= 3 * 104
+ 1 <= Node.val <= 105
+ 0 <= skipA < m
+ 0 <= skipB < n
+ intersectVal is 0 if listA and listB do not intersect.
+ intersectVal == listA[skipA] == listB[skipB] if listA and listB intersect.
+
+
+
+
Follow up: Could you write a solution that runs in
O(m + n) time and use only
O(1) memory?
\ No newline at end of file
diff --git a/0162-find-peak-element/0162-find-peak-element.cpp b/0162-find-peak-element/0162-find-peak-element.cpp
new file mode 100644
index 00000000..b9badb4f
--- /dev/null
+++ b/0162-find-peak-element/0162-find-peak-element.cpp
@@ -0,0 +1,30 @@
+class Solution {
+public:
+ int findPeakElement(vector& arr) {
+
+ int n = arr.size();
+
+ if(n == 1)
+ return 0;
+ if(arr[0] > arr[1])
+ return 0;
+ if(arr[n-1] > arr[n-2])
+ return n-1;
+
+ int low = 1, high = n-2;
+
+ while(low <= high)
+ {
+ int mid = low + (high - low) / 2;
+
+ if(arr[mid] > arr[mid+1] and arr[mid] > arr[mid-1])
+ return mid;
+ else if(arr[mid] > arr[mid-1])
+ low = mid+1;
+ else
+ high = mid-1;
+ }
+
+ return -1;
+ }
+};
\ No newline at end of file
diff --git a/0162-find-peak-element/NOTES.md b/0162-find-peak-element/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0162-find-peak-element/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0162-find-peak-element/README.md b/0162-find-peak-element/README.md
new file mode 100644
index 00000000..96c32bd2
--- /dev/null
+++ b/0162-find-peak-element/README.md
@@ -0,0 +1,30 @@
+Medium
A peak element is an element that is strictly greater than its neighbors.
+
+
Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks.
+
+
You may imagine that nums[-1] = nums[n] = -∞. In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.
+
+
You must write an algorithm that runs in O(log n) time.
+
+
+
Example 1:
+
+
Input: nums = [1,2,3,1]
+Output: 2
+Explanation: 3 is a peak element and your function should return the index number 2.
+
+
Example 2:
+
+
Input: nums = [1,2,1,3,5,6,4]
+Output: 5
+Explanation: Your function can return either index number 1 where the peak element is 2, or index number 5 where the peak element is 6.
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 1000
+ -231 <= nums[i] <= 231 - 1
+ nums[i] != nums[i + 1] for all valid i.
+
+
\ No newline at end of file
diff --git a/0165-compare-version-numbers/0165-compare-version-numbers.cpp b/0165-compare-version-numbers/0165-compare-version-numbers.cpp
new file mode 100644
index 00000000..14ab26a7
--- /dev/null
+++ b/0165-compare-version-numbers/0165-compare-version-numbers.cpp
@@ -0,0 +1,35 @@
+class Solution {
+public:
+ int compareVersion(string version1, string version2) {
+
+ int i = 0, j= 0, n1 = version1.length(), n2 = version2.length(), num1 = 0, num2 = 0;
+
+ while(i < n1 || j < n2)
+ {
+ while(i < n1 && version1[i] != '.')
+ {
+ num1 = num1*10 + (version1[i] - '0');
+ ++i;
+ }
+ while(j < n2 && version2[j] != '.')
+ {
+ num2 = num2 * 10 + (version2[j] - '0');
+ ++j;
+ }
+
+
+ if(num1 > num2)
+ return 1;
+
+ if(num1 < num2)
+ return -1;
+
+ ++i, ++j;
+
+ num1 = 0, num2 = 0;
+
+ }
+ return 0;
+
+ }
+};
\ No newline at end of file
diff --git a/0165-compare-version-numbers/README.md b/0165-compare-version-numbers/README.md
new file mode 100644
index 00000000..2e07f72d
--- /dev/null
+++ b/0165-compare-version-numbers/README.md
@@ -0,0 +1,49 @@
+Medium
Given two version numbers, version1 and version2, compare them.
+
+
+
+
Version numbers consist of one or more revisions joined by a dot '.'. Each revision consists of digits and may contain leading zeros. Every revision contains at least one character. Revisions are 0-indexed from left to right, with the leftmost revision being revision 0, the next revision being revision 1, and so on. For example 2.5.33 and 0.1 are valid version numbers.
+
+
To compare version numbers, compare their revisions in left-to-right order. Revisions are compared using their integer value ignoring any leading zeros. This means that revisions 1 and 001 are considered equal. If a version number does not specify a revision at an index, then treat the revision as 0. For example, version 1.0 is less than version 1.1 because their revision 0s are the same, but their revision 1s are 0 and 1 respectively, and 0 < 1.
+
+
Return the following:
+
+
+ - If
version1 < version2, return -1.
+ - If
version1 > version2, return 1.
+ - Otherwise, return
0.
+
+
+
+
Example 1:
+
+
Input: version1 = "1.01", version2 = "1.001"
+Output: 0
+Explanation: Ignoring leading zeroes, both "01" and "001" represent the same integer "1".
+
+
+
Example 2:
+
+
Input: version1 = "1.0", version2 = "1.0.0"
+Output: 0
+Explanation: version1 does not specify revision 2, which means it is treated as "0".
+
+
+
Example 3:
+
+
Input: version1 = "0.1", version2 = "1.1"
+Output: -1
+Explanation: version1's revision 0 is "0", while version2's revision 0 is "1". 0 < 1, so version1 < version2.
+
+
+
+
Constraints:
+
+
+ 1 <= version1.length, version2.length <= 500
+ version1 and version2 only contain digits and '.'.
+ version1 and version2 are valid version numbers.
+ - All the given revisions in
version1 and version2 can be stored in a 32-bit integer.
+
+
\ No newline at end of file
diff --git a/0169-majority-element/0169-majority-element.cpp b/0169-majority-element/0169-majority-element.cpp
new file mode 100644
index 00000000..b2296cda
--- /dev/null
+++ b/0169-majority-element/0169-majority-element.cpp
@@ -0,0 +1,23 @@
+class Solution {
+public:
+ int majorityElement(vector& nums) {
+
+ int cnt = 1, num1 = nums[0], n = nums.size();
+
+ for(int i = 1; i < n; ++i)
+ {
+ if(num1 != nums[i])
+ --cnt;
+ else
+ ++cnt;
+
+ if(cnt == 0)
+ {
+ cnt = 1;
+ num1 = nums[i];
+ }
+ }
+
+ return num1;
+ }
+};
\ No newline at end of file
diff --git a/0169-majority-element/NOTES.md b/0169-majority-element/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0169-majority-element/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0169-majority-element/README.md b/0169-majority-element/README.md
new file mode 100644
index 00000000..0159f3e8
--- /dev/null
+++ b/0169-majority-element/README.md
@@ -0,0 +1,23 @@
+Easy
Given an array nums of size n, return the majority element.
+
+
The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
+
+
+
Example 1:
+
Input: nums = [3,2,3]
+Output: 3
+
Example 2:
+
Input: nums = [2,2,1,1,1,2,2]
+Output: 2
+
+
+
Constraints:
+
+
+ n == nums.length
+ 1 <= n <= 5 * 104
+ -109 <= nums[i] <= 109
+
+
+
+
Follow-up: Could you solve the problem in linear time and in
O(1) space?
\ No newline at end of file
diff --git a/0189-rotate-array/0189-rotate-array.cpp b/0189-rotate-array/0189-rotate-array.cpp
new file mode 100644
index 00000000..3795c8f9
--- /dev/null
+++ b/0189-rotate-array/0189-rotate-array.cpp
@@ -0,0 +1,16 @@
+class Solution {
+public:
+ void rotate(vector& nums, int k) {
+
+ int n = nums.size();
+
+ k %= n;
+
+ reverse(nums.begin(), nums.begin() + (n - k));
+
+ reverse(nums.begin() + (n-k), nums.end());
+
+ reverse(nums.begin(), nums.end());
+
+ }
+};
\ No newline at end of file
diff --git a/0189-rotate-array/NOTES.md b/0189-rotate-array/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0189-rotate-array/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0200-number-of-islands/0200-number-of-islands.cpp b/0200-number-of-islands/0200-number-of-islands.cpp
new file mode 100644
index 00000000..29d1a177
--- /dev/null
+++ b/0200-number-of-islands/0200-number-of-islands.cpp
@@ -0,0 +1,99 @@
+class DSU{
+ public:
+ int N;
+ vector parent, size;
+
+ DSU(int n)
+ {
+ N = n;
+ parent.resize(N);
+ size.resize(N, 1);
+ for(int i = 0; i < N; ++i)
+ parent[i] = i;
+ }
+
+ int findParent(int u)
+ {
+ if(u == parent[u])
+ return u;
+ return parent[u] = findParent(parent[u]);
+ }
+
+ void unionBySize(int u, int v)
+ {
+ int parU = findParent(u);
+ int parV = findParent(v);
+
+ if(parU == parV)
+ return;
+
+ if(size[parU] < size[parV])
+ {
+ parent[parU] = parV;
+ size[parV] += size[parU];
+ }
+ else
+ {
+ parent[parV] = parU;
+ size[parU] += size[parV];
+ }
+ }
+
+ bool isSame(int u, int v)
+ {
+ return findParent(u) == findParent(v);
+ }
+};
+
+class Solution {
+public:
+ int numIslands(vector>& grid) {
+
+ int n = grid.size(), m = grid[0].size();
+
+ vector dx = {-1, 0, 0, +1};
+ vector dy = {0, -1, +1 ,0};
+
+ DSU dsu(n*m + 1);
+
+ set ls;
+
+ int island = 0;
+
+ for(int i = 0; i < n; ++i)
+ {
+ for(int j = 0; j < m; ++j)
+ {
+ if(grid[i][j] == '1')
+ {
+ ls.insert((i*m) + j);
+ for(int k = 0; k < 4; ++k)
+ {
+ int cx = dx[k] + i;
+ int cy = dy[k] + j;
+
+ if(cx >= 0 and cy >= 0 and cx < n and cy < m and grid[cx][cy] == '1')
+ {
+ int node = (i * m) + j;
+ int adjNode = (cx * m) + cy;
+
+ if(!dsu.isSame(node, adjNode))
+ {
+ dsu.unionBySize(node, adjNode);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for(auto& node : ls)
+ {
+ if(dsu.findParent(node) == node)
+ ++island;
+ }
+
+ return island;
+
+ }
+};
\ No newline at end of file
diff --git a/0200-number-of-islands/NOTES.md b/0200-number-of-islands/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0200-number-of-islands/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0200-number-of-islands/README.md b/0200-number-of-islands/README.md
new file mode 100644
index 00000000..f0398d0f
--- /dev/null
+++ b/0200-number-of-islands/README.md
@@ -0,0 +1,37 @@
+Medium
Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands.
+
+
An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
+
+
+
Example 1:
+
+
Input: grid = [
+ ["1","1","1","1","0"],
+ ["1","1","0","1","0"],
+ ["1","1","0","0","0"],
+ ["0","0","0","0","0"]
+]
+Output: 1
+
+
+
Example 2:
+
+
Input: grid = [
+ ["1","1","0","0","0"],
+ ["1","1","0","0","0"],
+ ["0","0","1","0","0"],
+ ["0","0","0","1","1"]
+]
+Output: 3
+
+
+
+
Constraints:
+
+
+ m == grid.length
+ n == grid[i].length
+ 1 <= m, n <= 300
+ grid[i][j] is '0' or '1'.
+
+
\ No newline at end of file
diff --git a/0201-bitwise-and-of-numbers-range/0201-bitwise-and-of-numbers-range.cpp b/0201-bitwise-and-of-numbers-range/0201-bitwise-and-of-numbers-range.cpp
new file mode 100644
index 00000000..b92b413c
--- /dev/null
+++ b/0201-bitwise-and-of-numbers-range/0201-bitwise-and-of-numbers-range.cpp
@@ -0,0 +1,17 @@
+class Solution {
+public:
+ int rangeBitwiseAnd(int left, int right) {
+
+ int rightShift = 0;
+
+ while(right != left)
+ {
+ left >>= 1;
+ right >>= 1;
+ ++rightShift;
+ }
+
+ return right << rightShift;
+
+ }
+};
\ No newline at end of file
diff --git a/0201-bitwise-and-of-numbers-range/NOTES.md b/0201-bitwise-and-of-numbers-range/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0201-bitwise-and-of-numbers-range/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0201-bitwise-and-of-numbers-range/README.md b/0201-bitwise-and-of-numbers-range/README.md
new file mode 100644
index 00000000..5a34dffc
--- /dev/null
+++ b/0201-bitwise-and-of-numbers-range/README.md
@@ -0,0 +1,28 @@
+Medium
Given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inclusive.
+
+
+
Example 1:
+
+
Input: left = 5, right = 7
+Output: 4
+
+
+
Example 2:
+
+
Input: left = 0, right = 0
+Output: 0
+
+
+
Example 3:
+
+
Input: left = 1, right = 2147483647
+Output: 0
+
+
+
+
Constraints:
+
+
+ 0 <= left <= right <= 231 - 1
+
+
\ No newline at end of file
diff --git a/0205-isomorphic-strings/README.md b/0205-isomorphic-strings/README.md
new file mode 100644
index 00000000..c7d544ca
--- /dev/null
+++ b/0205-isomorphic-strings/README.md
@@ -0,0 +1,26 @@
+Easy
Given two strings s and t, determine if they are isomorphic.
+
+
Two strings s and t are isomorphic if the characters in s can be replaced to get t.
+
+
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.
+
+
+
Example 1:
+
Input: s = "egg", t = "add"
+Output: true
+
Example 2:
+
Input: s = "foo", t = "bar"
+Output: false
+
Example 3:
+
Input: s = "paper", t = "title"
+Output: true
+
+
+
Constraints:
+
+
+ 1 <= s.length <= 5 * 104
+ t.length == s.length
+ s and t consist of any valid ascii character.
+
+
\ No newline at end of file
diff --git a/0206-reverse-linked-list/0206-reverse-linked-list.cpp b/0206-reverse-linked-list/0206-reverse-linked-list.cpp
new file mode 100644
index 00000000..2418f3bc
--- /dev/null
+++ b/0206-reverse-linked-list/0206-reverse-linked-list.cpp
@@ -0,0 +1,27 @@
+/**
+ * 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) {
+
+ ListNode* prev = nullptr;
+
+ while(head)
+ {
+ ListNode* nex = head->next;
+ head->next = prev;
+ prev = head;
+ head = nex;
+ }
+
+ return prev;
+ }
+};
\ No newline at end of file
diff --git a/0206-reverse-linked-list/NOTES.md b/0206-reverse-linked-list/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0206-reverse-linked-list/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0231-power-of-two/0231-power-of-two.cpp b/0231-power-of-two/0231-power-of-two.cpp
new file mode 100644
index 00000000..183a7700
--- /dev/null
+++ b/0231-power-of-two/0231-power-of-two.cpp
@@ -0,0 +1,10 @@
+class Solution {
+public:
+ bool isPowerOfTwo(int n) {
+ if(n == 1)
+ return true;
+ if(n & 1 or n == 0)
+ return false;
+ return isPowerOfTwo(n/2);
+ }
+};
\ No newline at end of file
diff --git a/0231-power-of-two/NOTES.md b/0231-power-of-two/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0231-power-of-two/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0231-power-of-two/README.md b/0231-power-of-two/README.md
new file mode 100644
index 00000000..b6b0cad9
--- /dev/null
+++ b/0231-power-of-two/README.md
@@ -0,0 +1,34 @@
+Easy
Given an integer n, return true if it is a power of two. Otherwise, return false.
+
+
An integer n is a power of two, if there exists an integer x such that n == 2x.
+
+
+
Example 1:
+
+
Input: n = 1
+Output: true
+Explanation: 20 = 1
+
+
+
Example 2:
+
+
Input: n = 16
+Output: true
+Explanation: 24 = 16
+
+
+
Example 3:
+
+
Input: n = 3
+Output: false
+
+
+
+
Constraints:
+
+
+
+
+
Follow up: Could you solve it without loops/recursion?
\ No newline at end of file
diff --git a/0234-palindrome-linked-list/0234-palindrome-linked-list.cpp b/0234-palindrome-linked-list/0234-palindrome-linked-list.cpp
new file mode 100644
index 00000000..a1d444cd
--- /dev/null
+++ b/0234-palindrome-linked-list/0234-palindrome-linked-list.cpp
@@ -0,0 +1,46 @@
+/**
+ * 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:
+ bool isPalindrome(ListNode* head) {
+
+ ListNode* fast = head, *slow = head;
+
+ while(fast and fast->next)
+ {
+ fast = fast->next->next;
+ slow = slow->next;
+ }
+
+ ListNode* nexHalf = slow;
+
+ ListNode* prev = nullptr;
+
+ while(nexHalf)
+ {
+ ListNode* nex = nexHalf->next;
+ nexHalf->next = prev;
+ prev = nexHalf;
+ nexHalf = nex;
+ }
+
+ while(head != slow)
+ {
+ if(head->val != prev->val)
+ return false;
+ head = head->next;
+ prev = prev->next;
+ }
+
+ return true;
+
+ }
+};
\ No newline at end of file
diff --git a/0234-palindrome-linked-list/README.md b/0234-palindrome-linked-list/README.md
new file mode 100644
index 00000000..d71facb1
--- /dev/null
+++ b/0234-palindrome-linked-list/README.md
@@ -0,0 +1,25 @@
+Easy
Given the head of a singly linked list, return true if it is a palindrome or false otherwise.
+
+
+
Example 1:
+

+
Input: head = [1,2,2,1]
+Output: true
+
+
+
Example 2:
+

+
Input: head = [1,2]
+Output: false
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the list is in the range
[1, 105].
+ 0 <= Node.val <= 9
+
+
+
+
Follow up: Could you do it in
O(n) time and
O(1) space?
\ No newline at end of file
diff --git a/0237-delete-node-in-a-linked-list/0237-delete-node-in-a-linked-list.cpp b/0237-delete-node-in-a-linked-list/0237-delete-node-in-a-linked-list.cpp
new file mode 100644
index 00000000..9a3c0cf0
--- /dev/null
+++ b/0237-delete-node-in-a-linked-list/0237-delete-node-in-a-linked-list.cpp
@@ -0,0 +1,16 @@
+/**
+ * Definition for singly-linked list.
+ * struct ListNode {
+ * int val;
+ * ListNode *next;
+ * ListNode(int x) : val(x), next(NULL) {}
+ * };
+ */
+class Solution {
+public:
+ void deleteNode(ListNode* node) {
+
+ node->val = node->next->val;
+ node->next = node->next->next;
+ }
+};
\ No newline at end of file
diff --git a/0237-delete-node-in-a-linked-list/NOTES.md b/0237-delete-node-in-a-linked-list/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0237-delete-node-in-a-linked-list/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0237-delete-node-in-a-linked-list/README.md b/0237-delete-node-in-a-linked-list/README.md
new file mode 100644
index 00000000..3fc46f11
--- /dev/null
+++ b/0237-delete-node-in-a-linked-list/README.md
@@ -0,0 +1,48 @@
+Medium
There is a singly-linked list head and we want to delete a node node in it.
+
+
You are given the node to be deleted node. You will not be given access to the first node of head.
+
+
All the values of the linked list are unique, and it is guaranteed that the given node node is not the last node in the linked list.
+
+
Delete the given node. Note that by deleting the node, we do not mean removing it from memory. We mean:
+
+
+ - The value of the given node should not exist in the linked list.
+ - The number of nodes in the linked list should decrease by one.
+ - All the values before
node should be in the same order.
+ - All the values after
node should be in the same order.
+
+
+
Custom testing:
+
+
+ - For the input, you should provide the entire linked list
head and the node to be given node. node should not be the last node of the list and should be an actual node in the list.
+ - We will build the linked list and pass the node to your function.
+ - The output will be the entire list after calling your function.
+
+
+
+
Example 1:
+

+
Input: head = [4,5,1,9], node = 5
+Output: [4,1,9]
+Explanation: You are given the second node with value 5, the linked list should become 4 -> 1 -> 9 after calling your function.
+
+
+
Example 2:
+

+
Input: head = [4,5,1,9], node = 1
+Output: [4,5,9]
+Explanation: You are given the third node with value 1, the linked list should become 4 -> 5 -> 9 after calling your function.
+
+
+
+
Constraints:
+
+
+ - The number of the nodes in the given list is in the range
[2, 1000].
+ -1000 <= Node.val <= 1000
+ - The value of each node in the list is unique.
+ - The
node to be deleted is in the list and is not a tail node.
+
+
\ No newline at end of file
diff --git a/0238-product-of-array-except-self/0238-product-of-array-except-self.cpp b/0238-product-of-array-except-self/0238-product-of-array-except-self.cpp
new file mode 100644
index 00000000..5dae18ab
--- /dev/null
+++ b/0238-product-of-array-except-self/0238-product-of-array-except-self.cpp
@@ -0,0 +1,25 @@
+class Solution {
+public:
+ vector productExceptSelf(vector& nums) {
+
+ int n = nums.size();
+ vector ans(n, 1);
+
+ int pref = 1, suff = 1;
+
+ for(int i = 0; i < n; ++i)
+ {
+ ans[i] *= pref;
+ pref *= nums[i];
+ }
+
+ for(int i = n-1; i >= 0; --i)
+ {
+ ans[i] *= suff;
+ suff *= nums[i];
+ }
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0238-product-of-array-except-self/README.md b/0238-product-of-array-except-self/README.md
new file mode 100644
index 00000000..494c527b
--- /dev/null
+++ b/0238-product-of-array-except-self/README.md
@@ -0,0 +1,26 @@
+Medium
Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].
+
+
The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.
+
+
You must write an algorithm that runs in O(n) time and without using the division operation.
+
+
+
Example 1:
+
Input: nums = [1,2,3,4]
+Output: [24,12,8,6]
+
Example 2:
+
Input: nums = [-1,1,0,-3,3]
+Output: [0,0,9,0,0]
+
+
+
Constraints:
+
+
+ 2 <= nums.length <= 105
+ -30 <= nums[i] <= 30
+ - The product of any prefix or suffix of
nums is guaranteed to fit in a 32-bit integer.
+
+
+
+
Follow up: Can you solve the problem in O(1) extra space complexity? (The output array does not count as extra space for space complexity analysis.)
+
\ No newline at end of file
diff --git a/0239-sliding-window-maximum/0239-sliding-window-maximum.cpp b/0239-sliding-window-maximum/0239-sliding-window-maximum.cpp
index 93aab41f..f0c6f117 100644
--- a/0239-sliding-window-maximum/0239-sliding-window-maximum.cpp
+++ b/0239-sliding-window-maximum/0239-sliding-window-maximum.cpp
@@ -2,14 +2,14 @@ class Solution {
public:
vector maxSlidingWindow(vector& nums, int k) {
- int i = 0, j = 0;
-
int n = nums.size();
- vector ans;
+ int i = 0, j = 0;
list l;
+ vector ans;
+
while(j < n)
{
while(!l.empty() and nums[l.back()] <= nums[j])
@@ -22,9 +22,7 @@ class Solution {
ans.push_back(nums[l.front()]);
if(l.front() == i)
- {
l.pop_front();
- }
++i;
}
@@ -33,6 +31,5 @@ class Solution {
}
return ans;
-
}
};
\ No newline at end of file
diff --git a/0242-valid-anagram/0242-valid-anagram.cpp b/0242-valid-anagram/0242-valid-anagram.cpp
new file mode 100644
index 00000000..e0ced785
--- /dev/null
+++ b/0242-valid-anagram/0242-valid-anagram.cpp
@@ -0,0 +1,20 @@
+class Solution {
+public:
+ bool isAnagram(string s, string t) {
+
+ vector freq(26, 0);
+
+ for(auto& ch : s)
+ ++freq[ch - 'a'];
+
+ for(auto& ch : t)
+ --freq[ch - 'a'];
+
+ for(int i = 0; i< 26; ++i)
+ {
+ if(freq[i] != 0) return false;
+ }
+
+ return true;
+ }
+};
\ No newline at end of file
diff --git a/0242-valid-anagram/NOTES.md b/0242-valid-anagram/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0242-valid-anagram/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0242-valid-anagram/README.md b/0242-valid-anagram/README.md
new file mode 100644
index 00000000..c06723c0
--- /dev/null
+++ b/0242-valid-anagram/README.md
@@ -0,0 +1,23 @@
+Easy
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
+
+
An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
+
+
+
Example 1:
+
Input: s = "anagram", t = "nagaram"
+Output: true
+
Example 2:
+
Input: s = "rat", t = "car"
+Output: false
+
+
+
Constraints:
+
+
+ 1 <= s.length, t.length <= 5 * 104
+ s and t consist of lowercase English letters.
+
+
+
+
Follow up: What if the inputs contain Unicode characters? How would you adapt your solution to such a case?
+
\ No newline at end of file
diff --git a/0260-single-number-iii/0260-single-number-iii.cpp b/0260-single-number-iii/0260-single-number-iii.cpp
new file mode 100644
index 00000000..8adcc2c8
--- /dev/null
+++ b/0260-single-number-iii/0260-single-number-iii.cpp
@@ -0,0 +1,24 @@
+class Solution {
+public:
+ vector singleNumber(vector& nums) {
+
+ int b1 = 0, b2 = 0;
+
+ long long xorr = 0;
+
+ for(auto& ele : nums)
+ xorr ^= ele;
+
+ long long rightMost = (xorr&(xorr-1)) ^ xorr;
+
+ for(auto& ele : nums)
+ {
+ if(ele & rightMost)
+ b1 ^= ele;
+ else
+ b2 ^= ele;
+ }
+
+ return {b1, b2};
+ }
+};
\ No newline at end of file
diff --git a/0260-single-number-iii/README.md b/0260-single-number-iii/README.md
new file mode 100644
index 00000000..203cd5d7
--- /dev/null
+++ b/0260-single-number-iii/README.md
@@ -0,0 +1,33 @@
+Medium
Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in any order.
+
+
You must write an algorithm that runs in linear runtime complexity and uses only constant extra space.
+
+
+
Example 1:
+
+
Input: nums = [1,2,1,3,2,5]
+Output: [3,5]
+Explanation: [5, 3] is also a valid answer.
+
+
+
Example 2:
+
+
Input: nums = [-1,0]
+Output: [-1,0]
+
+
+
Example 3:
+
+
Input: nums = [0,1]
+Output: [1,0]
+
+
+
+
Constraints:
+
+
+ 2 <= nums.length <= 3 * 104
+ -231 <= nums[i] <= 231 - 1
+ - Each integer in
nums will appear twice, only two integers will appear once.
+
+
\ No newline at end of file
diff --git a/0264-ugly-number-ii/0264-ugly-number-ii.cpp b/0264-ugly-number-ii/0264-ugly-number-ii.cpp
new file mode 100644
index 00000000..27655d96
--- /dev/null
+++ b/0264-ugly-number-ii/0264-ugly-number-ii.cpp
@@ -0,0 +1,23 @@
+class Solution {
+public:
+ int nthUglyNumber(int n) {
+
+ vector v(n+1, 1);
+
+ int i2 = 1, i3 = 1, i5 = 1;
+
+ for(int i = 2; i <= n; ++i)
+ {
+ int ithUgly = min({v[i2] * 2, v[i3] * 3, v[i5] * 5});
+
+ v[i] = ithUgly;
+
+ if(v[i] == v[i2] * 2) ++i2;
+ if(v[i] == v[i3] * 3) ++i3;
+ if(v[i] == v[i5] * 5) ++i5;
+ }
+
+ return v[n];
+
+ }
+};
\ No newline at end of file
diff --git a/0264-ugly-number-ii/README.md b/0264-ugly-number-ii/README.md
new file mode 100644
index 00000000..296532e1
--- /dev/null
+++ b/0264-ugly-number-ii/README.md
@@ -0,0 +1,26 @@
+Medium
An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.
+
+
Given an integer n, return the nth ugly number.
+
+
+
Example 1:
+
+
Input: n = 10
+Output: 12
+Explanation: [1, 2, 3, 4, 5, 6, 8, 9, 10, 12] is the sequence of the first 10 ugly numbers.
+
+
+
Example 2:
+
+
Input: n = 1
+Output: 1
+Explanation: 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.
+
+
+
+
Constraints:
+
+
+
\ No newline at end of file
diff --git a/0268-missing-number/0268-missing-number.cpp b/0268-missing-number/0268-missing-number.cpp
new file mode 100644
index 00000000..dacbf752
--- /dev/null
+++ b/0268-missing-number/0268-missing-number.cpp
@@ -0,0 +1,17 @@
+class Solution {
+public:
+ int missingNumber(vector& nums) {
+
+ int n = nums.size();
+
+ int sum = 0;
+
+ for(auto& ele : nums)
+ sum += ele;
+
+ int totSum = (n * (n+1)) / 2;
+
+ return totSum - sum;
+
+ }
+};
\ No newline at end of file
diff --git a/0268-missing-number/NOTES.md b/0268-missing-number/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0268-missing-number/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0268-missing-number/README.md b/0268-missing-number/README.md
new file mode 100644
index 00000000..f88e56a1
--- /dev/null
+++ b/0268-missing-number/README.md
@@ -0,0 +1,37 @@
+Easy
Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.
+
+
+
Example 1:
+
+
Input: nums = [3,0,1]
+Output: 2
+Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it does not appear in nums.
+
+
+
Example 2:
+
+
Input: nums = [0,1]
+Output: 2
+Explanation: n = 2 since there are 2 numbers, so all numbers are in the range [0,2]. 2 is the missing number in the range since it does not appear in nums.
+
+
+
Example 3:
+
+
Input: nums = [9,6,4,2,3,5,7,0,1]
+Output: 8
+Explanation: n = 9 since there are 9 numbers, so all numbers are in the range [0,9]. 8 is the missing number in the range since it does not appear in nums.
+
+
+
+
Constraints:
+
+
+ n == nums.length
+ 1 <= n <= 104
+ 0 <= nums[i] <= n
+ - All the numbers of
nums are unique.
+
+
+
+
Follow up: Could you implement a solution using only O(1) extra space complexity and O(n) runtime complexity?
+
\ No newline at end of file
diff --git a/0273-integer-to-english-words/0273-integer-to-english-words.cpp b/0273-integer-to-english-words/0273-integer-to-english-words.cpp
new file mode 100644
index 00000000..f6db280d
--- /dev/null
+++ b/0273-integer-to-english-words/0273-integer-to-english-words.cpp
@@ -0,0 +1,19 @@
+class Solution {
+public:
+ vector> nums ={{1000000000, "Billion"}, {1000000, "Million"},
+ {1000, "Thousand"}, {100, "Hundred"}, {90, "Ninety"}, {80, "Eighty"}, {70, "Seventy"},
+ {60, "Sixty"}, {50, "Fifty"}, {40, "Forty"}, {30, "Thirty"}, {20, "Twenty"}, {19, "Nineteen"},
+ {18, "Eighteen"}, {17, "Seventeen"}, {16, "Sixteen"}, {15, "Fifteen"}, {14, "Fourteen"},
+ {13, "Thirteen"}, {12, "Twelve"}, {11, "Eleven"}, {10, "Ten"}, {9, "Nine"}, {8, "Eight"},
+ {7, "Seven"}, {6, "Six"}, {5, "Five"}, {4, "Four"}, {3, "Three"}, {2, "Two"}, {1, "One"}};
+
+ string numberToWords(int num) {
+ if(num == 0) return "Zero";
+
+ for(auto it: nums)
+ if(num >= it.first)
+ return (num >= 100 ? numberToWords(num/it.first)+" " : "") + it.second + (num%it.first == 0 ? "" : " "+numberToWords(num%it.first));
+
+ return "";
+ }
+};
\ No newline at end of file
diff --git a/0273-integer-to-english-words/README.md b/0273-integer-to-english-words/README.md
new file mode 100644
index 00000000..708515e3
--- /dev/null
+++ b/0273-integer-to-english-words/README.md
@@ -0,0 +1,28 @@
+Hard
Convert a non-negative integer num to its English words representation.
+
+
+
Example 1:
+
+
Input: num = 123
+Output: "One Hundred Twenty Three"
+
+
+
Example 2:
+
+
Input: num = 12345
+Output: "Twelve Thousand Three Hundred Forty Five"
+
+
+
Example 3:
+
+
Input: num = 1234567
+Output: "One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"
+
+
+
+
Constraints:
+
+
+
\ No newline at end of file
diff --git a/0279-perfect-squares/README.md b/0279-perfect-squares/README.md
new file mode 100644
index 00000000..cfd0d433
--- /dev/null
+++ b/0279-perfect-squares/README.md
@@ -0,0 +1,26 @@
+Medium
Given an integer n, return the least number of perfect square numbers that sum to n.
+
+
A perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, 1, 4, 9, and 16 are perfect squares while 3 and 11 are not.
+
+
+
Example 1:
+
+
Input: n = 12
+Output: 3
+Explanation: 12 = 4 + 4 + 4.
+
+
+
Example 2:
+
+
Input: n = 13
+Output: 2
+Explanation: 13 = 4 + 9.
+
+
+
+
Constraints:
+
+
+
\ No newline at end of file
diff --git a/0289-game-of-life/0289-game-of-life.cpp b/0289-game-of-life/0289-game-of-life.cpp
new file mode 100644
index 00000000..eec57c7c
--- /dev/null
+++ b/0289-game-of-life/0289-game-of-life.cpp
@@ -0,0 +1,55 @@
+class Solution {
+public:
+ void gameOfLife(vector>& board) {
+
+ vector dx = {-1, -1, -1, 0, 0, +1, +1, +1};
+ vector dy = {-1, 0, +1, -1, +1, -1, 0, +1};
+
+ int n = board.size();
+ int m = board[0].size();
+
+ set> st;
+
+ for(int i = 0; i < n; ++i)
+ {
+ for(int j = 0; j < m; ++j)
+ {
+ if(board[i][j])
+ st.insert({i, j});
+ }
+ }
+
+ for(int i = 0; i < n; ++i)
+ {
+ for(int j = 0; j < m; ++j)
+ {
+ int alive = 0;
+ int dead = 0;
+
+ for(int k = 0; k < 8; ++k)
+ {
+ int newx = i + dx[k];
+ int newy = j + dy[k];
+
+ if(newx >= 0 and newy >= 0 and newx < n and newy < m)
+ {
+ if(st.count({newx, newy}))
+ ++alive;
+ else
+ ++dead;
+ }
+ }
+ if(st.count({i, j}))
+ {
+ if(alive < 2 or alive > 3)
+ board[i][j] = 0;
+ }
+ else
+ {
+ if(alive == 3)
+ board[i][j] = 1;
+ }
+ }
+ }
+ }
+};
\ No newline at end of file
diff --git a/0289-game-of-life/NOTES.md b/0289-game-of-life/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0289-game-of-life/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0289-game-of-life/README.md b/0289-game-of-life/README.md
new file mode 100644
index 00000000..4d231fac
--- /dev/null
+++ b/0289-game-of-life/README.md
@@ -0,0 +1,44 @@
+Medium
According to Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."
+
+
The board is made up of an m x n grid of cells, where each cell has an initial state: live (represented by a 1) or dead (represented by a 0). Each cell interacts with its eight neighbors (horizontal, vertical, diagonal) using the following four rules (taken from the above Wikipedia article):
+
+
+ - Any live cell with fewer than two live neighbors dies as if caused by under-population.
+ - Any live cell with two or three live neighbors lives on to the next generation.
+ - Any live cell with more than three live neighbors dies, as if by over-population.
+ - Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
+
+
+
The next state is created by applying the above rules simultaneously to every cell in the current state, where births and deaths occur simultaneously. Given the current state of the m x n grid board, return the next state.
+
+
+
Example 1:
+

+
Input: board = [[0,1,0],[0,0,1],[1,1,1],[0,0,0]]
+Output: [[0,0,0],[1,0,1],[0,1,1],[0,1,0]]
+
+
+
Example 2:
+

+
Input: board = [[1,1],[1,0]]
+Output: [[1,1],[1,1]]
+
+
+
+
Constraints:
+
+
+ m == board.length
+ n == board[i].length
+ 1 <= m, n <= 25
+ board[i][j] is 0 or 1.
+
+
+
+
Follow up:
+
+
+ - Could you solve it in-place? Remember that the board needs to be updated simultaneously: You cannot update some cells first and then use their updated values to update other cells.
+ - In this question, we represent the board using a 2D array. In principle, the board is infinite, which would cause problems when the active area encroaches upon the border of the array (i.e., live cells reach the border). How would you address these problems?
+
+
\ No newline at end of file
diff --git a/0295-find-median-from-data-stream/0295-find-median-from-data-stream.cpp b/0295-find-median-from-data-stream/0295-find-median-from-data-stream.cpp
new file mode 100644
index 00000000..b21b83b7
--- /dev/null
+++ b/0295-find-median-from-data-stream/0295-find-median-from-data-stream.cpp
@@ -0,0 +1,52 @@
+class MedianFinder {
+public:
+
+ priority_queue maxHeap;
+ priority_queue, greater> minHeap;
+
+ MedianFinder() {
+
+ }
+
+ void addNum(int num) {
+ if(maxHeap.empty() and minHeap.empty())
+ maxHeap.push(num);
+ else if(num > maxHeap.top())
+ minHeap.push(num);
+ else
+ maxHeap.push(num);
+
+ int n = maxHeap.size();
+ int m = minHeap.size();
+
+ if(abs(n-m) == 2)
+ {
+ if(n > m)
+ {
+ minHeap.push(maxHeap.top());
+ maxHeap.pop();
+ }
+ else
+ {
+ maxHeap.push(minHeap.top());
+ minHeap.pop();
+ }
+ }
+ }
+
+ double findMedian() {
+ if(maxHeap.size() == minHeap.size())
+ return (maxHeap.top() + minHeap.top()) / 2.0;
+ else if(maxHeap.size() > minHeap.size())
+ return maxHeap.top();
+ else
+ return minHeap.top();
+ }
+};
+
+/**
+ * Your MedianFinder object will be instantiated and called as such:
+ * MedianFinder* obj = new MedianFinder();
+ * obj->addNum(num);
+ * double param_2 = obj->findMedian();
+ */
\ No newline at end of file
diff --git a/0295-find-median-from-data-stream/README.md b/0295-find-median-from-data-stream/README.md
new file mode 100644
index 00000000..40d10740
--- /dev/null
+++ b/0295-find-median-from-data-stream/README.md
@@ -0,0 +1,50 @@
+Hard
The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.
+
+
+ - For example, for
arr = [2,3,4], the median is 3.
+ - For example, for
arr = [2,3], the median is (2 + 3) / 2 = 2.5.
+
+
+
Implement the MedianFinder class:
+
+
+ MedianFinder() initializes the MedianFinder object.
+ void addNum(int num) adds the integer num from the data stream to the data structure.
+ double findMedian() returns the median of all elements so far. Answers within 10-5 of the actual answer will be accepted.
+
+
+
+
Example 1:
+
+
Input
+["MedianFinder", "addNum", "addNum", "findMedian", "addNum", "findMedian"]
+[[], [1], [2], [], [3], []]
+Output
+[null, null, null, 1.5, null, 2.0]
+
+Explanation
+MedianFinder medianFinder = new MedianFinder();
+medianFinder.addNum(1); // arr = [1]
+medianFinder.addNum(2); // arr = [1, 2]
+medianFinder.findMedian(); // return 1.5 (i.e., (1 + 2) / 2)
+medianFinder.addNum(3); // arr[1, 2, 3]
+medianFinder.findMedian(); // return 2.0
+
+
+
+
Constraints:
+
+
+ -105 <= num <= 105
+ - There will be at least one element in the data structure before calling
findMedian.
+ - At most
5 * 104 calls will be made to addNum and findMedian.
+
+
+
+
Follow up:
+
+
+ - If all integer numbers from the stream are in the range
[0, 100], how would you optimize your solution?
+ - If
99% of all integer numbers from the stream are in the range [0, 100], how would you optimize your solution?
+
+
\ No newline at end of file
diff --git a/0310-minimum-height-trees/0310-minimum-height-trees.cpp b/0310-minimum-height-trees/0310-minimum-height-trees.cpp
new file mode 100644
index 00000000..075848c2
--- /dev/null
+++ b/0310-minimum-height-trees/0310-minimum-height-trees.cpp
@@ -0,0 +1,34 @@
+class Solution {
+public:
+ vector findMinHeightTrees(int n, vector>& edges) {
+ vector> graph(n);
+ vector indegree(n, 0), ans;
+
+ for(auto &e : edges){
+ graph[e[0]].push_back(e[1]);
+ graph[e[1]].push_back(e[0]);
+ indegree[e[0]]++;
+ indegree[e[1]]++;
+ }
+
+ queue q;
+ for(int i=0; i310. Minimum Height TreesMedium
A tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.
+
+
Given a tree of n nodes labelled from 0 to n - 1, and an array of n - 1 edges where edges[i] = [ai, bi] indicates that there is an undirected edge between the two nodes ai and bi in the tree, you can choose any node of the tree as the root. When you select a node x as the root, the result tree has height h. Among all possible rooted trees, those with minimum height (i.e. min(h)) are called minimum height trees (MHTs).
+
+
Return a list of all MHTs' root labels. You can return the answer in any order.
+
+
The height of a rooted tree is the number of edges on the longest downward path between the root and a leaf.
+
+
+
Example 1:
+

+
Input: n = 4, edges = [[1,0],[1,2],[1,3]]
+Output: [1]
+Explanation: As shown, the height of the tree is 1 when the root is the node with label 1 which is the only MHT.
+
+
+
Example 2:
+

+
Input: n = 6, edges = [[3,0],[3,1],[3,2],[3,4],[5,4]]
+Output: [3,4]
+
+
+
+
Constraints:
+
+
+ 1 <= n <= 2 * 104
+ edges.length == n - 1
+ 0 <= ai, bi < n
+ ai != bi
+ - All the pairs
(ai, bi) are distinct.
+ - The given input is guaranteed to be a tree and there will be no repeated edges.
+
+
\ No newline at end of file
diff --git a/0324-wiggle-sort-ii/0324-wiggle-sort-ii.cpp b/0324-wiggle-sort-ii/0324-wiggle-sort-ii.cpp
new file mode 100644
index 00000000..b49df90a
--- /dev/null
+++ b/0324-wiggle-sort-ii/0324-wiggle-sort-ii.cpp
@@ -0,0 +1,25 @@
+class Solution {
+public:
+ void wiggleSort(vector& nums) {
+
+ int n = nums.size();
+
+ sort(nums.begin(), nums.end());
+
+ vector ans(n);
+
+ int k = n-1;
+
+ for(int i = 1; i < n; i += 2)
+ {
+ ans[i] = nums[k--];
+ }
+
+ for(int i = 0; i < n; i += 2)
+ {
+ ans[i] = nums[k--];
+ }
+
+ nums = ans;
+ }
+};
\ No newline at end of file
diff --git a/0324-wiggle-sort-ii/NOTES.md b/0324-wiggle-sort-ii/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0324-wiggle-sort-ii/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0324-wiggle-sort-ii/README.md b/0324-wiggle-sort-ii/README.md
new file mode 100644
index 00000000..ae6f43d0
--- /dev/null
+++ b/0324-wiggle-sort-ii/README.md
@@ -0,0 +1,29 @@
+Medium
Given an integer array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]....
+
+
You may assume the input array always has a valid answer.
+
+
+
Example 1:
+
+
Input: nums = [1,5,1,1,6,4]
+Output: [1,6,1,5,1,4]
+Explanation: [1,4,1,5,1,6] is also accepted.
+
+
+
Example 2:
+
+
Input: nums = [1,3,2,2,3,1]
+Output: [2,3,1,3,1,2]
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 5 * 104
+ 0 <= nums[i] <= 5000
+ - It is guaranteed that there will be an answer for the given input
nums.
+
+
+
+
Follow Up: Can you do it in
O(n) time and/or
in-place with
O(1) extra space?
\ No newline at end of file
diff --git a/0330-patching-array/0330-patching-array.cpp b/0330-patching-array/0330-patching-array.cpp
new file mode 100644
index 00000000..ae09c27a
--- /dev/null
+++ b/0330-patching-array/0330-patching-array.cpp
@@ -0,0 +1,25 @@
+class Solution {
+public:
+ int minPatches(vector& nums, int n) {
+
+ long long maxReach = 0;
+ int patch = 0, i = 0;
+
+ while(maxReach < n)
+ {
+ if(i < nums.size() and nums[i] <= maxReach + 1)
+ {
+ maxReach += nums[i];
+ ++i;
+ }
+ else
+ {
+ ++patch;
+ maxReach += (maxReach + 1);
+ }
+ }
+
+ return patch;
+
+ }
+};
\ No newline at end of file
diff --git a/0330-patching-array/README.md b/0330-patching-array/README.md
new file mode 100644
index 00000000..fcebede2
--- /dev/null
+++ b/0330-patching-array/README.md
@@ -0,0 +1,39 @@
+Hard
Given a sorted integer array nums and an integer n, add/patch elements to the array such that any number in the range [1, n] inclusive can be formed by the sum of some elements in the array.
+
+
Return the minimum number of patches required.
+
+
+
Example 1:
+
+
Input: nums = [1,3], n = 6
+Output: 1
+Explanation:
+Combinations of nums are [1], [3], [1,3], which form possible sums of: 1, 3, 4.
+Now if we add/patch 2 to nums, the combinations are: [1], [2], [3], [1,3], [2,3], [1,2,3].
+Possible sums are 1, 2, 3, 4, 5, 6, which now covers the range [1, 6].
+So we only need 1 patch.
+
+
+
Example 2:
+
+
Input: nums = [1,5,10], n = 20
+Output: 2
+Explanation: The two patches can be [2, 4].
+
+
+
Example 3:
+
+
Input: nums = [1,2,2], n = 5
+Output: 0
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 1000
+ 1 <= nums[i] <= 104
+ nums is sorted in ascending order.
+ 1 <= n <= 231 - 1
+
+
\ No newline at end of file
diff --git a/0341-flatten-nested-list-iterator/0341-flatten-nested-list-iterator.cpp b/0341-flatten-nested-list-iterator/0341-flatten-nested-list-iterator.cpp
new file mode 100644
index 00000000..f450d064
--- /dev/null
+++ b/0341-flatten-nested-list-iterator/0341-flatten-nested-list-iterator.cpp
@@ -0,0 +1,57 @@
+/**
+ * // This is the interface that allows for creating nested lists.
+ * // You should not implement it, or speculate about its implementation
+ * class NestedInteger {
+ * public:
+ * // Return true if this NestedInteger holds a single integer, rather than a nested list.
+ * bool isInteger() const;
+ *
+ * // Return the single integer that this NestedInteger holds, if it holds a single integer
+ * // The result is undefined if this NestedInteger holds a nested list
+ * int getInteger() const;
+ *
+ * // Return the nested list that this NestedInteger holds, if it holds a nested list
+ * // The result is undefined if this NestedInteger holds a single integer
+ * const vector &getList() const;
+ * };
+ */
+
+class NestedIterator {
+public:
+
+ vector v;
+ int k = 0;
+
+ void helper(vector& nestedList)
+ {
+ for(auto& itr : nestedList)
+ {
+ if(itr.isInteger())
+ v.push_back(itr.getInteger());
+ else
+ helper(itr.getList());
+ }
+ }
+
+ NestedIterator(vector &nestedList) {
+
+ helper(nestedList);
+
+ }
+
+ int next() {
+ int ans = v[k];
+ ++k;
+ return ans;
+ }
+
+ bool hasNext() {
+ return k < v.size();
+ }
+};
+
+/**
+ * Your NestedIterator object will be instantiated and called as such:
+ * NestedIterator i(nestedList);
+ * while (i.hasNext()) cout << i.next();
+ */
\ No newline at end of file
diff --git a/0341-flatten-nested-list-iterator/NOTES.md b/0341-flatten-nested-list-iterator/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0341-flatten-nested-list-iterator/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0341-flatten-nested-list-iterator/README.md b/0341-flatten-nested-list-iterator/README.md
new file mode 100644
index 00000000..be9109a3
--- /dev/null
+++ b/0341-flatten-nested-list-iterator/README.md
@@ -0,0 +1,44 @@
+Medium
You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it.
+
+
Implement the NestedIterator class:
+
+
+ NestedIterator(List<NestedInteger> nestedList) Initializes the iterator with the nested list nestedList.
+ int next() Returns the next integer in the nested list.
+ boolean hasNext() Returns true if there are still some integers in the nested list and false otherwise.
+
+
+
Your code will be tested with the following pseudocode:
+
+
initialize iterator with nestedList
+res = []
+while iterator.hasNext()
+ append iterator.next() to the end of res
+return res
+
+
+
If res matches the expected flattened list, then your code will be judged as correct.
+
+
+
Example 1:
+
+
Input: nestedList = [[1,1],2,[1,1]]
+Output: [1,1,2,1,1]
+Explanation: By calling next repeatedly until hasNext returns false, the order of elements returned by next should be: [1,1,2,1,1].
+
+
+
Example 2:
+
+
Input: nestedList = [1,[4,[6]]]
+Output: [1,4,6]
+Explanation: By calling next repeatedly until hasNext returns false, the order of elements returned by next should be: [1,4,6].
+
+
+
+
Constraints:
+
+
+ 1 <= nestedList.length <= 500
+ - The values of the integers in the nested list is in the range
[-106, 106].
+
+
\ No newline at end of file
diff --git a/0342-power-of-four/0342-power-of-four.cpp b/0342-power-of-four/0342-power-of-four.cpp
new file mode 100644
index 00000000..eb1b35f2
--- /dev/null
+++ b/0342-power-of-four/0342-power-of-four.cpp
@@ -0,0 +1,21 @@
+class Solution {
+public:
+
+ bool helper(int n)
+ {
+ if(n <= 0)
+ return false;
+
+ if(n == 1)
+ return true;
+
+ if(n % 4 == 0)
+ return helper(n/4);
+
+ return false;
+ }
+
+ bool isPowerOfFour(int n) {
+ return helper(n);
+ }
+};
\ No newline at end of file
diff --git a/0342-power-of-four/NOTES.md b/0342-power-of-four/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0342-power-of-four/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0342-power-of-four/README.md b/0342-power-of-four/README.md
new file mode 100644
index 00000000..e5dba89e
--- /dev/null
+++ b/0342-power-of-four/README.md
@@ -0,0 +1,24 @@
+Easy
Given an integer n, return true if it is a power of four. Otherwise, return false.
+
+
An integer n is a power of four, if there exists an integer x such that n == 4x.
+
+
+
Example 1:
+
Input: n = 16
+Output: true
+
Example 2:
+
Input: n = 5
+Output: false
+
Example 3:
+
Input: n = 1
+Output: true
+
+
+
Constraints:
+
+
+
+
+
Follow up: Could you solve it without loops/recursion?
\ No newline at end of file
diff --git a/0343-integer-break/0343-integer-break.cpp b/0343-integer-break/0343-integer-break.cpp
new file mode 100644
index 00000000..23c42f94
--- /dev/null
+++ b/0343-integer-break/0343-integer-break.cpp
@@ -0,0 +1,29 @@
+class Solution {
+public:
+
+ int helper(int idx, int sum, int n, vector>& dp)
+ {
+ if(sum == 0)
+ return 1;
+
+ if(sum < 0 or idx >= n)
+ return 0;
+
+ if(dp[idx][sum] != -1)
+ return dp[idx][sum];
+
+ int res = helper(idx+1, sum, n, dp);
+
+ dp[idx][sum] = res = max(res, idx * helper(idx, sum-idx, n, dp));
+
+ return res;
+ }
+
+ int integerBreak(int n) {
+
+ vector> dp(n+1, vector(n+1, -1));
+
+ return helper(1, n, n, dp);
+
+ }
+};
\ No newline at end of file
diff --git a/0343-integer-break/NOTES.md b/0343-integer-break/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0343-integer-break/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0343-integer-break/README.md b/0343-integer-break/README.md
new file mode 100644
index 00000000..eeb0e4fa
--- /dev/null
+++ b/0343-integer-break/README.md
@@ -0,0 +1,26 @@
+Medium
Given an integer n, break it into the sum of k positive integers, where k >= 2, and maximize the product of those integers.
+
+
Return the maximum product you can get.
+
+
+
Example 1:
+
+
Input: n = 2
+Output: 1
+Explanation: 2 = 1 + 1, 1 × 1 = 1.
+
+
+
Example 2:
+
+
Input: n = 10
+Output: 36
+Explanation: 10 = 3 + 3 + 4, 3 × 3 × 4 = 36.
+
+
+
+
Constraints:
+
+
+
\ No newline at end of file
diff --git a/0344-reverse-string/0344-reverse-string.cpp b/0344-reverse-string/0344-reverse-string.cpp
new file mode 100644
index 00000000..c1441fef
--- /dev/null
+++ b/0344-reverse-string/0344-reverse-string.cpp
@@ -0,0 +1,11 @@
+class Solution {
+public:
+ void reverseString(vector& s) {
+
+ int n = s.size();
+
+ for(int i = 0; i < n/2; ++i)
+ swap(s[i], s[n-i-1]);
+
+ }
+};
\ No newline at end of file
diff --git a/0344-reverse-string/NOTES.md b/0344-reverse-string/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0344-reverse-string/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0344-reverse-string/README.md b/0344-reverse-string/README.md
new file mode 100644
index 00000000..5c9b221e
--- /dev/null
+++ b/0344-reverse-string/README.md
@@ -0,0 +1,20 @@
+Easy
Write a function that reverses a string. The input string is given as an array of characters s.
+
+
You must do this by modifying the input array in-place with O(1) extra memory.
+
+
+
Example 1:
+
Input: s = ["h","e","l","l","o"]
+Output: ["o","l","l","e","h"]
+
Example 2:
+
Input: s = ["H","a","n","n","a","h"]
+Output: ["h","a","n","n","a","H"]
+
+
+
Constraints:
+
+
+
\ No newline at end of file
diff --git a/0349-intersection-of-two-arrays/0349-intersection-of-two-arrays.cpp b/0349-intersection-of-two-arrays/0349-intersection-of-two-arrays.cpp
new file mode 100644
index 00000000..c4128d15
--- /dev/null
+++ b/0349-intersection-of-two-arrays/0349-intersection-of-two-arrays.cpp
@@ -0,0 +1,20 @@
+class Solution {
+public:
+ vector intersection(vector& nums1, vector& nums2) {
+
+ vector res;
+
+ set have(nums1.begin(),nums1.end());
+
+ for(auto& ele : nums2)
+ {
+ if(have.count(ele))
+ {
+ res.push_back(ele);
+ have.erase(ele);
+ }
+ }
+
+ return res;
+ }
+};
\ No newline at end of file
diff --git a/0349-intersection-of-two-arrays/NOTES.md b/0349-intersection-of-two-arrays/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0349-intersection-of-two-arrays/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0349-intersection-of-two-arrays/README.md b/0349-intersection-of-two-arrays/README.md
new file mode 100644
index 00000000..24bc7284
--- /dev/null
+++ b/0349-intersection-of-two-arrays/README.md
@@ -0,0 +1,24 @@
+Easy
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order.
+
+
+
Example 1:
+
+
Input: nums1 = [1,2,2,1], nums2 = [2,2]
+Output: [2]
+
+
+
Example 2:
+
+
Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
+Output: [9,4]
+Explanation: [4,9] is also accepted.
+
+
+
+
Constraints:
+
+
+ 1 <= nums1.length, nums2.length <= 1000
+ 0 <= nums1[i], nums2[i] <= 1000
+
+
\ No newline at end of file
diff --git a/0350-intersection-of-two-arrays-ii/0350-intersection-of-two-arrays-ii.cpp b/0350-intersection-of-two-arrays-ii/0350-intersection-of-two-arrays-ii.cpp
new file mode 100644
index 00000000..f0f633ae
--- /dev/null
+++ b/0350-intersection-of-two-arrays-ii/0350-intersection-of-two-arrays-ii.cpp
@@ -0,0 +1,30 @@
+class Solution {
+public:
+ vector intersect(vector& nums1, vector& nums2) {
+
+ map mp, mp2;
+
+ vector ans;
+
+ for(auto& ele : nums1)
+ {
+ ++mp[ele];
+ }
+
+ for(auto& ele : nums2)
+ {
+ ++mp2[ele];
+ }
+
+ for(auto&[f,e] : mp)
+ {
+ if(mp2.find(f) != mp2.end())
+ {
+ for(int i = 0; i < min(e, mp2[f]); ++i)
+ ans.push_back(f);
+ }
+ }
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0350-intersection-of-two-arrays-ii/README.md b/0350-intersection-of-two-arrays-ii/README.md
new file mode 100644
index 00000000..20f1306d
--- /dev/null
+++ b/0350-intersection-of-two-arrays-ii/README.md
@@ -0,0 +1,33 @@
+Easy
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.
+
+
+
Example 1:
+
+
Input: nums1 = [1,2,2,1], nums2 = [2,2]
+Output: [2,2]
+
+
+
Example 2:
+
+
Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
+Output: [4,9]
+Explanation: [9,4] is also accepted.
+
+
+
+
Constraints:
+
+
+ 1 <= nums1.length, nums2.length <= 1000
+ 0 <= nums1[i], nums2[i] <= 1000
+
+
+
+
Follow up:
+
+
+ - What if the given array is already sorted? How would you optimize your algorithm?
+ - What if
nums1's size is small compared to nums2's size? Which algorithm is better?
+ - What if elements of
nums2 are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?
+
+
\ No newline at end of file
diff --git a/0354-russian-doll-envelopes/NOTES.md b/0354-russian-doll-envelopes/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0354-russian-doll-envelopes/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0354-russian-doll-envelopes/README.md b/0354-russian-doll-envelopes/README.md
new file mode 100644
index 00000000..561fbe15
--- /dev/null
+++ b/0354-russian-doll-envelopes/README.md
@@ -0,0 +1,31 @@
+Hard
You are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and the height of an envelope.
+
+
One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's width and height.
+
+
Return the maximum number of envelopes you can Russian doll (i.e., put one inside the other).
+
+
Note: You cannot rotate an envelope.
+
+
+
Example 1:
+
+
Input: envelopes = [[5,4],[6,4],[6,7],[2,3]]
+Output: 3
+Explanation: The maximum number of envelopes you can Russian doll is 3 ([2,3] => [5,4] => [6,7]).
+
+
+
Example 2:
+
+
Input: envelopes = [[1,1],[1,1],[1,1]]
+Output: 1
+
+
+
+
Constraints:
+
+
+ 1 <= envelopes.length <= 105
+ envelopes[i].length == 2
+ 1 <= wi, hi <= 105
+
+
\ No newline at end of file
diff --git a/0368-largest-divisible-subset/0368-largest-divisible-subset.cpp b/0368-largest-divisible-subset/0368-largest-divisible-subset.cpp
new file mode 100644
index 00000000..d5cc332d
--- /dev/null
+++ b/0368-largest-divisible-subset/0368-largest-divisible-subset.cpp
@@ -0,0 +1,43 @@
+class Solution {
+public:
+ vector largestDivisibleSubset(vector& nums) {
+
+ int n = nums.size();
+
+ vector dp(n+1,1);
+ vector hash(n);
+ int lastIndex = -1;
+ int res = 1;
+ sort(nums.begin(),nums.end());
+
+ for(int i = 0; i dp[i])
+ {
+ dp[i] = dp[j] + 1;
+ hash[i] = j;
+ }
+ }
+ if(dp[i] > res)
+ {
+ lastIndex = i;
+ res = dp[i];
+ }
+ }
+ if(res == 1)
+ return {nums[0]};
+ vector ans;
+ ans.push_back(nums[lastIndex]);
+
+ while(hash[lastIndex] != lastIndex)
+ {
+ lastIndex = hash[lastIndex];
+ ans.push_back(nums[lastIndex]);
+ }
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0368-largest-divisible-subset/README.md b/0368-largest-divisible-subset/README.md
new file mode 100644
index 00000000..ae432a88
--- /dev/null
+++ b/0368-largest-divisible-subset/README.md
@@ -0,0 +1,32 @@
+Medium
Given a set of distinct positive integers nums, return the largest subset answer such that every pair (answer[i], answer[j]) of elements in this subset satisfies:
+
+
+ answer[i] % answer[j] == 0, or
+ answer[j] % answer[i] == 0
+
+
+
If there are multiple solutions, return any of them.
+
+
+
Example 1:
+
+
Input: nums = [1,2,3]
+Output: [1,2]
+Explanation: [1,3] is also accepted.
+
+
+
Example 2:
+
+
Input: nums = [1,2,4,8]
+Output: [1,2,4,8]
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 1000
+ 1 <= nums[i] <= 2 * 109
+ - All the integers in
nums are unique.
+
+
\ No newline at end of file
diff --git a/0380-insert-delete-getrandom-o1/NOTES.md b/0380-insert-delete-getrandom-o1/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0380-insert-delete-getrandom-o1/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0387-first-unique-character-in-a-string/0387-first-unique-character-in-a-string.cpp b/0387-first-unique-character-in-a-string/0387-first-unique-character-in-a-string.cpp
new file mode 100644
index 00000000..654d516d
--- /dev/null
+++ b/0387-first-unique-character-in-a-string/0387-first-unique-character-in-a-string.cpp
@@ -0,0 +1,20 @@
+class Solution {
+public:
+ int firstUniqChar(string s) {
+
+ int n = s.size();
+
+ map mp;
+
+ for(auto& ch : s)
+ ++mp[ch];
+
+ for(int i = 0; i < n; ++i)
+ {
+ if(mp[s[i]] == 1)
+ return i;
+ }
+
+ return -1;
+ }
+};
\ No newline at end of file
diff --git a/0387-first-unique-character-in-a-string/NOTES.md b/0387-first-unique-character-in-a-string/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0387-first-unique-character-in-a-string/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0387-first-unique-character-in-a-string/README.md b/0387-first-unique-character-in-a-string/README.md
new file mode 100644
index 00000000..e06661f4
--- /dev/null
+++ b/0387-first-unique-character-in-a-string/README.md
@@ -0,0 +1,21 @@
+Easy
Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.
+
+
+
Example 1:
+
Input: s = "leetcode"
+Output: 0
+
Example 2:
+
Input: s = "loveleetcode"
+Output: 2
+
Example 3:
+
Input: s = "aabb"
+Output: -1
+
+
+
Constraints:
+
+
+ 1 <= s.length <= 105
+ s consists of only lowercase English letters.
+
+
\ No newline at end of file
diff --git a/0389-find-the-difference/0389-find-the-difference.java b/0389-find-the-difference/0389-find-the-difference.java
new file mode 100644
index 00000000..e0564259
--- /dev/null
+++ b/0389-find-the-difference/0389-find-the-difference.java
@@ -0,0 +1,14 @@
+class Solution {
+ public char findTheDifference(String s, String t) {
+
+ char ch = 0;
+
+ for(char c : s.toCharArray())
+ ch ^= c;
+
+ for(char c : t.toCharArray())
+ ch ^= c;
+
+ return ch;
+ }
+}
\ No newline at end of file
diff --git a/0389-find-the-difference/NOTES.md b/0389-find-the-difference/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0389-find-the-difference/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0389-find-the-difference/README.md b/0389-find-the-difference/README.md
new file mode 100644
index 00000000..0663dd96
--- /dev/null
+++ b/0389-find-the-difference/README.md
@@ -0,0 +1,29 @@
+Easy
You are given two strings s and t.
+
+
String t is generated by random shuffling string s and then add one more letter at a random position.
+
+
Return the letter that was added to t.
+
+
+
Example 1:
+
+
Input: s = "abcd", t = "abcde"
+Output: "e"
+Explanation: 'e' is the letter that was added.
+
+
+
Example 2:
+
+
Input: s = "", t = "y"
+Output: "y"
+
+
+
+
Constraints:
+
+
+ 0 <= s.length <= 1000
+ t.length == s.length + 1
+ s and t consist of lowercase English letters.
+
+
\ No newline at end of file
diff --git a/0402-remove-k-digits/0402-remove-k-digits.cpp b/0402-remove-k-digits/0402-remove-k-digits.cpp
new file mode 100644
index 00000000..3a06c361
--- /dev/null
+++ b/0402-remove-k-digits/0402-remove-k-digits.cpp
@@ -0,0 +1,40 @@
+class Solution {
+public:
+ string removeKdigits(string num, int k) {
+
+ stack st;
+
+ st.push(num[0] - '0');
+
+ for(int i = 1; i < num.size(); ++i)
+ {
+ while(!st.empty() and st.top() > (num[i] - '0') and k)
+ {
+ st.pop();
+ k--;
+ }
+
+ st.push(num[i] - '0');
+ if(st.size() == 1 and st.top() == 0)
+ st.pop();
+ }
+
+ while(!st.empty() and k--)
+ {
+ st.pop();
+ }
+
+ string ans;
+
+ while(!st.empty())
+ {
+ ans += (st.top() + '0');
+ st.pop();
+ }
+
+ reverse(ans.begin(), ans.end());
+
+ return ans.empty() ? "0" : ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0402-remove-k-digits/NOTES.md b/0402-remove-k-digits/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0402-remove-k-digits/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0402-remove-k-digits/README.md b/0402-remove-k-digits/README.md
new file mode 100644
index 00000000..4319e3f3
--- /dev/null
+++ b/0402-remove-k-digits/README.md
@@ -0,0 +1,33 @@
+Medium
Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num.
+
+
+
Example 1:
+
+
Input: num = "1432219", k = 3
+Output: "1219"
+Explanation: Remove the three digits 4, 3, and 2 to form the new number 1219 which is the smallest.
+
+
+
Example 2:
+
+
Input: num = "10200", k = 1
+Output: "200"
+Explanation: Remove the leading 1 and the number is 200. Note that the output must not contain leading zeroes.
+
+
+
Example 3:
+
+
Input: num = "10", k = 2
+Output: "0"
+Explanation: Remove all the digits from the number and it is left with nothing which is 0.
+
+
+
+
Constraints:
+
+
+ 1 <= k <= num.length <= 105
+ num consists of only digits.
+ num does not have any leading zeros except for the zero itself.
+
+
\ No newline at end of file
diff --git a/0404-sum-of-left-leaves/0404-sum-of-left-leaves.cpp b/0404-sum-of-left-leaves/0404-sum-of-left-leaves.cpp
new file mode 100644
index 00000000..09675766
--- /dev/null
+++ b/0404-sum-of-left-leaves/0404-sum-of-left-leaves.cpp
@@ -0,0 +1,42 @@
+/**
+ * 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 helper(TreeNode* root, int& sum)
+ {
+ if(!root)
+ return;
+
+ if(root->left and !root->left->left and !root->left->right)
+ {
+ sum += root->left->val;
+ helper(root->right, sum);
+ }
+ else
+ {
+ helper(root->left, sum);
+ helper(root->right, sum);
+ }
+
+ }
+
+ int sumOfLeftLeaves(TreeNode* root) {
+
+ int sum = 0;
+
+ helper(root, sum);
+
+ return sum;
+
+ }
+};
\ No newline at end of file
diff --git a/0404-sum-of-left-leaves/README.md b/0404-sum-of-left-leaves/README.md
new file mode 100644
index 00000000..34e2f167
--- /dev/null
+++ b/0404-sum-of-left-leaves/README.md
@@ -0,0 +1,26 @@
+Easy
Given the root of a binary tree, return the sum of all left leaves.
+
+
A leaf is a node with no children. A left leaf is a leaf that is the left child of another node.
+
+
+
Example 1:
+

+
Input: root = [3,9,20,null,null,15,7]
+Output: 24
+Explanation: There are two left leaves in the binary tree, with values 9 and 15 respectively.
+
+
+
Example 2:
+
+
Input: root = [1]
+Output: 0
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 1000].
+ -1000 <= Node.val <= 1000
+
+
\ No newline at end of file
diff --git a/0409-longest-palindrome/0409-longest-palindrome.cpp b/0409-longest-palindrome/0409-longest-palindrome.cpp
new file mode 100644
index 00000000..d2c5f246
--- /dev/null
+++ b/0409-longest-palindrome/0409-longest-palindrome.cpp
@@ -0,0 +1,25 @@
+class Solution {
+public:
+ int longestPalindrome(string s) {
+ map m ;
+ bool odd = 0;
+ for(auto i : s)
+ ++m[i];
+
+ int ind = 0;
+
+ for(auto i : m)
+ {
+ if(i.second % 2 == 0)
+ ind += i.second;
+ else
+ {
+ ind += i.second - 1;
+ odd = true;
+ }
+ }
+ if(odd)
+ ind += 1;
+ return ind;
+ }
+};
\ No newline at end of file
diff --git a/0409-longest-palindrome/NOTES.md b/0409-longest-palindrome/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0409-longest-palindrome/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0409-longest-palindrome/README.md b/0409-longest-palindrome/README.md
new file mode 100644
index 00000000..2d84a7b5
--- /dev/null
+++ b/0409-longest-palindrome/README.md
@@ -0,0 +1,27 @@
+Easy
Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.
+
+
Letters are case sensitive, for example, "Aa" is not considered a palindrome.
+
+
+
Example 1:
+
+
Input: s = "abccccdd"
+Output: 7
+Explanation: One longest palindrome that can be built is "dccaccd", whose length is 7.
+
+
+
Example 2:
+
+
Input: s = "a"
+Output: 1
+Explanation: The longest palindrome that can be built is "a", whose length is 1.
+
+
+
+
Constraints:
+
+
+ 1 <= s.length <= 2000
+ s consists of lowercase and/or uppercase English letters only.
+
+
\ No newline at end of file
diff --git a/0442-find-all-duplicates-in-an-array/NOTES.md b/0442-find-all-duplicates-in-an-array/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0442-find-all-duplicates-in-an-array/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0455-assign-cookies/0455-assign-cookies.cpp b/0455-assign-cookies/0455-assign-cookies.cpp
new file mode 100644
index 00000000..de9ce97d
--- /dev/null
+++ b/0455-assign-cookies/0455-assign-cookies.cpp
@@ -0,0 +1,24 @@
+class Solution {
+public:
+ int findContentChildren(vector& g, vector& s) {
+
+ sort(g.begin(), g.end());
+ sort(s.begin(), s.end());
+
+ int j = 0;
+ int cnt = 0;
+ int i = 0;
+
+ while(j < s.size() and i < g.size())
+ {
+ if(g[i] <= s[j])
+ {
+ ++i, ++j, ++cnt;
+ }
+ else
+ ++j;
+ }
+
+ return cnt;
+ }
+};
\ No newline at end of file
diff --git a/0455-assign-cookies/README.md b/0455-assign-cookies/README.md
new file mode 100644
index 00000000..9387f6b5
--- /dev/null
+++ b/0455-assign-cookies/README.md
@@ -0,0 +1,32 @@
+Easy
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
+
+
Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number.
+
+
+
Example 1:
+
+
Input: g = [1,2,3], s = [1,1]
+Output: 1
+Explanation: You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3.
+And even though you have 2 cookies, since their size is both 1, you could only make the child whose greed factor is 1 content.
+You need to output 1.
+
+
+
Example 2:
+
+
Input: g = [1,2], s = [1,2,3]
+Output: 2
+Explanation: You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2.
+You have 3 cookies and their sizes are big enough to gratify all of the children,
+You need to output 2.
+
+
+
+
Constraints:
+
+
+ 1 <= g.length <= 3 * 104
+ 0 <= s.length <= 3 * 104
+ 1 <= g[i], s[j] <= 231 - 1
+
+
\ No newline at end of file
diff --git a/0456-132-pattern/0456-132-pattern.cpp b/0456-132-pattern/0456-132-pattern.cpp
new file mode 100644
index 00000000..a1973605
--- /dev/null
+++ b/0456-132-pattern/0456-132-pattern.cpp
@@ -0,0 +1,28 @@
+class Solution {
+public:
+ bool find132pattern(vector& nums) {
+
+ int n = nums.size();
+
+ int s3 = INT_MIN;
+
+ stack st;
+
+ for(int i = n-1; i >= 0; --i)
+ {
+ if(nums[i] < s3)
+ return true;
+
+ while(!st.empty() and st.top() < nums[i])
+ {
+ s3 = st.top();
+ st.pop();
+ }
+
+ st.push(nums[i]);
+ }
+
+ return false;
+
+ }
+};
\ No newline at end of file
diff --git a/0456-132-pattern/NOTES.md b/0456-132-pattern/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0456-132-pattern/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0456-132-pattern/README.md b/0456-132-pattern/README.md
new file mode 100644
index 00000000..049ce47c
--- /dev/null
+++ b/0456-132-pattern/README.md
@@ -0,0 +1,35 @@
+Medium
Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j].
+
+
Return true if there is a 132 pattern in nums, otherwise, return false.
+
+
+
Example 1:
+
+
Input: nums = [1,2,3,4]
+Output: false
+Explanation: There is no 132 pattern in the sequence.
+
+
+
Example 2:
+
+
Input: nums = [3,1,4,2]
+Output: true
+Explanation: There is a 132 pattern in the sequence: [1, 4, 2].
+
+
+
Example 3:
+
+
Input: nums = [-1,3,2,0]
+Output: true
+Explanation: There are three 132 patterns in the sequence: [-1, 3, 2], [-1, 3, 0] and [-1, 2, 0].
+
+
+
+
Constraints:
+
+
+ n == nums.length
+ 1 <= n <= 2 * 105
+ -109 <= nums[i] <= 109
+
+
\ No newline at end of file
diff --git a/0462-minimum-moves-to-equal-array-elements-ii/0462-minimum-moves-to-equal-array-elements-ii.cpp b/0462-minimum-moves-to-equal-array-elements-ii/0462-minimum-moves-to-equal-array-elements-ii.cpp
new file mode 100644
index 00000000..4e5db170
--- /dev/null
+++ b/0462-minimum-moves-to-equal-array-elements-ii/0462-minimum-moves-to-equal-array-elements-ii.cpp
@@ -0,0 +1,24 @@
+class Solution {
+public:
+ int minMoves2(vector& nums) {
+
+ int n = nums.size();
+
+ sort(nums.begin(), nums.end());
+
+ int med;
+ if(n&1)
+ med = nums[n/2];
+ else
+ med = (nums[n/2] + nums[(n/2) - 1])/2;
+
+ int ans = 0;
+
+ for(int i = 0; i < n; ++i)
+ {
+ ans += abs(med - nums[i]);
+ }
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0462-minimum-moves-to-equal-array-elements-ii/NOTES.md b/0462-minimum-moves-to-equal-array-elements-ii/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0462-minimum-moves-to-equal-array-elements-ii/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0462-minimum-moves-to-equal-array-elements-ii/README.md b/0462-minimum-moves-to-equal-array-elements-ii/README.md
new file mode 100644
index 00000000..9c851770
--- /dev/null
+++ b/0462-minimum-moves-to-equal-array-elements-ii/README.md
@@ -0,0 +1,31 @@
+Medium
Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal.
+
+
In one move, you can increment or decrement an element of the array by 1.
+
+
Test cases are designed so that the answer will fit in a 32-bit integer.
+
+
+
Example 1:
+
+
Input: nums = [1,2,3]
+Output: 2
+Explanation:
+Only two moves are needed (remember each move increments or decrements one element):
+[1,2,3] => [2,2,3] => [2,2,2]
+
+
+
Example 2:
+
+
Input: nums = [1,10,2,9]
+Output: 16
+
+
+
+
Constraints:
+
+
+ n == nums.length
+ 1 <= nums.length <= 105
+ -109 <= nums[i] <= 109
+
+
\ No newline at end of file
diff --git a/0476-number-complement/0476-number-complement.cpp b/0476-number-complement/0476-number-complement.cpp
new file mode 100644
index 00000000..1670a955
--- /dev/null
+++ b/0476-number-complement/0476-number-complement.cpp
@@ -0,0 +1,23 @@
+class Solution {
+public:
+ int findComplement(int num) {
+
+ int ans = 0;
+ bool ok = false;
+
+ for(int i = 31; i >= 0; --i)
+ {
+ if(!(num & (1 << i)) and ok)
+ {
+ ans += (1 << i);
+ }
+
+ if(num & (1 << i))
+ {
+ ok = true;
+ }
+ }
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0476-number-complement/README.md b/0476-number-complement/README.md
new file mode 100644
index 00000000..b46eec80
--- /dev/null
+++ b/0476-number-complement/README.md
@@ -0,0 +1,33 @@
+Easy
The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binary representation.
+
+
+ - For example, The integer
5 is "101" in binary and its complement is "010" which is the integer 2.
+
+
+
Given an integer num, return its complement.
+
+
+
Example 1:
+
+
Input: num = 5
+Output: 2
+Explanation: The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2.
+
+
+
Example 2:
+
+
Input: num = 1
+Output: 0
+Explanation: The binary representation of 1 is 1 (no leading zero bits), and its complement is 0. So you need to output 0.
+
+
+
+
Constraints:
+
+
+
+
+
Note: This question is the same as 1009: https://leetcode.com/problems/complement-of-base-10-integer/
+
\ No newline at end of file
diff --git a/0493-reverse-pairs/NOTES.md b/0493-reverse-pairs/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0493-reverse-pairs/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0501-find-mode-in-binary-search-tree/0501-find-mode-in-binary-search-tree.cpp b/0501-find-mode-in-binary-search-tree/0501-find-mode-in-binary-search-tree.cpp
new file mode 100644
index 00000000..e9971d98
--- /dev/null
+++ b/0501-find-mode-in-binary-search-tree/0501-find-mode-in-binary-search-tree.cpp
@@ -0,0 +1,44 @@
+/**
+ * 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 helper(TreeNode* root, unordered_map& mp, int& maxi)
+ {
+ if(root)
+ {
+ helper(root->left, mp, maxi);
+ ++mp[root->val];
+ maxi = max(maxi, mp[root->val]);
+ helper(root->right, mp, maxi);
+ }
+ }
+
+ vector findMode(TreeNode* root) {
+
+ unordered_map mp;
+
+ int maxi = 0;
+
+ helper(root, mp, maxi);
+
+ vector ans;
+
+ for(auto& itr : mp)
+ {
+ if(itr.second == maxi)
+ ans.push_back(itr.first);
+ }
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0501-find-mode-in-binary-search-tree/README.md b/0501-find-mode-in-binary-search-tree/README.md
new file mode 100644
index 00000000..eaf7c94d
--- /dev/null
+++ b/0501-find-mode-in-binary-search-tree/README.md
@@ -0,0 +1,35 @@
+Easy
Given the root of a binary search tree (BST) with duplicates, return all the mode(s) (i.e., the most frequently occurred element) in it.
+
+
If the tree has more than one mode, return them in any order.
+
+
Assume a BST is defined as follows:
+
+
+ - The left subtree of a node contains only nodes with keys less than or equal to the node's key.
+ - The right subtree of a node contains only nodes with keys greater than or equal to the node's key.
+ - Both the left and right subtrees must also be binary search trees.
+
+
+
+
Example 1:
+

+
Input: root = [1,null,2,2]
+Output: [2]
+
+
+
Example 2:
+
+
Input: root = [0]
+Output: [0]
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 104].
+ -105 <= Node.val <= 105
+
+
+
+
Follow up: Could you do that without using any extra space? (Assume that the implicit stack space incurred due to recursion does not count).
\ No newline at end of file
diff --git a/0502-ipo/NOTES.md b/0502-ipo/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0502-ipo/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0513-find-bottom-left-tree-value/0513-find-bottom-left-tree-value.cpp b/0513-find-bottom-left-tree-value/0513-find-bottom-left-tree-value.cpp
new file mode 100644
index 00000000..2859c4be
--- /dev/null
+++ b/0513-find-bottom-left-tree-value/0513-find-bottom-left-tree-value.cpp
@@ -0,0 +1,39 @@
+/**
+ * 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:
+
+ map mp;
+
+ void findLeftValue(TreeNode* root, int currLevel , int& maxLevel)
+ {
+ if(root)
+ {
+ findLeftValue(root->left, currLevel + 1, maxLevel);
+ findLeftValue(root->right, currLevel + 1, maxLevel);
+
+ maxLevel = max(maxLevel , currLevel);
+
+ if(mp.find(maxLevel) == mp.end())
+ mp[maxLevel] = root->val;
+ }
+ }
+
+ int findBottomLeftValue(TreeNode* root) {
+
+ int maxLevel = 0;
+
+ findLeftValue(root, 0, maxLevel);
+
+ return mp[maxLevel];
+ }
+};
\ No newline at end of file
diff --git a/0513-find-bottom-left-tree-value/NOTES.md b/0513-find-bottom-left-tree-value/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0513-find-bottom-left-tree-value/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0513-find-bottom-left-tree-value/README.md b/0513-find-bottom-left-tree-value/README.md
new file mode 100644
index 00000000..a733cb60
--- /dev/null
+++ b/0513-find-bottom-left-tree-value/README.md
@@ -0,0 +1,23 @@
+Medium
Given the root of a binary tree, return the leftmost value in the last row of the tree.
+
+
+
Example 1:
+

+
Input: root = [2,1,3]
+Output: 1
+
+
+
Example 2:
+

+
Input: root = [1,2,3,4,null,5,6,null,null,7]
+Output: 7
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 104].
+ -231 <= Node.val <= 231 - 1
+
+
\ No newline at end of file
diff --git a/0514-freedom-trail/0514-freedom-trail.cpp b/0514-freedom-trail/0514-freedom-trail.cpp
new file mode 100644
index 00000000..4eaf3a81
--- /dev/null
+++ b/0514-freedom-trail/0514-freedom-trail.cpp
@@ -0,0 +1,33 @@
+class Solution {
+public:
+
+ int helper(int idx, int ptr, int n, int m, string& ring, string& key, vector>& dp)
+ {
+ if(idx >= m)
+ return 0;
+
+ if(dp[idx][ptr] != -1)
+ return dp[idx][ptr];
+
+ int steps = 1e9;
+
+ for(int i = 0; i < n; ++i)
+ {
+ if(ring[i] == key[idx])
+ steps = min(steps, 1 + min(abs(i - ptr), n - abs(i-ptr)) + helper(idx+1, i, n, m, ring, key, dp));
+ }
+
+ return dp[idx][ptr] = steps;
+ }
+
+ int findRotateSteps(string ring, string key) {
+
+ int n = ring.size();
+ int m = key.size();
+
+ vector> dp(m+1, vector(n+1, -1));
+
+ return helper(0, 0, n, m, ring, key, dp);
+
+ }
+};
\ No newline at end of file
diff --git a/0514-freedom-trail/NOTES.md b/0514-freedom-trail/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0514-freedom-trail/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0514-freedom-trail/README.md b/0514-freedom-trail/README.md
new file mode 100644
index 00000000..7f40ba56
--- /dev/null
+++ b/0514-freedom-trail/README.md
@@ -0,0 +1,40 @@
+Hard
In the video game Fallout 4, the quest "Road to Freedom" requires players to reach a metal dial called the "Freedom Trail Ring" and use the dial to spell a specific keyword to open the door.
+
+
Given a string ring that represents the code engraved on the outer ring and another string key that represents the keyword that needs to be spelled, return the minimum number of steps to spell all the characters in the keyword.
+
+
Initially, the first character of the ring is aligned at the "12:00" direction. You should spell all the characters in key one by one by rotating ring clockwise or anticlockwise to make each character of the string key aligned at the "12:00" direction and then by pressing the center button.
+
+
At the stage of rotating the ring to spell the key character key[i]:
+
+
+ - You can rotate the ring clockwise or anticlockwise by one place, which counts as one step. The final purpose of the rotation is to align one of
ring's characters at the "12:00" direction, where this character must equal key[i].
+ - If the character
key[i] has been aligned at the "12:00" direction, press the center button to spell, which also counts as one step. After the pressing, you could begin to spell the next character in the key (next stage). Otherwise, you have finished all the spelling.
+
+
+
+
Example 1:
+

+
Input: ring = "godding", key = "gd"
+Output: 4
+Explanation:
+For the first key character 'g', since it is already in place, we just need 1 step to spell this character.
+For the second key character 'd', we need to rotate the ring "godding" anticlockwise by two steps to make it become "ddinggo".
+Also, we need 1 more step for spelling.
+So the final output is 4.
+
+
+
Example 2:
+
+
Input: ring = "godding", key = "godding"
+Output: 13
+
+
+
+
Constraints:
+
+
+ 1 <= ring.length, key.length <= 100
+ ring and key consist of only lower case English letters.
+ - It is guaranteed that
key could always be spelled by rotating ring.
+
+
\ No newline at end of file
diff --git a/0515-find-largest-value-in-each-tree-row/0515-find-largest-value-in-each-tree-row.cpp b/0515-find-largest-value-in-each-tree-row/0515-find-largest-value-in-each-tree-row.cpp
new file mode 100644
index 00000000..f2f14855
--- /dev/null
+++ b/0515-find-largest-value-in-each-tree-row/0515-find-largest-value-in-each-tree-row.cpp
@@ -0,0 +1,49 @@
+/**
+ * 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 largestValues(TreeNode* root) {
+
+ if(!root)
+ return {};
+
+ queue q;
+
+ vector ans;
+
+ q.push(root);
+
+ while(!q.empty())
+ {
+ int size = q.size();
+
+ int maxi = INT_MIN;
+
+ for(int i = 0; i < size; ++i)
+ {
+ TreeNode* curr = q.front();
+ q.pop();
+
+ maxi = max(maxi, curr->val);
+
+ if(curr->left)
+ q.push(curr->left);
+
+ if(curr->right)
+ q.push(curr->right);
+ }
+
+ ans.push_back(maxi);
+ }
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0515-find-largest-value-in-each-tree-row/NOTES.md b/0515-find-largest-value-in-each-tree-row/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0515-find-largest-value-in-each-tree-row/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0515-find-largest-value-in-each-tree-row/README.md b/0515-find-largest-value-in-each-tree-row/README.md
new file mode 100644
index 00000000..95bb431d
--- /dev/null
+++ b/0515-find-largest-value-in-each-tree-row/README.md
@@ -0,0 +1,23 @@
+Medium
Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).
+
+
+
Example 1:
+

+
Input: root = [1,3,2,5,3,null,9]
+Output: [1,3,9]
+
+
+
Example 2:
+
+
Input: root = [1,2,3]
+Output: [1,3]
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree will be in the range
[0, 104].
+ -231 <= Node.val <= 231 - 1
+
+
\ No newline at end of file
diff --git a/0523-continuous-subarray-sum/0523-continuous-subarray-sum.cpp b/0523-continuous-subarray-sum/0523-continuous-subarray-sum.cpp
new file mode 100644
index 00000000..47037b9c
--- /dev/null
+++ b/0523-continuous-subarray-sum/0523-continuous-subarray-sum.cpp
@@ -0,0 +1,30 @@
+class Solution {
+public:
+ bool checkSubarraySum(vector& nums, int k) {
+
+ int n = nums.size();
+
+ map mp;
+
+ int sum = 0;
+
+ mp[0] = -1;
+
+ for(int i = 0; i < n; ++i)
+ {
+ sum += nums[i];
+
+ int rem = sum % k;
+
+ if(mp.find(rem) != mp.end())
+ {
+ if(i - mp[rem] > 1)
+ return true;
+ }
+ else
+ mp[rem] = i;
+ }
+
+ return false;
+ }
+};
\ No newline at end of file
diff --git a/0523-continuous-subarray-sum/NOTES.md b/0523-continuous-subarray-sum/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0523-continuous-subarray-sum/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0523-continuous-subarray-sum/README.md b/0523-continuous-subarray-sum/README.md
new file mode 100644
index 00000000..0bf5d8e1
--- /dev/null
+++ b/0523-continuous-subarray-sum/README.md
@@ -0,0 +1,48 @@
+Medium
Given an integer array nums and an integer k, return true if nums has a good subarray or false otherwise.
+
+
A good subarray is a subarray where:
+
+
+ - its length is at least two, and
+ - the sum of the elements of the subarray is a multiple of
k.
+
+
+
Note that:
+
+
+ - A subarray is a contiguous part of the array.
+ - An integer
x is a multiple of k if there exists an integer n such that x = n * k. 0 is always a multiple of k.
+
+
+
+
Example 1:
+
+
Input: nums = [23,2,4,6,7], k = 6
+Output: true
+Explanation: [2, 4] is a continuous subarray of size 2 whose elements sum up to 6.
+
+
+
Example 2:
+
+
Input: nums = [23,2,6,4,7], k = 6
+Output: true
+Explanation: [23, 2, 6, 4, 7] is an continuous subarray of size 5 whose elements sum up to 42.
+42 is a multiple of 6 because 42 = 7 * 6 and 7 is an integer.
+
+
+
Example 3:
+
+
Input: nums = [23,2,6,4,7], k = 13
+Output: false
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 105
+ 0 <= nums[i] <= 109
+ 0 <= sum(nums[i]) <= 231 - 1
+ 1 <= k <= 231 - 1
+
+
\ No newline at end of file
diff --git a/0525-contiguous-array/0525-contiguous-array.cpp b/0525-contiguous-array/0525-contiguous-array.cpp
new file mode 100644
index 00000000..1d4d98ec
--- /dev/null
+++ b/0525-contiguous-array/0525-contiguous-array.cpp
@@ -0,0 +1,23 @@
+class Solution {
+public:
+ int findMaxLength(vector& nums) {
+
+ map mp;
+
+ mp.insert({0, -1});
+
+ int sum = 0, ans = 0, n = nums.size();
+
+ for(int i = 0; i < n; ++i)
+ {
+ sum += (nums[i] == 1 ? 1 : -1);
+ if(mp.find(sum) != mp.end())
+ ans = max(ans, i - mp[sum]);
+ else
+ mp[sum] = i;
+ }
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0525-contiguous-array/NOTES.md b/0525-contiguous-array/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0525-contiguous-array/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0543-diameter-of-binary-tree/0543-diameter-of-binary-tree.cpp b/0543-diameter-of-binary-tree/0543-diameter-of-binary-tree.cpp
new file mode 100644
index 00000000..e64aec71
--- /dev/null
+++ b/0543-diameter-of-binary-tree/0543-diameter-of-binary-tree.cpp
@@ -0,0 +1,34 @@
+/**
+ * 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 helper(TreeNode* root, int& ans)
+ {
+ if(!root)
+ return 0;
+
+ int left = helper(root->left, ans);
+ int right = helper(root->right, ans);
+
+ ans = max(ans, left + right);
+
+ return 1 + max(left, right);
+ }
+
+ int diameterOfBinaryTree(TreeNode* root) {
+
+ int ans = 0;
+ helper(root, ans);
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0543-diameter-of-binary-tree/NOTES.md b/0543-diameter-of-binary-tree/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0543-diameter-of-binary-tree/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0543-diameter-of-binary-tree/README.md b/0543-diameter-of-binary-tree/README.md
new file mode 100644
index 00000000..26e6fc34
--- /dev/null
+++ b/0543-diameter-of-binary-tree/README.md
@@ -0,0 +1,28 @@
+Easy
Given the root of a binary tree, return the length of the diameter of the tree.
+
+
The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root.
+
+
The length of a path between two nodes is represented by the number of edges between them.
+
+
+
Example 1:
+

+
Input: root = [1,2,3,4,5]
+Output: 3
+Explanation: 3 is the length of the path [4,2,1,3] or [5,2,1,3].
+
+
+
Example 2:
+
+
Input: root = [1,2]
+Output: 1
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 104].
+ -100 <= Node.val <= 100
+
+
\ No newline at end of file
diff --git a/0552-student-attendance-record-ii/0552-student-attendance-record-ii.cpp b/0552-student-attendance-record-ii/0552-student-attendance-record-ii.cpp
new file mode 100644
index 00000000..f87965aa
--- /dev/null
+++ b/0552-student-attendance-record-ii/0552-student-attendance-record-ii.cpp
@@ -0,0 +1,41 @@
+class Solution {
+public:
+
+ const int mod = 1e9+7;
+
+ int helper(int n, int absent, int late, vector>>& dp)
+ {
+ if(n == 0)
+ return 1;
+
+ if(dp[n][absent][late] != -1)
+ return dp[n][absent][late];
+
+ int total = 0;
+
+ total += helper(n-1, absent, 2, dp);
+ total %= mod;
+
+ if(absent > 0)
+ {
+ total += helper(n-1, absent-1, 2, dp);
+ total %= mod;
+ }
+
+ if(late > 0)
+ {
+ total += helper(n-1, absent, late-1, dp);
+ total %= mod;
+ }
+
+ return dp[n][absent][late] = total;
+ }
+
+ int checkRecord(int n) {
+
+ vector>> dp(n+1, vector>(2, vector(3, -1)));
+
+ return helper(n, 1, 2, dp);
+
+ }
+};
\ No newline at end of file
diff --git a/0552-student-attendance-record-ii/NOTES.md b/0552-student-attendance-record-ii/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0552-student-attendance-record-ii/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0556-next-greater-element-iii/0556-next-greater-element-iii.cpp b/0556-next-greater-element-iii/0556-next-greater-element-iii.cpp
new file mode 100644
index 00000000..6d89562c
--- /dev/null
+++ b/0556-next-greater-element-iii/0556-next-greater-element-iii.cpp
@@ -0,0 +1,49 @@
+class Solution {
+public:
+
+ long long next_Permutation(int n)
+ {
+ string str = to_string(n);
+
+ int breakPoint = -1;
+
+ int m = str.size();
+
+ for(int i = m-2; i >= 0; --i)
+ {
+ if(str[i] < str[i+1])
+ {
+ breakPoint = i;
+ break;
+ }
+ }
+
+ if(breakPoint == -1)
+ {
+ reverse(str.begin(), str.end());
+ }
+ else
+ {
+ for(int i = m-1; i > breakPoint; --i)
+ {
+ if(str[i] > str[breakPoint])
+ {
+ swap(str[i], str[breakPoint]);
+ break;
+ }
+ }
+
+ reverse(str.begin() + breakPoint + 1 , str.end());
+ }
+
+ return stoll(str);
+ }
+
+ int nextGreaterElement(int n) {
+
+ long long nextGreater = next_Permutation(n);
+
+ return (nextGreater > INT_MAX or nextGreater <= n ? -1 : nextGreater);
+
+ }
+};
\ No newline at end of file
diff --git a/0556-next-greater-element-iii/README.md b/0556-next-greater-element-iii/README.md
new file mode 100644
index 00000000..3827d0f3
--- /dev/null
+++ b/0556-next-greater-element-iii/README.md
@@ -0,0 +1,19 @@
+Medium
Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive integer exists, return -1.
+
+
Note that the returned integer should fit in 32-bit integer, if there is a valid answer but it does not fit in 32-bit integer, return -1.
+
+
+
Example 1:
+
Input: n = 12
+Output: 21
+
Example 2:
+
Input: n = 21
+Output: -1
+
+
+
Constraints:
+
+
+
\ No newline at end of file
diff --git a/0557-reverse-words-in-a-string-iii/0557-reverse-words-in-a-string-iii.cpp b/0557-reverse-words-in-a-string-iii/0557-reverse-words-in-a-string-iii.cpp
new file mode 100644
index 00000000..610932ec
--- /dev/null
+++ b/0557-reverse-words-in-a-string-iii/0557-reverse-words-in-a-string-iii.cpp
@@ -0,0 +1,22 @@
+class Solution {
+public:
+ string reverseWords(string s) {
+
+ stringstream ss(s);
+
+ string word;
+
+ string ans;
+
+ while(ss >> word)
+ {
+ reverse(word.begin(), word.end());
+ ans += word + ' ';
+ }
+
+ ans.pop_back();
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0557-reverse-words-in-a-string-iii/NOTES.md b/0557-reverse-words-in-a-string-iii/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0557-reverse-words-in-a-string-iii/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0557-reverse-words-in-a-string-iii/README.md b/0557-reverse-words-in-a-string-iii/README.md
new file mode 100644
index 00000000..cdc6104c
--- /dev/null
+++ b/0557-reverse-words-in-a-string-iii/README.md
@@ -0,0 +1,21 @@
+Easy
Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
+
+
+
Example 1:
+
Input: s = "Let's take LeetCode contest"
+Output: "s'teL ekat edoCteeL tsetnoc"
+
Example 2:
+
Input: s = "God Ding"
+Output: "doG gniD"
+
+
+
Constraints:
+
+
+ 1 <= s.length <= 5 * 104
+ s contains printable ASCII characters.
+ s does not contain any leading or trailing spaces.
+ - There is at least one word in
s.
+ - All the words in
s are separated by a single space.
+
+
\ No newline at end of file
diff --git a/0564-find-the-closest-palindrome/0564-find-the-closest-palindrome.cpp b/0564-find-the-closest-palindrome/0564-find-the-closest-palindrome.cpp
new file mode 100644
index 00000000..0d79df33
--- /dev/null
+++ b/0564-find-the-closest-palindrome/0564-find-the-closest-palindrome.cpp
@@ -0,0 +1,61 @@
+using ll = long long;
+
+class Solution {
+public:
+
+ ll palindrome(ll firstHalf, bool isEven)
+ {
+ ll resultNum = firstHalf;
+
+ if(!isEven)
+ firstHalf /= 10;
+
+ while(firstHalf > 0)
+ {
+ resultNum = (resultNum * 10) + (firstHalf%10);
+ firstHalf /= 10;
+ }
+
+ return resultNum;
+ }
+
+ string nearestPalindromic(string n) {
+
+ int sz = n.size();
+ int mid = sz/2;
+
+ ll firstHalfLen = (sz % 2 == 0 ? mid : mid+1);
+
+ ll firstHalf = stoll(n.substr(0, firstHalfLen));
+
+ vector pos;
+
+ pos.push_back(palindrome(firstHalf, sz % 2 == 0));
+ pos.push_back(palindrome(firstHalf+1, sz % 2 == 0));
+ pos.push_back(palindrome(firstHalf-1, sz % 2 == 0));
+ pos.push_back(pow(10, sz-1) - 1);
+ pos.push_back(pow(10, sz) + 1);
+
+ ll diff = LONG_MAX;
+ ll res = LONG_MAX;
+ ll orgNum = stoll(n);
+
+ for(auto& num : pos)
+ {
+ if(num == orgNum) continue;
+
+ if(abs(num - orgNum) < diff)
+ {
+ diff = abs(num - orgNum);
+ res = num;
+ }
+ else if(abs(num - orgNum) == diff)
+ {
+ res = min(res, num);
+ }
+ }
+
+ return to_string(res);
+
+ }
+};
\ No newline at end of file
diff --git a/0564-find-the-closest-palindrome/NOTES.md b/0564-find-the-closest-palindrome/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0564-find-the-closest-palindrome/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0564-find-the-closest-palindrome/README.md b/0564-find-the-closest-palindrome/README.md
new file mode 100644
index 00000000..a5b4ec14
--- /dev/null
+++ b/0564-find-the-closest-palindrome/README.md
@@ -0,0 +1,28 @@
+Hard
Given a string n representing an integer, return the closest integer (not including itself), which is a palindrome. If there is a tie, return the smaller one.
+
+
The closest is defined as the absolute difference minimized between two integers.
+
+
+
Example 1:
+
+
Input: n = "123"
+Output: "121"
+
+
+
Example 2:
+
+
Input: n = "1"
+Output: "0"
+Explanation: 0 and 2 are the closest palindromes but we return the smallest which is 0.
+
+
+
+
Constraints:
+
+
+ 1 <= n.length <= 18
+ n consists of only digits.
+ n does not have leading zeros.
+ n is representing an integer in the range [1, 1018 - 1].
+
+
\ No newline at end of file
diff --git a/0576-out-of-boundary-paths/0576-out-of-boundary-paths.cpp b/0576-out-of-boundary-paths/0576-out-of-boundary-paths.cpp
new file mode 100644
index 00000000..379ead6e
--- /dev/null
+++ b/0576-out-of-boundary-paths/0576-out-of-boundary-paths.cpp
@@ -0,0 +1,36 @@
+class Solution {
+public:
+
+ int dp[55][55][55];
+
+ const int mod = 1e9+7;
+
+ int boundaryPaths(int i, int j, int n, int m, int maxMove)
+ {
+ if(maxMove >= 0 and i < 0 or j < 0 or i >= n or j >= m)
+ return 1;
+
+ if(dp[i][j][maxMove] != -1)
+ return dp[i][j][maxMove];
+
+ int up = 0, right = 0, down = 0, left = 0;
+
+ if(maxMove)
+ {
+ up = boundaryPaths(i-1, j, n, m, maxMove-1);
+ right = boundaryPaths(i, j+1, n, m, maxMove-1);
+ down = boundaryPaths(i+1, j, n, m, maxMove-1);
+ left = boundaryPaths(i, j-1, n, m, maxMove-1);
+ }
+
+ return dp[i][j][maxMove] = ((((up%mod + right%mod)%mod + down%mod)%mod + left%mod) % mod);
+ }
+
+ int findPaths(int m, int n, int maxMove, int startRow, int startColumn) {
+
+ memset(dp, -1, sizeof(dp));
+
+ return boundaryPaths(startRow, startColumn, m, n, maxMove);
+
+ }
+};
\ No newline at end of file
diff --git a/0576-out-of-boundary-paths/NOTES.md b/0576-out-of-boundary-paths/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0576-out-of-boundary-paths/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0576-out-of-boundary-paths/README.md b/0576-out-of-boundary-paths/README.md
new file mode 100644
index 00000000..25a688e2
--- /dev/null
+++ b/0576-out-of-boundary-paths/README.md
@@ -0,0 +1,27 @@
+Medium
There is an m x n grid with a ball. The ball is initially at the position [startRow, startColumn]. You are allowed to move the ball to one of the four adjacent cells in the grid (possibly out of the grid crossing the grid boundary). You can apply at most maxMove moves to the ball.
+
+
Given the five integers m, n, maxMove, startRow, startColumn, return the number of paths to move the ball out of the grid boundary. Since the answer can be very large, return it modulo 109 + 7.
+
+
+
Example 1:
+

+
Input: m = 2, n = 2, maxMove = 2, startRow = 0, startColumn = 0
+Output: 6
+
+
+
Example 2:
+

+
Input: m = 1, n = 3, maxMove = 3, startRow = 0, startColumn = 1
+Output: 12
+
+
+
+
Constraints:
+
+
+ 1 <= m, n <= 50
+ 0 <= maxMove <= 50
+ 0 <= startRow < m
+ 0 <= startColumn < n
+
+
\ No newline at end of file
diff --git a/0584-find-customer-referee/0584-find-customer-referee.sql b/0584-find-customer-referee/0584-find-customer-referee.sql
new file mode 100644
index 00000000..7f77caac
--- /dev/null
+++ b/0584-find-customer-referee/0584-find-customer-referee.sql
@@ -0,0 +1,3 @@
+# Write your MySQL query statement below
+
+select name from Customer where referee_id is null or referee_id != 2;
\ No newline at end of file
diff --git a/0584-find-customer-referee/NOTES.md b/0584-find-customer-referee/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0584-find-customer-referee/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0584-find-customer-referee/README.md b/0584-find-customer-referee/README.md
new file mode 100644
index 00000000..372be3cf
--- /dev/null
+++ b/0584-find-customer-referee/README.md
@@ -0,0 +1,47 @@
+Easy
Table: Customer
+
+
+-------------+---------+
+| Column Name | Type |
++-------------+---------+
+| id | int |
+| name | varchar |
+| referee_id | int |
++-------------+---------+
+In SQL, id is the primary key column for this table.
+Each row of this table indicates the id of a customer, their name, and the id of the customer who referred them.
+
+
+
+
+
Find the names of the customer that are not referred by the customer with id = 2.
+
+
Return the result table in any order.
+
+
The result format is in the following example.
+
+
+
Example 1:
+
+
Input:
+Customer table:
++----+------+------------+
+| id | name | referee_id |
++----+------+------------+
+| 1 | Will | null |
+| 2 | Jane | null |
+| 3 | Alex | 2 |
+| 4 | Bill | null |
+| 5 | Zack | 1 |
+| 6 | Mark | 2 |
++----+------+------------+
+Output:
++------+
+| name |
++------+
+| Will |
+| Jane |
+| Bill |
+| Zack |
++------+
+
+
\ No newline at end of file
diff --git a/0590-n-ary-tree-postorder-traversal/0590-n-ary-tree-postorder-traversal.cpp b/0590-n-ary-tree-postorder-traversal/0590-n-ary-tree-postorder-traversal.cpp
new file mode 100644
index 00000000..fb8c1b94
--- /dev/null
+++ b/0590-n-ary-tree-postorder-traversal/0590-n-ary-tree-postorder-traversal.cpp
@@ -0,0 +1,45 @@
+/*
+// Definition for a Node.
+class Node {
+public:
+ int val;
+ vector children;
+
+ Node() {}
+
+ Node(int _val) {
+ val = _val;
+ }
+
+ Node(int _val, vector _children) {
+ val = _val;
+ children = _children;
+ }
+};
+*/
+
+class Solution {
+public:
+
+ void postorder(Node* root, vector& ans)
+ {
+ if(root)
+ {
+ for(auto& chlNode : root->children)
+ {
+ postorder(chlNode, ans);
+ }
+ ans.push_back(root->val);
+ }
+ }
+
+ vector postorder(Node* root) {
+
+ vector ans;
+
+ postorder(root, ans);
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0590-n-ary-tree-postorder-traversal/NOTES.md b/0590-n-ary-tree-postorder-traversal/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0590-n-ary-tree-postorder-traversal/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0590-n-ary-tree-postorder-traversal/README.md b/0590-n-ary-tree-postorder-traversal/README.md
new file mode 100644
index 00000000..cee6f44d
--- /dev/null
+++ b/0590-n-ary-tree-postorder-traversal/README.md
@@ -0,0 +1,29 @@
+Easy
Given the root of an n-ary tree, return the postorder traversal of its nodes' values.
+
+
Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the null value (See examples)
+
+
+
Example 1:
+

+
Input: root = [1,null,3,2,4,null,5,6]
+Output: [5,6,3,2,4,1]
+
+
+
Example 2:
+

+
Input: root = [1,null,2,3,4,5,null,null,6,7,null,8,null,9,10,null,null,11,null,12,null,13,null,null,14]
+Output: [2,6,14,11,7,3,12,8,4,13,9,10,5,1]
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[0, 104].
+ 0 <= Node.val <= 104
+ - The height of the n-ary tree is less than or equal to
1000.
+
+
+
+
Follow up: Recursive solution is trivial, could you do it iteratively?
+
\ No newline at end of file
diff --git a/0592-fraction-addition-and-subtraction/0592-fraction-addition-and-subtraction.cpp b/0592-fraction-addition-and-subtraction/0592-fraction-addition-and-subtraction.cpp
new file mode 100644
index 00000000..532239f0
--- /dev/null
+++ b/0592-fraction-addition-and-subtraction/0592-fraction-addition-and-subtraction.cpp
@@ -0,0 +1,47 @@
+class Solution {
+public:
+ string fractionAddition(string expression) {
+
+ int num = 0;
+ int den = 1;
+
+ int i = 0, n = expression.size();
+
+ while(i < n)
+ {
+ int curNum = 0;
+ int curDen = 0;
+
+ bool isNeg = (expression[i] == '-');
+
+ if(expression[i] == '+' or expression[i] == '-')
+ ++i;
+
+ while(i < n && isdigit(expression[i]))
+ {
+ int val = expression[i] - '0';
+ curNum = (curNum * 10) + val;
+ ++i;
+ }
+
+ ++i;
+ if(isNeg) curNum *= -1;
+
+ while(i < n && isdigit(expression[i]))
+ {
+ int val = expression[i] - '0';
+ curDen = (curDen * 10) + val;
+ ++i;
+ }
+
+ num = (num * curDen) + (curNum * den);
+ den = den * curDen;
+ }
+
+ int gcd = abs(__gcd(num, den));
+ num /= gcd;
+ den /= gcd;
+
+ return to_string(num) + "/" + to_string(den);
+ }
+};
\ No newline at end of file
diff --git a/0592-fraction-addition-and-subtraction/README.md b/0592-fraction-addition-and-subtraction/README.md
new file mode 100644
index 00000000..5d1558c5
--- /dev/null
+++ b/0592-fraction-addition-and-subtraction/README.md
@@ -0,0 +1,34 @@
+Medium
Given a string expression representing an expression of fraction addition and subtraction, return the calculation result in string format.
+
+
The final result should be an irreducible fraction. If your final result is an integer, change it to the format of a fraction that has a denominator 1. So in this case, 2 should be converted to 2/1.
+
+
+
Example 1:
+
+
Input: expression = "-1/2+1/2"
+Output: "0/1"
+
+
+
Example 2:
+
+
Input: expression = "-1/2+1/2+1/3"
+Output: "1/3"
+
+
+
Example 3:
+
+
Input: expression = "1/3-1/2"
+Output: "-1/6"
+
+
+
+
Constraints:
+
+
+ - The input string only contains
'0' to '9', '/', '+' and '-'. So does the output.
+ - Each fraction (input and output) has the format
±numerator/denominator. If the first input fraction or the output is positive, then '+' will be omitted.
+ - The input only contains valid irreducible fractions, where the numerator and denominator of each fraction will always be in the range
[1, 10]. If the denominator is 1, it means this fraction is actually an integer in a fraction format defined above.
+ - The number of given fractions will be in the range
[1, 10].
+ - The numerator and denominator of the final result are guaranteed to be valid and in the range of 32-bit int.
+
+
\ No newline at end of file
diff --git a/0595-big-countries/0595-big-countries.sql b/0595-big-countries/0595-big-countries.sql
new file mode 100644
index 00000000..4ade2dde
--- /dev/null
+++ b/0595-big-countries/0595-big-countries.sql
@@ -0,0 +1,3 @@
+# Write your MySQL query statement below
+
+select name, population, area from World where area >= 3000000 or population >= 25000000 order by name asc;
\ No newline at end of file
diff --git a/0595-big-countries/NOTES.md b/0595-big-countries/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0595-big-countries/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0606-construct-string-from-binary-tree/0606-construct-string-from-binary-tree.cpp b/0606-construct-string-from-binary-tree/0606-construct-string-from-binary-tree.cpp
new file mode 100644
index 00000000..0323b754
--- /dev/null
+++ b/0606-construct-string-from-binary-tree/0606-construct-string-from-binary-tree.cpp
@@ -0,0 +1,45 @@
+/**
+ * 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 helper(TreeNode* root, string& ans)
+ {
+ if(root)
+ {
+ ans += to_string(root->val);
+
+ if(root->left)
+ {
+ ans += '(';
+ helper(root->left, ans);
+ ans += ')';
+ }
+
+ if(root->right)
+ {
+ if(!root->left)
+ ans += "()";
+ ans += '(';
+ helper(root->right, ans);
+ ans += ')';
+ }
+ }
+ }
+
+ string tree2str(TreeNode* root) {
+
+ string ans;
+ helper(root, ans);
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0606-construct-string-from-binary-tree/NOTES.md b/0606-construct-string-from-binary-tree/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0606-construct-string-from-binary-tree/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0606-construct-string-from-binary-tree/README.md b/0606-construct-string-from-binary-tree/README.md
new file mode 100644
index 00000000..d304033f
--- /dev/null
+++ b/0606-construct-string-from-binary-tree/README.md
@@ -0,0 +1,27 @@
+Easy
Given the root of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way, and return it.
+
+
Omit all the empty parenthesis pairs that do not affect the one-to-one mapping relationship between the string and the original binary tree.
+
+
+
Example 1:
+

+
Input: root = [1,2,3,4]
+Output: "1(2(4))(3)"
+Explanation: Originally, it needs to be "1(2(4)())(3()())", but you need to omit all the unnecessary empty parenthesis pairs. And it will be "1(2(4))(3)"
+
+
+
Example 2:
+

+
Input: root = [1,2,3,null,4]
+Output: "1(2()(4))(3)"
+Explanation: Almost the same as the first example, except we cannot omit the first parenthesis pair to break the one-to-one mapping relationship between the input and the output.
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 104].
+ -1000 <= Node.val <= 1000
+
+
\ No newline at end of file
diff --git a/0621-task-scheduler/0621-task-scheduler.cpp b/0621-task-scheduler/0621-task-scheduler.cpp
new file mode 100644
index 00000000..1b34b091
--- /dev/null
+++ b/0621-task-scheduler/0621-task-scheduler.cpp
@@ -0,0 +1,24 @@
+class Solution {
+public:
+ int leastInterval(vector& tasks, int n) {
+
+ mapmp;
+ int count = 0;
+
+ for(auto ele : tasks)
+ {
+ mp[ele]++;
+ count = max(count, mp[ele]);
+ }
+
+ int ans = (count-1)*(n+1);
+
+ for(auto e : mp)
+ {
+ if(e.second == count)
+ ans++;
+ }
+
+ return max((int)tasks.size(), ans);
+ }
+};
\ No newline at end of file
diff --git a/0621-task-scheduler/README.md b/0621-task-scheduler/README.md
new file mode 100644
index 00000000..a449ed32
--- /dev/null
+++ b/0621-task-scheduler/README.md
@@ -0,0 +1,95 @@
+Medium
You are given an array of CPU tasks, each represented by letters A to Z, and a cooling time, n. Each cycle or interval allows the completion of one task. Tasks can be completed in any order, but there's a constraint: identical tasks must be separated by at least n intervals due to cooling time.
+
+
Return the minimum number of intervals required to complete all tasks.
+
+
+
Example 1:
+
+
+
Input: tasks = ["A","A","A","B","B","B"], n = 2
+
+
Output: 8
+
+
Explanation: A possible sequence is: A -> B -> idle -> A -> B -> idle -> A -> B.
+
+
After completing task A, you must wait two cycles before doing A again. The same applies to task B. In the 3rd interval, neither A nor B can be done, so you idle. By the 4th cycle, you can do A again as 2 intervals have passed.
+
+
+
Example 2:
+
+
+
Input: tasks = ["A","C","A","B","D","B"], n = 1
+
+
Output: 6
+
+
Explanation: A possible sequence is: A -> B -> C -> D -> A -> B.
+
+
With a cooling interval of 1, you can repeat a task after just one other task.
+
+
+
Example 3:
+
+
+
Input: tasks = ["A","A","A", "B","B","B"], n = 3
+
+
Output: 10
+
+
Explanation: A possible sequence is: A -> B -> idle -> idle -> A -> B -> idle -> idle -> A -> B.
+
+
There are only two types of tasks, A and B, which need to be separated by 3 intervals. This leads to idling twice between repetitions of these tasks.
+
+
+
+
Constraints:
+
+
+ 1 <= tasks.length <= 104
+ tasks[i] is an uppercase English letter.
+ 0 <= n <= 100
+
+
\ No newline at end of file
diff --git a/0623-add-one-row-to-tree/0623-add-one-row-to-tree.cpp b/0623-add-one-row-to-tree/0623-add-one-row-to-tree.cpp
new file mode 100644
index 00000000..6b5b032c
--- /dev/null
+++ b/0623-add-one-row-to-tree/0623-add-one-row-to-tree.cpp
@@ -0,0 +1,63 @@
+/**
+ * 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* addOneRow(TreeNode* root, int val, int depth) {
+
+ if(depth == 1)
+ {
+ TreeNode* node = new TreeNode(val);
+
+ node->left = root;
+
+ return node;
+ }
+
+ queue q;
+
+ --depth;
+ q.push(root);
+
+ while(!q.empty())
+ {
+ int sz = q.size();
+
+ for(int i = 0; i < sz; ++i)
+ {
+ TreeNode* curr = q.front();
+ q.pop();
+
+ if(depth == 1)
+ {
+ TreeNode* nexLeft = curr->left ? curr->left : nullptr;
+ TreeNode* newNode1 = new TreeNode(val);
+ curr->left = newNode1;
+ newNode1->left = nexLeft;
+
+ TreeNode* nexRight = curr->right ? curr->right : nullptr;
+ TreeNode* newNode2 = new TreeNode(val);
+ curr->right = newNode2;
+ newNode2->right = nexRight;
+ }
+
+ if(curr->left)
+ q.push(curr->left);
+ if(curr->right)
+ q.push(curr->right);
+ }
+
+ --depth;
+ }
+
+ return root;
+ }
+};
\ No newline at end of file
diff --git a/0623-add-one-row-to-tree/README.md b/0623-add-one-row-to-tree/README.md
new file mode 100644
index 00000000..c1f4b23e
--- /dev/null
+++ b/0623-add-one-row-to-tree/README.md
@@ -0,0 +1,37 @@
+Medium
Given the root of a binary tree and two integers val and depth, add a row of nodes with value val at the given depth depth.
+
+
Note that the root node is at depth 1.
+
+
The adding rule is:
+
+
+ - Given the integer
depth, for each not null tree node cur at the depth depth - 1, create two tree nodes with value val as cur's left subtree root and right subtree root.
+ cur's original left subtree should be the left subtree of the new left subtree root.
+ cur's original right subtree should be the right subtree of the new right subtree root.
+ - If
depth == 1 that means there is no depth depth - 1 at all, then create a tree node with value val as the new root of the whole original tree, and the original tree is the new root's left subtree.
+
+
+
+
Example 1:
+

+
Input: root = [4,2,6,3,1,5], val = 1, depth = 2
+Output: [4,1,1,2,null,null,6,3,1,5]
+
+
+
Example 2:
+

+
Input: root = [4,2,null,3,1], val = 1, depth = 3
+Output: [4,2,null,1,1,3,null,null,1]
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 104].
+ - The depth of the tree is in the range
[1, 104].
+ -100 <= Node.val <= 100
+ -105 <= val <= 105
+ 1 <= depth <= the depth of tree + 1
+
+
\ No newline at end of file
diff --git a/0624-maximum-distance-in-arrays/0624-maximum-distance-in-arrays.cpp b/0624-maximum-distance-in-arrays/0624-maximum-distance-in-arrays.cpp
new file mode 100644
index 00000000..5ceb9190
--- /dev/null
+++ b/0624-maximum-distance-in-arrays/0624-maximum-distance-in-arrays.cpp
@@ -0,0 +1,17 @@
+class Solution {
+public:
+ int maxDistance(vector>& arrays) {
+
+ int left = arrays[0][0], right = arrays[0].back(), ans = 0;
+
+ for(int i = 1; i < arrays.size(); i++)
+ {
+ ans = max(ans, max(abs(arrays[i][0] - right), abs(arrays[i].back() - left)));
+ left = min(left, arrays[i][0]);
+ right = max(right, arrays[i].back());
+ }
+
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0624-maximum-distance-in-arrays/README.md b/0624-maximum-distance-in-arrays/README.md
new file mode 100644
index 00000000..77b7a756
--- /dev/null
+++ b/0624-maximum-distance-in-arrays/README.md
@@ -0,0 +1,32 @@
+Medium
You are given m arrays, where each array is sorted in ascending order.
+
+
You can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance between two integers a and b to be their absolute difference |a - b|.
+
+
Return the maximum distance.
+
+
+
Example 1:
+
+
Input: arrays = [[1,2,3],[4,5],[1,2,3]]
+Output: 4
+Explanation: One way to reach the maximum distance 4 is to pick 1 in the first or third array and pick 5 in the second array.
+
+
+
Example 2:
+
+
Input: arrays = [[1],[1]]
+Output: 0
+
+
+
+
Constraints:
+
+
+ m == arrays.length
+ 2 <= m <= 105
+ 1 <= arrays[i].length <= 500
+ -104 <= arrays[i][j] <= 104
+ arrays[i] is sorted in ascending order.
+ - There will be at most
105 integers in all the arrays.
+
+
\ No newline at end of file
diff --git a/0628-maximum-product-of-three-numbers/0628-maximum-product-of-three-numbers.cpp b/0628-maximum-product-of-three-numbers/0628-maximum-product-of-three-numbers.cpp
new file mode 100644
index 00000000..75508a34
--- /dev/null
+++ b/0628-maximum-product-of-three-numbers/0628-maximum-product-of-three-numbers.cpp
@@ -0,0 +1,12 @@
+class Solution {
+public:
+ int maximumProduct(vector& nums) {
+
+ int n = nums.size();
+
+ sort(nums.begin(), nums.end());
+
+ return max({nums[0] * nums[1] * nums[2], nums[0] * nums[1] * nums[n-1], nums[n-3] * nums[n-2] * nums[n-1]});
+
+ }
+};
\ No newline at end of file
diff --git a/0628-maximum-product-of-three-numbers/NOTES.md b/0628-maximum-product-of-three-numbers/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0628-maximum-product-of-three-numbers/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0628-maximum-product-of-three-numbers/README.md b/0628-maximum-product-of-three-numbers/README.md
new file mode 100644
index 00000000..ecd0b816
--- /dev/null
+++ b/0628-maximum-product-of-three-numbers/README.md
@@ -0,0 +1,21 @@
+Easy
Given an integer array nums, find three numbers whose product is maximum and return the maximum product.
+
+
+
Example 1:
+
Input: nums = [1,2,3]
+Output: 6
+
Example 2:
+
Input: nums = [1,2,3,4]
+Output: 24
+
Example 3:
+
Input: nums = [-1,-2,-3]
+Output: -6
+
+
+
Constraints:
+
+
+ 3 <= nums.length <= 104
+ -1000 <= nums[i] <= 1000
+
+
\ No newline at end of file
diff --git a/0629-k-inverse-pairs-array/0629-k-inverse-pairs-array.cpp b/0629-k-inverse-pairs-array/0629-k-inverse-pairs-array.cpp
new file mode 100644
index 00000000..44bda9a0
--- /dev/null
+++ b/0629-k-inverse-pairs-array/0629-k-inverse-pairs-array.cpp
@@ -0,0 +1,24 @@
+class Solution {
+public:
+ int mod = 1e9+7;
+ int kInversePairs(int n, int K) {
+ //dp[i][j] denote till i numbers how many jth inversion pair-containing permutations are there
+ vector> dp(n+1,vector(K+1,0));
+ dp[0][0]=0;
+ for(int i=1;i<=K;i++){
+ dp[1][i]=0;
+ }
+ for(int i=1;i<=n;i++){
+ dp[i][0]=1;
+ }
+for(int i=2;i<=n;i++){
+ for(int j=1;j<=K;j++){
+ dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
+ if(j-i>=0){
+ dp[i][j]=(dp[i][j]-dp[i-1][j-i]+mod)%mod;
+ }
+ }
+ }
+ return dp[n][K];
+ }
+};
diff --git a/0629-k-inverse-pairs-array/README.md b/0629-k-inverse-pairs-array/README.md
new file mode 100644
index 00000000..b9c1e1ff
--- /dev/null
+++ b/0629-k-inverse-pairs-array/README.md
@@ -0,0 +1,27 @@
+Hard
For an integer array nums, an inverse pair is a pair of integers [i, j] where 0 <= i < j < nums.length and nums[i] > nums[j].
+
+
Given two integers n and k, return the number of different arrays consist of numbers from 1 to n such that there are exactly k inverse pairs. Since the answer can be huge, return it modulo 109 + 7.
+
+
+
Example 1:
+
+
Input: n = 3, k = 0
+Output: 1
+Explanation: Only the array [1,2,3] which consists of numbers from 1 to 3 has exactly 0 inverse pairs.
+
+
+
Example 2:
+
+
Input: n = 3, k = 1
+Output: 2
+Explanation: The array [1,3,2] and [2,1,3] have exactly 1 inverse pair.
+
+
+
+
Constraints:
+
+
+ 1 <= n <= 1000
+ 0 <= k <= 1000
+
+
\ No newline at end of file
diff --git a/0633-sum-of-square-numbers/0633-sum-of-square-numbers.cpp b/0633-sum-of-square-numbers/0633-sum-of-square-numbers.cpp
new file mode 100644
index 00000000..185bb33f
--- /dev/null
+++ b/0633-sum-of-square-numbers/0633-sum-of-square-numbers.cpp
@@ -0,0 +1,22 @@
+class Solution {
+public:
+ bool judgeSquareSum(int c) {
+
+ for(int i = 2; i * i <= c; ++i)
+ {
+ int cnt = 0;
+
+ while(c % i == 0)
+ {
+ ++cnt;
+ c /= i;
+ }
+
+ if(i % 4 == 3 and cnt % 2 != 0)
+ return false;
+ }
+
+ return c%4 != 3;
+
+ }
+};
\ No newline at end of file
diff --git a/0633-sum-of-square-numbers/NOTES.md b/0633-sum-of-square-numbers/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0633-sum-of-square-numbers/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0633-sum-of-square-numbers/README.md b/0633-sum-of-square-numbers/README.md
new file mode 100644
index 00000000..efeadaa1
--- /dev/null
+++ b/0633-sum-of-square-numbers/README.md
@@ -0,0 +1,23 @@
+Medium
Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c.
+
+
+
Example 1:
+
+
Input: c = 5
+Output: true
+Explanation: 1 * 1 + 2 * 2 = 5
+
+
+
Example 2:
+
+
Input: c = 3
+Output: false
+
+
+
+
Constraints:
+
+
+
\ No newline at end of file
diff --git a/0645-set-mismatch/0645-set-mismatch.cpp b/0645-set-mismatch/0645-set-mismatch.cpp
new file mode 100644
index 00000000..37bdfca6
--- /dev/null
+++ b/0645-set-mismatch/0645-set-mismatch.cpp
@@ -0,0 +1,28 @@
+class Solution {
+public:
+ vector findErrorNums(vector& nums) {
+
+ int n = nums.size();
+ int missing = -1, repeat = -1;
+
+ for(int i = 0; i < n; ++i)
+ {
+ if(nums[abs(nums[i])-1] < 0)
+ {
+ repeat = abs(nums[i]);
+ }
+ else
+ {
+ nums[abs(nums[i])-1] *= -1;
+ }
+ }
+
+ for(int i = 0; i < n; ++i)
+ {
+ if(nums[i] > 0)
+ missing = i + 1;
+ }
+
+ return {repeat, missing};
+ }
+};
\ No newline at end of file
diff --git a/0645-set-mismatch/NOTES.md b/0645-set-mismatch/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0645-set-mismatch/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0645-set-mismatch/README.md b/0645-set-mismatch/README.md
new file mode 100644
index 00000000..78699612
--- /dev/null
+++ b/0645-set-mismatch/README.md
@@ -0,0 +1,22 @@
+Easy
You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in repetition of one number and loss of another number.
+
+
You are given an integer array nums representing the data status of this set after the error.
+
+
Find the number that occurs twice and the number that is missing and return them in the form of an array.
+
+
+
Example 1:
+
Input: nums = [1,2,2,4]
+Output: [2,3]
+
Example 2:
+
Input: nums = [1,1]
+Output: [1,2]
+
+
+
Constraints:
+
+
+ 2 <= nums.length <= 104
+ 1 <= nums[i] <= 104
+
+
\ No newline at end of file
diff --git a/0647-palindromic-substrings/0647-palindromic-substrings.cpp b/0647-palindromic-substrings/0647-palindromic-substrings.cpp
new file mode 100644
index 00000000..750babdc
--- /dev/null
+++ b/0647-palindromic-substrings/0647-palindromic-substrings.cpp
@@ -0,0 +1,35 @@
+class Solution {
+public:
+ int countSubstrings(string s) {
+
+ int n = s.size();
+
+ vector> dp(n+1, vector(n+1, 0));
+
+ int cnt = 0;
+
+ for(int diff = 0; diff < n; ++diff)
+ {
+ for(int i = 0, j = diff; i < n and j < n; ++i, ++j)
+ {
+ if(i == j)
+ {
+ ++cnt;
+ dp[i][j] = 1;
+ }
+ else if(diff == 1 and s[i] == s[j])
+ {
+ ++cnt;
+ dp[i][j] = 2;
+ }
+ else if(diff > 1 and s[i] == s[j] and dp[i+1][j-1])
+ {
+ ++cnt;
+ dp[i][j] = dp[i+1][j-1] + 2;
+ }
+ }
+ }
+
+ return cnt;
+ }
+};
\ No newline at end of file
diff --git a/0647-palindromic-substrings/README.md b/0647-palindromic-substrings/README.md
new file mode 100644
index 00000000..f833b17e
--- /dev/null
+++ b/0647-palindromic-substrings/README.md
@@ -0,0 +1,29 @@
+Medium
Given a string s, return the number of palindromic substrings in it.
+
+
A string is a palindrome when it reads the same backward as forward.
+
+
A substring is a contiguous sequence of characters within the string.
+
+
+
Example 1:
+
+
Input: s = "abc"
+Output: 3
+Explanation: Three palindromic strings: "a", "b", "c".
+
+
+
Example 2:
+
+
Input: s = "aaa"
+Output: 6
+Explanation: Six palindromic strings: "a", "a", "a", "aa", "aa", "aaa".
+
+
+
+
Constraints:
+
+
+ 1 <= s.length <= 1000
+ s consists of lowercase English letters.
+
+
\ No newline at end of file
diff --git a/0648-replace-words/0648-replace-words.cpp b/0648-replace-words/0648-replace-words.cpp
new file mode 100644
index 00000000..c01b7524
--- /dev/null
+++ b/0648-replace-words/0648-replace-words.cpp
@@ -0,0 +1,110 @@
+class Node
+{
+ private:
+ Node* child[26] = {nullptr};
+ bool isWord = false;
+
+ public:
+ bool containsKey(char ch)
+ {
+ return child[ch-'a'] != nullptr;
+ }
+
+ Node* get(char ch)
+ {
+ return child[ch-'a'];
+ }
+
+ void put(char ch, Node* newNode)
+ {
+ child[ch-'a'] = newNode;
+ }
+
+ void setEnd()
+ {
+ isWord = true;
+ }
+
+ bool isEnd()
+ {
+ return isWord;
+ }
+};
+
+class Trie{
+ private:
+ Node* root;
+
+ public:
+ Trie()
+ {
+ root = new Node();
+ }
+
+ void insert(string& word)
+ {
+ int n = word.size();
+ Node* temp = root;
+
+ for(int i = 0; i < n; ++i)
+ {
+ if(!temp->containsKey(word[i]))
+ temp->put(word[i], new Node());
+ temp = temp->get(word[i]);
+ }
+ temp->setEnd();
+ }
+
+ string search(string& word)
+ {
+ int n = word.size();
+ Node* temp = root;
+ string ans;
+
+ for(int i = 0; i < n; ++i)
+ {
+ if(temp->containsKey(word[i]))
+ {
+ ans += word[i];
+ }
+ else
+ return "-1";
+
+ temp = temp->get(word[i]);
+
+ if(temp->isEnd())
+ return ans;
+ }
+
+ return "-1";
+ }
+};
+
+class Solution {
+public:
+ string replaceWords(vector& dictionary, string sentence) {
+
+ Trie *trie = new Trie();
+
+ stringstream ss(sentence);
+ string word, ans;
+
+ for(auto& str : dictionary)
+ trie->insert(str);
+
+ while(ss >> word)
+ {
+ string curr = trie->search(word);
+
+ if(curr != "-1")
+ ans += curr;
+ else
+ ans += word;
+ ans += " ";
+ }
+
+ ans.pop_back();
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0648-replace-words/NOTES.md b/0648-replace-words/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0648-replace-words/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0648-replace-words/README.md b/0648-replace-words/README.md
new file mode 100644
index 00000000..aed11e37
--- /dev/null
+++ b/0648-replace-words/README.md
@@ -0,0 +1,34 @@
+Medium
In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root "help" is followed by the word "ful", we can form a derivative "helpful".
+
+
Given a dictionary consisting of many roots and a sentence consisting of words separated by spaces, replace all the derivatives in the sentence with the root forming it. If a derivative can be replaced by more than one root, replace it with the root that has the shortest length.
+
+
Return the sentence after the replacement.
+
+
+
Example 1:
+
+
Input: dictionary = ["cat","bat","rat"], sentence = "the cattle was rattled by the battery"
+Output: "the cat was rat by the bat"
+
+
+
Example 2:
+
+
Input: dictionary = ["a","b","c"], sentence = "aadsfasf absbs bbab cadsfafs"
+Output: "a a b c"
+
+
+
+
Constraints:
+
+
+ 1 <= dictionary.length <= 1000
+ 1 <= dictionary[i].length <= 100
+ dictionary[i] consists of only lower-case letters.
+ 1 <= sentence.length <= 106
+ sentence consists of only lower-case letters and spaces.
+ - The number of words in
sentence is in the range [1, 1000]
+ - The length of each word in
sentence is in the range [1, 1000]
+ - Every two consecutive words in
sentence will be separated by exactly one space.
+ sentence does not have leading or trailing spaces.
+
+
\ No newline at end of file
diff --git a/0650-2-keys-keyboard/0650-2-keys-keyboard.cpp b/0650-2-keys-keyboard/0650-2-keys-keyboard.cpp
new file mode 100644
index 00000000..bf53ed7a
--- /dev/null
+++ b/0650-2-keys-keyboard/0650-2-keys-keyboard.cpp
@@ -0,0 +1,35 @@
+class Solution {
+public:
+
+ int helper(int n, int last, int tot, vector>& dp)
+ {
+ if(n < 0)
+ return 1e9;
+
+ if(n == 0)
+ return 0;
+
+ if(dp[n][last] != -1)
+ return dp[n][last];
+
+ int previousCopy = 1 + helper(n - last, last, tot, dp);
+
+ int alreadyTaken = tot - n;
+
+ int newCopy = 2 + helper(n - alreadyTaken, alreadyTaken, tot, dp);
+
+ return dp[n][last] = min(newCopy, previousCopy);
+
+ }
+
+ int minSteps(int n) {
+
+ if(n == 1)
+ return 0;
+
+ vector> dp(n+1,vector(n+1, -1));
+
+ return helper(n-1, 1, n, dp) + 1;
+
+ }
+};
\ No newline at end of file
diff --git a/0650-2-keys-keyboard/NOTES.md b/0650-2-keys-keyboard/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0650-2-keys-keyboard/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0650-2-keys-keyboard/README.md b/0650-2-keys-keyboard/README.md
new file mode 100644
index 00000000..4d778549
--- /dev/null
+++ b/0650-2-keys-keyboard/README.md
@@ -0,0 +1,33 @@
+Medium
There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step:
+
+
+ - Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).
+ - Paste: You can paste the characters which are copied last time.
+
+
+
Given an integer n, return the minimum number of operations to get the character 'A' exactly n times on the screen.
+
+
+
Example 1:
+
+
Input: n = 3
+Output: 3
+Explanation: Initially, we have one character 'A'.
+In step 1, we use Copy All operation.
+In step 2, we use Paste operation to get 'AA'.
+In step 3, we use Paste operation to get 'AAA'.
+
+
+
Example 2:
+
+
Input: n = 1
+Output: 0
+
+
+
+
Constraints:
+
+
+
\ No newline at end of file
diff --git a/0661-image-smoother/0661-image-smoother.cpp b/0661-image-smoother/0661-image-smoother.cpp
new file mode 100644
index 00000000..81933ccf
--- /dev/null
+++ b/0661-image-smoother/0661-image-smoother.cpp
@@ -0,0 +1,30 @@
+class Solution {
+public:
+ vector> imageSmoother(vector>& img) {
+ int rows = img.size();
+ int cols = img[0].size();
+ vector> result(rows, vector(cols, 0));
+
+ for (int i = 0; i < rows; ++i)
+ {
+ for (int j = 0; j < cols; ++j)
+ {
+ int total_sum = 0;
+ int count = 0;
+
+ for (int l = max(0, i-1); l < min(rows, i+2); ++l)
+ {
+ for (int k = max(0, j-1); k < min(cols, j+2); ++k)
+ {
+ total_sum += img[l][k];
+ count += 1;
+ }
+ }
+
+ result[i][j] = total_sum / count;
+ }
+ }
+
+ return result;
+ }
+};
\ No newline at end of file
diff --git a/0661-image-smoother/README.md b/0661-image-smoother/README.md
new file mode 100644
index 00000000..6bd8ee84
--- /dev/null
+++ b/0661-image-smoother/README.md
@@ -0,0 +1,35 @@
+Easy
An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it in the average (i.e., the average of the four cells in the red smoother).
+

+
Given an m x n integer matrix img representing the grayscale of an image, return the image after applying the smoother on each cell of it.
+
+
+
Example 1:
+

+
Input: img = [[1,1,1],[1,0,1],[1,1,1]]
+Output: [[0,0,0],[0,0,0],[0,0,0]]
+Explanation:
+For the points (0,0), (0,2), (2,0), (2,2): floor(3/4) = floor(0.75) = 0
+For the points (0,1), (1,0), (1,2), (2,1): floor(5/6) = floor(0.83333333) = 0
+For the point (1,1): floor(8/9) = floor(0.88888889) = 0
+
+
+
Example 2:
+

+
Input: img = [[100,200,100],[200,50,200],[100,200,100]]
+Output: [[137,141,137],[141,138,141],[137,141,137]]
+Explanation:
+For the points (0,0), (0,2), (2,0), (2,2): floor((100+200+200+50)/4) = floor(137.5) = 137
+For the points (0,1), (1,0), (1,2), (2,1): floor((200+200+50+200+100+100)/6) = floor(141.666667) = 141
+For the point (1,1): floor((50+200+200+200+200+100+100+100+100)/9) = floor(138.888889) = 138
+
+
+
+
Constraints:
+
+
+ m == img.length
+ n == img[i].length
+ 1 <= m, n <= 200
+ 0 <= img[i][j] <= 255
+
+
\ No newline at end of file
diff --git a/0664-strange-printer/NOTES.md b/0664-strange-printer/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0664-strange-printer/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0678-valid-parenthesis-string/NOTES.md b/0678-valid-parenthesis-string/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0678-valid-parenthesis-string/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0678-valid-parenthesis-string/README.md b/0678-valid-parenthesis-string/README.md
new file mode 100644
index 00000000..26a61d26
--- /dev/null
+++ b/0678-valid-parenthesis-string/README.md
@@ -0,0 +1,30 @@
+Medium
Given a string s containing only three types of characters: '(', ')' and '*', return true if s is valid.
+
+
The following rules define a valid string:
+
+
+ - Any left parenthesis
'(' must have a corresponding right parenthesis ')'.
+ - Any right parenthesis
')' must have a corresponding left parenthesis '('.
+ - Left parenthesis
'(' must go before the corresponding right parenthesis ')'.
+ '*' could be treated as a single right parenthesis ')' or a single left parenthesis '(' or an empty string "".
+
+
+
+
Example 1:
+
Input: s = "()"
+Output: true
+
Example 2:
+
Input: s = "(*)"
+Output: true
+
Example 3:
+
Input: s = "(*))"
+Output: true
+
+
+
Constraints:
+
+
+ 1 <= s.length <= 100
+ s[i] is '(', ')' or '*'.
+
+
\ No newline at end of file
diff --git a/0698-partition-to-k-equal-sum-subsets/NOTES.md b/0698-partition-to-k-equal-sum-subsets/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0698-partition-to-k-equal-sum-subsets/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0705-design-hashset/0705-design-hashset.cpp b/0705-design-hashset/0705-design-hashset.cpp
index c76dbb4f..f8bc114b 100644
--- a/0705-design-hashset/0705-design-hashset.cpp
+++ b/0705-design-hashset/0705-design-hashset.cpp
@@ -1,22 +1,55 @@
class MyHashSet {
public:
- unordered_map mp;
+ vector> hash;
+ int size = 10001;
MyHashSet() {
-
+ hash.resize(size);
}
void add(int key) {
- ++mp[key];
+
+ int idx = key % size;
+
+ for(auto& itr : hash[idx])
+ {
+ if(itr == key)
+ {
+ return;
+ }
+ }
+
+ hash[idx].push_back(key);
}
void remove(int key) {
- mp.erase(key);
+
+ int idx = key % size;
+
+ for(auto itr = hash[idx].begin(); itr != hash[idx].end(); ++itr)
+ {
+ if(*itr == key)
+ {
+ hash[idx].erase(itr);
+ return;
+ }
+ }
+
}
bool contains(int key) {
- return mp[key] > 0;
+
+ int idx = key % size;
+
+ for(auto& itr : hash[idx])
+ {
+ if(itr == key)
+ {
+ return true;
+ }
+ }
+ return false;
}
};
diff --git a/0706-design-hashmap/0706-design-hashmap.cpp b/0706-design-hashmap/0706-design-hashmap.cpp
new file mode 100644
index 00000000..d991530d
--- /dev/null
+++ b/0706-design-hashmap/0706-design-hashmap.cpp
@@ -0,0 +1,63 @@
+class MyHashMap {
+public:
+
+ vector> > hash;
+ int size = 10001;
+
+ MyHashMap() {
+ hash.resize(size);
+ }
+
+ void put(int key, int value) {
+ int idx = key % size;
+
+ for(auto& [k, val] : hash[idx])
+ {
+ if(k == key)
+ {
+ val = value;
+ return;
+ }
+ }
+
+ hash[idx].push_back({key, value});
+ }
+
+ int get(int key) {
+
+ int idx = key % size;
+
+ if(hash[idx].empty())
+ return -1;
+
+ for(auto& [k, val] : hash[idx])
+ {
+ if(k == key)
+ return val;
+ }
+
+ return -1;
+ }
+
+ void remove(int key) {
+
+ int idx = key % size;
+
+ for(auto itr = hash[idx].begin(); itr != hash[idx].end(); ++itr)
+ {
+ if(itr->first == key)
+ {
+ hash[idx].erase(itr);
+ return;
+ }
+ }
+ }
+};
+
+/**
+ * Your MyHashMap object will be instantiated and called as such:
+ * MyHashMap* obj = new MyHashMap();
+ * obj->put(key,value);
+ * int param_2 = obj->get(key);
+ * obj->remove(key);
+ */
\ No newline at end of file
diff --git a/0706-design-hashmap/README.md b/0706-design-hashmap/README.md
new file mode 100644
index 00000000..830381e2
--- /dev/null
+++ b/0706-design-hashmap/README.md
@@ -0,0 +1,40 @@
+Easy
Design a HashMap without using any built-in hash table libraries.
+
+
Implement the MyHashMap class:
+
+
+ MyHashMap() initializes the object with an empty map.
+ void put(int key, int value) inserts a (key, value) pair into the HashMap. If the key already exists in the map, update the corresponding value.
+ int get(int key) returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key.
+ void remove(key) removes the key and its corresponding value if the map contains the mapping for the key.
+
+
+
+
Example 1:
+
+
Input
+["MyHashMap", "put", "put", "get", "get", "put", "get", "remove", "get"]
+[[], [1, 1], [2, 2], [1], [3], [2, 1], [2], [2], [2]]
+Output
+[null, null, null, 1, -1, null, 1, null, -1]
+
+Explanation
+MyHashMap myHashMap = new MyHashMap();
+myHashMap.put(1, 1); // The map is now [[1,1]]
+myHashMap.put(2, 2); // The map is now [[1,1], [2,2]]
+myHashMap.get(1); // return 1, The map is now [[1,1], [2,2]]
+myHashMap.get(3); // return -1 (i.e., not found), The map is now [[1,1], [2,2]]
+myHashMap.put(2, 1); // The map is now [[1,1], [2,1]] (i.e., update the existing value)
+myHashMap.get(2); // return 1, The map is now [[1,1], [2,1]]
+myHashMap.remove(2); // remove the mapping for 2, The map is now [[1,1]]
+myHashMap.get(2); // return -1 (i.e., not found), The map is now [[1,1]]
+
+
+
+
Constraints:
+
+
+ 0 <= key, value <= 106
+ - At most
104 calls will be made to put, get, and remove.
+
+
\ No newline at end of file
diff --git a/0719-find-k-th-smallest-pair-distance/0719-find-k-th-smallest-pair-distance.cpp b/0719-find-k-th-smallest-pair-distance/0719-find-k-th-smallest-pair-distance.cpp
new file mode 100644
index 00000000..af0b24dc
--- /dev/null
+++ b/0719-find-k-th-smallest-pair-distance/0719-find-k-th-smallest-pair-distance.cpp
@@ -0,0 +1,20 @@
+class Solution {
+public:
+ int smallestDistancePair(vector& nums, int k) {
+
+ int n = nums.size(), N = 1000000;
+ vector cnt(N, 0);
+
+ for (int i = 0; i < n; i++) {
+ for (int j = i+1; j < n; j++)
+ cnt[abs(nums[i]-nums[j])]++;
+ }
+
+ for (int i = 0; i < N; i++) {
+ if (cnt[i] >= k) return i;
+ k -= cnt[i];
+ }
+
+ return 0;
+ }
+};
\ No newline at end of file
diff --git a/0719-find-k-th-smallest-pair-distance/NOTES.md b/0719-find-k-th-smallest-pair-distance/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0719-find-k-th-smallest-pair-distance/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0719-find-k-th-smallest-pair-distance/README.md b/0719-find-k-th-smallest-pair-distance/README.md
new file mode 100644
index 00000000..cdd3d60c
--- /dev/null
+++ b/0719-find-k-th-smallest-pair-distance/README.md
@@ -0,0 +1,38 @@
+Hard
The distance of a pair of integers a and b is defined as the absolute difference between a and b.
+
+
Given an integer array nums and an integer k, return the kth smallest distance among all the pairs nums[i] and nums[j] where 0 <= i < j < nums.length.
+
+
+
Example 1:
+
+
Input: nums = [1,3,1], k = 1
+Output: 0
+Explanation: Here are all the pairs:
+(1,3) -> 2
+(1,1) -> 0
+(3,1) -> 2
+Then the 1st smallest distance pair is (1,1), and its distance is 0.
+
+
+
Example 2:
+
+
Input: nums = [1,1,1], k = 2
+Output: 0
+
+
+
Example 3:
+
+
Input: nums = [1,6,1], k = 3
+Output: 5
+
+
+
+
Constraints:
+
+
+ n == nums.length
+ 2 <= n <= 104
+ 0 <= nums[i] <= 106
+ 1 <= k <= n * (n - 1) / 2
+
+
\ No newline at end of file
diff --git a/0721-accounts-merge/NOTES.md b/0721-accounts-merge/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0721-accounts-merge/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0746-min-cost-climbing-stairs/0746-min-cost-climbing-stairs.cpp b/0746-min-cost-climbing-stairs/0746-min-cost-climbing-stairs.cpp
new file mode 100644
index 00000000..f2dbaf0d
--- /dev/null
+++ b/0746-min-cost-climbing-stairs/0746-min-cost-climbing-stairs.cpp
@@ -0,0 +1,27 @@
+class Solution {
+public:
+
+ int helper(int idx, int n, vector& cost, vector& dp)
+ {
+ if(idx >= n)
+ return 0;
+
+ if(dp[idx] != -1)
+ return dp[idx];
+
+ int oneStep = cost[idx] + helper(idx+1, n, cost, dp);
+ int twoStep = cost[idx] + helper(idx+2, n, cost, dp);
+
+ return dp[idx] = min(oneStep, twoStep);
+ }
+
+ int minCostClimbingStairs(vector& cost) {
+
+ int n = cost.size();
+
+ vector dp(n+1, -1);
+
+ return min(helper(0, n, cost, dp), helper(1, n, cost, dp));
+
+ }
+};
\ No newline at end of file
diff --git a/0746-min-cost-climbing-stairs/NOTES.md b/0746-min-cost-climbing-stairs/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0746-min-cost-climbing-stairs/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0746-min-cost-climbing-stairs/README.md b/0746-min-cost-climbing-stairs/README.md
new file mode 100644
index 00000000..c810b720
--- /dev/null
+++ b/0746-min-cost-climbing-stairs/README.md
@@ -0,0 +1,38 @@
+Easy
You are given an integer array cost where cost[i] is the cost of ith step on a staircase. Once you pay the cost, you can either climb one or two steps.
+
+
You can either start from the step with index 0, or the step with index 1.
+
+
Return the minimum cost to reach the top of the floor.
+
+
+
Example 1:
+
+
Input: cost = [10,15,20]
+Output: 15
+Explanation: You will start at index 1.
+- Pay 15 and climb two steps to reach the top.
+The total cost is 15.
+
+
+
Example 2:
+
+
Input: cost = [1,100,1,1,1,100,1,1,100,1]
+Output: 6
+Explanation: You will start at index 0.
+- Pay 1 and climb two steps to reach index 2.
+- Pay 1 and climb two steps to reach index 4.
+- Pay 1 and climb two steps to reach index 6.
+- Pay 1 and climb one step to reach index 7.
+- Pay 1 and climb two steps to reach index 9.
+- Pay 1 and climb one step to reach the top.
+The total cost is 6.
+
+
+
+
Constraints:
+
+
+ 2 <= cost.length <= 1000
+ 0 <= cost[i] <= 999
+
+
\ No newline at end of file
diff --git a/0752-open-the-lock/0752-open-the-lock.cpp b/0752-open-the-lock/0752-open-the-lock.cpp
new file mode 100644
index 00000000..b7539355
--- /dev/null
+++ b/0752-open-the-lock/0752-open-the-lock.cpp
@@ -0,0 +1,72 @@
+class Solution {
+public:
+
+ string forward(string curr, int idx)
+ {
+ if(curr[idx] == '9')
+ curr[idx] = '0';
+ else
+ ++curr[idx];
+ return curr;
+ }
+
+ string backward(string curr, int idx)
+ {
+ if(curr[idx] == '0')
+ curr[idx] = '9';
+ else
+ --curr[idx];
+ return curr;
+ }
+
+ int openLock(vector& deadends, string target) {
+
+ set st(deadends.begin(), deadends.end());
+
+ set visited;
+
+ queue q;
+
+ if(!st.count("0000"))
+ {
+ q.push("0000");
+ visited.insert("0000");
+ }
+
+ int steps = 0;
+
+ while(!q.empty())
+ {
+ int size = q.size();
+
+ for(int i = 0; i < size; ++i)
+ {
+ string curr = q.front();
+ q.pop();
+
+ if(curr == target)
+ return steps;
+
+ for(int i = 0; i < 4; ++i)
+ {
+ string f = forward(curr, i);
+ string s = backward(curr, i);
+
+ if(!st.count(f) and !visited.count(f))
+ {
+ q.push(f);
+ visited.insert(f);
+ }
+ if(!st.count(s) and !visited.count(s))
+ {
+ q.push(s);
+ visited.insert(s);
+ }
+ }
+ }
+ ++steps;
+ }
+
+ return -1;
+ }
+};
\ No newline at end of file
diff --git a/0752-open-the-lock/README.md b/0752-open-the-lock/README.md
new file mode 100644
index 00000000..36cb276f
--- /dev/null
+++ b/0752-open-the-lock/README.md
@@ -0,0 +1,44 @@
+Medium
You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example we can turn '9' to be '0', or '0' to be '9'. Each move consists of turning one wheel one slot.
+
+
The lock initially starts at '0000', a string representing the state of the 4 wheels.
+
+
You are given a list of deadends dead ends, meaning if the lock displays any of these codes, the wheels of the lock will stop turning and you will be unable to open it.
+
+
Given a target representing the value of the wheels that will unlock the lock, return the minimum total number of turns required to open the lock, or -1 if it is impossible.
+
+
+
Example 1:
+
+
Input: deadends = ["0201","0101","0102","1212","2002"], target = "0202"
+Output: 6
+Explanation:
+A sequence of valid moves would be "0000" -> "1000" -> "1100" -> "1200" -> "1201" -> "1202" -> "0202".
+Note that a sequence like "0000" -> "0001" -> "0002" -> "0102" -> "0202" would be invalid,
+because the wheels of the lock become stuck after the display becomes the dead end "0102".
+
+
+
Example 2:
+
+
Input: deadends = ["8888"], target = "0009"
+Output: 1
+Explanation: We can turn the last wheel in reverse to move from "0000" -> "0009".
+
+
+
Example 3:
+
+
Input: deadends = ["8887","8889","8878","8898","8788","8988","7888","9888"], target = "8888"
+Output: -1
+Explanation: We cannot reach the target without getting stuck.
+
+
+
+
Constraints:
+
+
+ 1 <= deadends.length <= 500
+ deadends[i].length == 4
+ target.length == 4
+ - target will not be in the list
deadends.
+ target and deadends[i] consist of digits only.
+
+
\ No newline at end of file
diff --git a/0786-k-th-smallest-prime-fraction/0786-k-th-smallest-prime-fraction.cpp b/0786-k-th-smallest-prime-fraction/0786-k-th-smallest-prime-fraction.cpp
new file mode 100644
index 00000000..7c02db31
--- /dev/null
+++ b/0786-k-th-smallest-prime-fraction/0786-k-th-smallest-prime-fraction.cpp
@@ -0,0 +1,24 @@
+class Solution {
+public:
+ vector kthSmallestPrimeFraction(vector& arr, int k) {
+
+ vector>> res;
+
+ int n = arr.size();
+
+ for(int i = 0; i < n; ++i)
+ {
+ for(int j = n-1; j >= 0; --j)
+ {
+ if(i != j)
+ {
+ res.push_back({((double)arr[i]/(double)arr[j]),{arr[i], arr[j]}});
+ }
+ }
+ }
+
+ sort(res.begin(), res.end());
+
+ return {res[k-1].second.first, res[k-1].second.second};
+ }
+};
\ No newline at end of file
diff --git a/0786-k-th-smallest-prime-fraction/NOTES.md b/0786-k-th-smallest-prime-fraction/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0786-k-th-smallest-prime-fraction/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0787-cheapest-flights-within-k-stops/NOTES.md b/0787-cheapest-flights-within-k-stops/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0787-cheapest-flights-within-k-stops/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0791-custom-sort-string/0791-custom-sort-string.cpp b/0791-custom-sort-string/0791-custom-sort-string.cpp
new file mode 100644
index 00000000..7124d4f8
--- /dev/null
+++ b/0791-custom-sort-string/0791-custom-sort-string.cpp
@@ -0,0 +1,20 @@
+class Solution {
+public:
+ string customSortString(string order, string s) {
+
+ map mp;
+
+ for(int i = 0; i < order.size(); ++i)
+ {
+ if(mp.find(order[i]) == mp.end())
+ mp[order[i]] = i;
+ }
+
+ sort(s.begin(), s.end(),[&](const auto& a, const auto& b){
+ return mp[a] < mp[b];
+ });
+
+ return s;
+
+ }
+};
\ No newline at end of file
diff --git a/0791-custom-sort-string/NOTES.md b/0791-custom-sort-string/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0791-custom-sort-string/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0791-custom-sort-string/README.md b/0791-custom-sort-string/README.md
new file mode 100644
index 00000000..df4199fe
--- /dev/null
+++ b/0791-custom-sort-string/README.md
@@ -0,0 +1,41 @@
+Medium
You are given two strings order and s. All the characters of order are unique and were sorted in some custom order previously.
+
+
Permute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs before a character y in order, then x should occur before y in the permuted string.
+
+
Return any permutation of s that satisfies this property.
+
+
+
Example 1:
+
+
+
Input: order = "cba", s = "abcd"
+
+
Output: "cbad"
+
+
Explanation: "a", "b", "c" appear in order, so the order of "a", "b", "c" should be "c", "b", and "a".
+
+
Since "d" does not appear in order, it can be at any position in the returned string. "dcba", "cdba", "cbda" are also valid outputs.
+
+
+
Example 2:
+
+
+
Input: order = "bcafg", s = "abcd"
+
+
Output: "bcad"
+
+
Explanation: The characters "b", "c", and "a" from order dictate the order for the characters in s. The character "d" in s does not appear in order, so its position is flexible.
+
+
Following the order of appearance in order, "b", "c", and "a" from s should be arranged as "b", "c", "a". "d" can be placed at any position since it's not in order. The output "bcad" correctly follows this rule. Other arrangements like "bacd" or "bcda" would also be valid, as long as "b", "c", "a" maintain their order.
+
+
+
+
Constraints:
+
+
+ 1 <= order.length <= 26
+ 1 <= s.length <= 200
+ order and s consist of lowercase English letters.
+ - All the characters of
order are unique.
+
+
\ No newline at end of file
diff --git a/0823-binary-trees-with-factors/0823-binary-trees-with-factors.cpp b/0823-binary-trees-with-factors/0823-binary-trees-with-factors.cpp
new file mode 100644
index 00000000..d2d96ba0
--- /dev/null
+++ b/0823-binary-trees-with-factors/0823-binary-trees-with-factors.cpp
@@ -0,0 +1,39 @@
+class Solution {
+public:
+
+ const int mod = 1e9+7;
+
+ int numFactoredBinaryTrees(vector& arr) {
+
+ int n = arr.size();
+
+ unordered_map mp;
+
+ for(auto& itr : arr)
+ ++mp[itr];
+
+ sort(arr.begin(), arr.end());
+
+ int ans = 0;
+
+ for(int i = 1; i < n; ++i)
+ {
+ for(int j = 0; j < i; ++j)
+ {
+ if(arr[i] % arr[j] == 0)
+ {
+ long long count = (mp[arr[j]] * 1LL * mp[arr[i]/arr[j]]) % mod;
+ mp[arr[i]] = (mp[arr[i]] % mod + count)% mod;
+ }
+ }
+ }
+
+ for(auto& itr : mp)
+ {
+ ans = (ans + itr.second) % mod;
+ }
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0823-binary-trees-with-factors/NOTES.md b/0823-binary-trees-with-factors/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0823-binary-trees-with-factors/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0823-binary-trees-with-factors/README.md b/0823-binary-trees-with-factors/README.md
new file mode 100644
index 00000000..af1c0af6
--- /dev/null
+++ b/0823-binary-trees-with-factors/README.md
@@ -0,0 +1,28 @@
+Medium
Given an array of unique integers, arr, where each integer arr[i] is strictly greater than 1.
+
+
We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children.
+
+
Return the number of binary trees we can make. The answer may be too large so return the answer modulo 109 + 7.
+
+
+
Example 1:
+
+
Input: arr = [2,4]
+Output: 3
+Explanation: We can make these trees: [2], [4], [4, 2, 2]
+
+
Example 2:
+
+
Input: arr = [2,4,5,10]
+Output: 7
+Explanation: We can make these trees: [2], [4], [5], [10], [4, 2, 2], [10, 2, 5], [10, 5, 2].
+
+
+
Constraints:
+
+
+ 1 <= arr.length <= 1000
+ 2 <= arr[i] <= 109
+ - All the values of
arr are unique.
+
+
\ No newline at end of file
diff --git a/0827-making-a-large-island/0827-making-a-large-island.cpp b/0827-making-a-large-island/0827-making-a-large-island.cpp
new file mode 100644
index 00000000..79b5e3d4
--- /dev/null
+++ b/0827-making-a-large-island/0827-making-a-large-island.cpp
@@ -0,0 +1,145 @@
+class Solution {
+public:
+
+ class DSU{
+ public:
+ vector parent, size, rank;
+ public:
+ DSU(int n)
+ {
+ parent.resize(n+1);
+ size.resize(n+1, 1);
+ rank.resize(n+1, 0);
+
+ for(int i = 0; i <= n; ++i)
+ parent[i] = i;
+ }
+
+ int findParent(int u)
+ {
+ if(u == parent[u])
+ return u;
+ return parent[u] = findParent(parent[u]);
+ }
+
+ void unionByRank(int u, int v)
+ {
+ int parU = findParent(u);
+ int parV = findParent(v);
+
+ if(parU == parV)
+ return;
+
+ if(rank[parU] < rank[parV])
+ parent[parU] = parV;
+ else if(rank[parV] > rank[parU])
+ parent[parV] = parU;
+ else
+ {
+ parent[parV] = parU;
+ ++rank[parU];
+ }
+ }
+
+ void unionBySize(int u, int v)
+ {
+ int parU = findParent(u);
+ int parV = findParent(v);
+
+ if(parU == parV)
+ return;
+
+ if(size[parU] < size[parV])
+ {
+ parent[parU] = parV;
+ size[parV] += size[parU];
+ }
+ else
+ {
+ parent[parV] = parU;
+ size[parU] += size[parV];
+ }
+ }
+
+ bool isSame(int u, int v)
+ {
+ return findParent(u) == findParent(v);
+ }
+ };
+
+ int largestIsland(vector>& grid) {
+
+ int n = grid.size();
+ int m = grid[0].size();
+
+ DSU dsu((n*m) + 1);
+
+ vector dx = {-1, 0, +1, 0};
+ vector dy = {0, -1, 0, +1};
+
+ auto isValid = [&](int x, int y)
+ {
+ return (x >= 0 and y >= 0 and x < n and y < m);
+ };
+
+ for(int i = 0; i < n; ++i)
+ {
+ for(int j = 0; j < n; ++j)
+ {
+ if(grid[i][j] == 0)
+ continue;
+
+ for(int k = 0; k < 4; ++k)
+ {
+ int newx = dx[k] + i;
+ int newy = dy[k] + j;
+
+ if(isValid(newx, newy) and grid[newx][newy])
+ {
+ int node = (i * m) + j;
+ int adjNode = (newx * m) + newy;
+
+ if(!dsu.isSame(node, adjNode))
+ dsu.unionBySize(node, adjNode);
+ }
+ }
+ }
+ }
+
+ int maxi = -1;
+
+ unordered_set visited;
+
+ for(int i = 0; i < n; ++i)
+ {
+ for(int j = 0; j < n; ++j)
+ {
+ if(grid[i][j] == 0)
+ {
+ for(int k = 0; k < 4; ++k)
+ {
+ int newx = dx[k] + i;
+ int newy = dy[k] + j;
+
+ if(isValid(newx, newy) and grid[newx][newy])
+ {
+ visited.insert(dsu.findParent((newx*m) + newy));
+ }
+ }
+
+ int curr = 0;
+
+ for(auto& ele : visited)
+ curr += dsu.size[ele];
+
+ visited.clear();
+
+ maxi = max(maxi, curr + 1);
+ }
+ }
+ }
+
+
+ return (maxi == -1 ? (n * m) : maxi);
+ }
+};
\ No newline at end of file
diff --git a/0827-making-a-large-island/NOTES.md b/0827-making-a-large-island/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0827-making-a-large-island/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0827-making-a-large-island/README.md b/0827-making-a-large-island/README.md
new file mode 100644
index 00000000..930714d9
--- /dev/null
+++ b/0827-making-a-large-island/README.md
@@ -0,0 +1,36 @@
+Hard
You are given an n x n binary matrix grid. You are allowed to change at most one 0 to be 1.
+
+
Return the size of the largest island in grid after applying this operation.
+
+
An island is a 4-directionally connected group of 1s.
+
+
+
Example 1:
+
+
Input: grid = [[1,0],[0,1]]
+Output: 3
+Explanation: Change one 0 to 1 and connect two 1s, then we get an island with area = 3.
+
+
+
Example 2:
+
+
Input: grid = [[1,1],[1,0]]
+Output: 4
+Explanation: Change the 0 to 1 and make the island bigger, only one island with area = 4.
+
+
Example 3:
+
+
Input: grid = [[1,1],[1,1]]
+Output: 4
+Explanation: Can't change any 0 to 1, only one island with area = 4.
+
+
+
+
Constraints:
+
+
+ n == grid.length
+ n == grid[i].length
+ 1 <= n <= 500
+ grid[i][j] is either 0 or 1.
+
\ No newline at end of file
diff --git a/0834-sum-of-distances-in-tree/NOTES.md b/0834-sum-of-distances-in-tree/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0834-sum-of-distances-in-tree/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0840-magic-squares-in-grid/0840-magic-squares-in-grid.cpp b/0840-magic-squares-in-grid/0840-magic-squares-in-grid.cpp
new file mode 100644
index 00000000..3cfd5c6a
--- /dev/null
+++ b/0840-magic-squares-in-grid/0840-magic-squares-in-grid.cpp
@@ -0,0 +1,81 @@
+class Solution {
+public:
+
+ int checkMatrix(vector>& mat)
+ {
+
+ int diagSumA = 0, diagSumB = 0, end = 2;
+ map mp;
+ vector freq(10, 0);
+
+ for(int i = 0; i < mat.size(); ++i)
+ {
+ int sum = 0;
+ for(int j = 0; j < mat[0].size(); ++j)
+ {
+ if(mat[i][j] >= 0 and mat[i][j] <= 9)
+ ++freq[mat[i][j]];
+ sum += mat[i][j];
+ if(i == j)
+ diagSumA += mat[i][j];
+ if(j == end)
+ {
+ diagSumB += mat[i][j];
+ --end;
+ }
+ }
+ ++mp[sum];
+ }
+
+ for(int j = 0; j < mat[0].size(); ++j)
+ {
+ int sum = 0;
+ for(int i = 0; i < mat.size(); ++i)
+ sum += mat[i][j];
+ ++mp[sum];
+ }
+
+ for(int i = 1; i <= 9; ++i)
+ {
+ if(freq[i] == 0)
+ return 0;
+ }
+
+ ++mp[diagSumA];
+ ++mp[diagSumB];
+
+ return mp.size() == 1;
+ }
+
+ int numMagicSquaresInside(vector>& grid) {
+
+ int n = grid.size();
+ int m = grid[0].size();
+
+ int ans = 0;
+
+ for(int i = 0; i < n; ++i)
+ {
+ for(int j = 0; j < m; ++j)
+ {
+ vector> mat;
+
+ if(i + 3 > n or j + 3 > m)
+ break;
+ for(int k = i; k < i + 3; ++k)
+ {
+ vector row;
+ for(int l = j; l < j + 3; ++l)
+ row.push_back(grid[k][l]);
+ mat.push_back(row);
+ }
+
+ if(checkMatrix(mat))
+ ++ans;
+ }
+ }
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0840-magic-squares-in-grid/NOTES.md b/0840-magic-squares-in-grid/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0840-magic-squares-in-grid/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0840-magic-squares-in-grid/README.md b/0840-magic-squares-in-grid/README.md
new file mode 100644
index 00000000..06ddc8d2
--- /dev/null
+++ b/0840-magic-squares-in-grid/README.md
@@ -0,0 +1,35 @@
+Medium
A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diagonals all have the same sum.
+
+
Given a row x col grid of integers, how many 3 x 3 contiguous magic square subgrids are there?
+
+
Note: while a magic square can only contain numbers from 1 to 9, grid may contain numbers up to 15.
+
+
+
Example 1:
+

+
Input: grid = [[4,3,8,4],[9,5,1,9],[2,7,6,2]]
+Output: 1
+Explanation:
+The following subgrid is a 3 x 3 magic square:
+
+while this one is not:
+
+In total, there is only one magic square inside the given grid.
+
+
+
Example 2:
+
+
Input: grid = [[8]]
+Output: 0
+
+
+
+
Constraints:
+
+
+ row == grid.length
+ col == grid[i].length
+ 1 <= row, col <= 10
+ 0 <= grid[i][j] <= 15
+
+
\ No newline at end of file
diff --git a/0844-backspace-string-compare/0844-backspace-string-compare.cpp b/0844-backspace-string-compare/0844-backspace-string-compare.cpp
new file mode 100644
index 00000000..0e7ac67b
--- /dev/null
+++ b/0844-backspace-string-compare/0844-backspace-string-compare.cpp
@@ -0,0 +1,32 @@
+class Solution {
+public:
+ bool backspaceCompare(string s, string t) {
+
+ string one, two;
+
+ for(auto& itr : s)
+ {
+ if(itr == '#')
+ {
+ if(!one.empty())
+ one.pop_back();
+ }
+ else
+ one.push_back(itr);
+ }
+
+ for(auto& itr : t)
+ {
+ if(itr == '#')
+ {
+ if(!two.empty())
+ two.pop_back();
+ }
+ else
+ two.push_back(itr);
+ }
+
+ return one == two;
+
+ }
+};
\ No newline at end of file
diff --git a/0844-backspace-string-compare/NOTES.md b/0844-backspace-string-compare/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0844-backspace-string-compare/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0846-hand-of-straights/0846-hand-of-straights.cpp b/0846-hand-of-straights/0846-hand-of-straights.cpp
new file mode 100644
index 00000000..a0c9450b
--- /dev/null
+++ b/0846-hand-of-straights/0846-hand-of-straights.cpp
@@ -0,0 +1,51 @@
+class Solution {
+public:
+ bool isNStraightHand(vector& hand, int groupSize) {
+
+ int n = hand.size();
+
+ if(n % groupSize != 0)
+ return false;
+
+ int step = n / groupSize;
+
+ map mp;
+
+ for(auto& ele : hand)
+ ++mp[ele];
+
+ while(step--)
+ {
+ int k = 0, prev = -1;
+
+ if(mp.size() < groupSize)
+ return false;
+
+ for(auto& ele : mp)
+ {
+ ++k;
+
+ if(prev == -1)
+ prev = ele.first;
+ else
+ {
+ if(prev + 1 != ele.first)
+ return false;
+ }
+
+ prev = ele.first;
+
+ --ele.second;
+
+ if(ele.second == 0)
+ mp.erase(ele.first); // remove
+
+ if(k == groupSize)
+ break;
+ }
+ }
+
+ return true;
+
+ }
+};
\ No newline at end of file
diff --git a/0846-hand-of-straights/NOTES.md b/0846-hand-of-straights/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0846-hand-of-straights/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0846-hand-of-straights/README.md b/0846-hand-of-straights/README.md
new file mode 100644
index 00000000..fe6ec095
--- /dev/null
+++ b/0846-hand-of-straights/README.md
@@ -0,0 +1,32 @@
+Medium
Alice has some number of cards and she wants to rearrange the cards into groups so that each group is of size groupSize, and consists of groupSize consecutive cards.
+
+
Given an integer array hand where hand[i] is the value written on the ith card and an integer groupSize, return true if she can rearrange the cards, or false otherwise.
+
+
+
Example 1:
+
+
Input: hand = [1,2,3,6,2,3,4,7,8], groupSize = 3
+Output: true
+Explanation: Alice's hand can be rearranged as [1,2,3],[2,3,4],[6,7,8]
+
+
+
Example 2:
+
+
Input: hand = [1,2,3,4,5], groupSize = 4
+Output: false
+Explanation: Alice's hand can not be rearranged into groups of 4.
+
+
+
+
+
Constraints:
+
+
+ 1 <= hand.length <= 104
+ 0 <= hand[i] <= 109
+ 1 <= groupSize <= hand.length
+
+
+
+
Note: This question is the same as 1296: https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers/
+
\ No newline at end of file
diff --git a/0857-minimum-cost-to-hire-k-workers/0857-minimum-cost-to-hire-k-workers.cpp b/0857-minimum-cost-to-hire-k-workers/0857-minimum-cost-to-hire-k-workers.cpp
new file mode 100644
index 00000000..38566929
--- /dev/null
+++ b/0857-minimum-cost-to-hire-k-workers/0857-minimum-cost-to-hire-k-workers.cpp
@@ -0,0 +1,37 @@
+class Solution {
+public:
+ double mincostToHireWorkers(vector& quality, vector& wage, int k) {
+ vector> v;
+ int n=quality.size();
+ for(int i=0;i pq;
+
+ double ans=DBL_MAX;
+ int q=0;
+ for(int i=0;iv[i].second){
+ q -= pq.top();
+ pq.pop();
+
+ pq.push(v[i].second);
+ q += v[i].second;
+ }
+ }
+ if(pq.size()==k){
+ double cost = q*v[i].first;
+ if(ans > cost) ans=cost;
+ }
+ }
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0857-minimum-cost-to-hire-k-workers/NOTES.md b/0857-minimum-cost-to-hire-k-workers/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0857-minimum-cost-to-hire-k-workers/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0857-minimum-cost-to-hire-k-workers/README.md b/0857-minimum-cost-to-hire-k-workers/README.md
new file mode 100644
index 00000000..d251e14b
--- /dev/null
+++ b/0857-minimum-cost-to-hire-k-workers/README.md
@@ -0,0 +1,35 @@
+Hard
There are n workers. You are given two integer arrays quality and wage where quality[i] is the quality of the ith worker and wage[i] is the minimum wage expectation for the ith worker.
+
+
We want to hire exactly k workers to form a paid group. To hire a group of k workers, we must pay them according to the following rules:
+
+
+ - Every worker in the paid group must be paid at least their minimum wage expectation.
+ - In the group, each worker's pay must be directly proportional to their quality. This means if a worker’s quality is double that of another worker in the group, then they must be paid twice as much as the other worker.
+
+
+
Given the integer k, return the least amount of money needed to form a paid group satisfying the above conditions. Answers within 10-5 of the actual answer will be accepted.
+
+
+
Example 1:
+
+
Input: quality = [10,20,5], wage = [70,50,30], k = 2
+Output: 105.00000
+Explanation: We pay 70 to 0th worker and 35 to 2nd worker.
+
+
+
Example 2:
+
+
Input: quality = [3,1,10,10,1], wage = [4,8,2,2,7], k = 3
+Output: 30.66667
+Explanation: We pay 4 to 0th worker, 13.33333 to 2nd and 3rd workers separately.
+
+
+
+
Constraints:
+
+
+ n == quality.length == wage.length
+ 1 <= k <= n <= 104
+ 1 <= quality[i], wage[i] <= 104
+
+
\ No newline at end of file
diff --git a/0860-lemonade-change/0860-lemonade-change.cpp b/0860-lemonade-change/0860-lemonade-change.cpp
new file mode 100644
index 00000000..630ace19
--- /dev/null
+++ b/0860-lemonade-change/0860-lemonade-change.cpp
@@ -0,0 +1,35 @@
+class Solution {
+public:
+ bool lemonadeChange(vector& bills) {
+
+ map mp;
+
+ for(auto& ele : bills)
+ {
+ int rem = ele - 5;
+
+ if(rem)
+ {
+ while(mp[10] and rem >= 10)
+ {
+ --mp[10];
+ rem -= 10;
+ }
+
+ while(mp[5] and rem)
+ {
+ --mp[5];
+ rem -= 5;
+ }
+ }
+
+ if(rem > 0)
+ return false;
+
+ ++mp[ele];
+ }
+
+ return true;
+
+ }
+};
\ No newline at end of file
diff --git a/0860-lemonade-change/NOTES.md b/0860-lemonade-change/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0860-lemonade-change/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0860-lemonade-change/README.md b/0860-lemonade-change/README.md
new file mode 100644
index 00000000..d3a40735
--- /dev/null
+++ b/0860-lemonade-change/README.md
@@ -0,0 +1,37 @@
+Easy
At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must provide the correct change to each customer so that the net transaction is that the customer pays $5.
+
+
Note that you do not have any change in hand at first.
+
+
Given an integer array bills where bills[i] is the bill the ith customer pays, return true if you can provide every customer with the correct change, or false otherwise.
+
+
+
Example 1:
+
+
Input: bills = [5,5,5,10,20]
+Output: true
+Explanation:
+From the first 3 customers, we collect three $5 bills in order.
+From the fourth customer, we collect a $10 bill and give back a $5.
+From the fifth customer, we give a $10 bill and a $5 bill.
+Since all customers got correct change, we output true.
+
+
+
Example 2:
+
+
Input: bills = [5,5,10,10,20]
+Output: false
+Explanation:
+From the first two customers in order, we collect two $5 bills.
+For the next two customers in order, we collect a $10 bill and give back a $5 bill.
+For the last customer, we can not give the change of $15 back because we only have two $10 bills.
+Since not every customer received the correct change, the answer is false.
+
+
+
+
Constraints:
+
+
+ 1 <= bills.length <= 105
+ bills[i] is either 5, 10, or 20.
+
+
\ No newline at end of file
diff --git a/0867-transpose-matrix/0867-transpose-matrix.cpp b/0867-transpose-matrix/0867-transpose-matrix.cpp
new file mode 100644
index 00000000..b24a5239
--- /dev/null
+++ b/0867-transpose-matrix/0867-transpose-matrix.cpp
@@ -0,0 +1,20 @@
+class Solution {
+public:
+ vector> transpose(vector>& matrix) {
+
+ vector> ans;
+
+ int n = matrix[0].size(), m = matrix.size();
+
+ for(int i = 0; i < n; ++i)
+ {
+ vector curr;
+ for(int j = 0; j < m; ++j)
+ {
+ curr.push_back(matrix[j][i]);
+ }
+ ans.push_back(curr);
+ }
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0867-transpose-matrix/NOTES.md b/0867-transpose-matrix/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0867-transpose-matrix/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0867-transpose-matrix/README.md b/0867-transpose-matrix/README.md
new file mode 100644
index 00000000..8eaf9eef
--- /dev/null
+++ b/0867-transpose-matrix/README.md
@@ -0,0 +1,30 @@
+Easy
Given a 2D integer array matrix, return the transpose of matrix.
+
+
The transpose of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices.
+
+

+
+
+
Example 1:
+
+
Input: matrix = [[1,2,3],[4,5,6],[7,8,9]]
+Output: [[1,4,7],[2,5,8],[3,6,9]]
+
+
+
Example 2:
+
+
Input: matrix = [[1,2,3],[4,5,6]]
+Output: [[1,4],[2,5],[3,6]]
+
+
+
+
Constraints:
+
+
+ m == matrix.length
+ n == matrix[i].length
+ 1 <= m, n <= 1000
+ 1 <= m * n <= 105
+ -109 <= matrix[i][j] <= 109
+
+
\ No newline at end of file
diff --git a/0872-leaf-similar-trees/README.md b/0872-leaf-similar-trees/README.md
new file mode 100644
index 00000000..71da5fe7
--- /dev/null
+++ b/0872-leaf-similar-trees/README.md
@@ -0,0 +1,31 @@
+Easy
Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence.
+
+

+
+
For example, in the given tree above, the leaf value sequence is (6, 7, 4, 9, 8).
+
+
Two binary trees are considered leaf-similar if their leaf value sequence is the same.
+
+
Return true if and only if the two given trees with head nodes root1 and root2 are leaf-similar.
+
+
+
Example 1:
+

+
Input: root1 = [3,5,1,6,2,9,8,null,null,7,4], root2 = [3,5,1,6,7,4,2,null,null,null,null,null,null,9,8]
+Output: true
+
+
+
Example 2:
+

+
Input: root1 = [1,2,3], root2 = [1,3,2]
+Output: false
+
+
+
+
Constraints:
+
+
+ - The number of nodes in each tree will be in the range
[1, 200].
+ - Both of the given trees will have values in the range
[0, 200].
+
+
\ No newline at end of file
diff --git a/0876-middle-of-the-linked-list/0876-middle-of-the-linked-list.cpp b/0876-middle-of-the-linked-list/0876-middle-of-the-linked-list.cpp
new file mode 100644
index 00000000..71c8ab29
--- /dev/null
+++ b/0876-middle-of-the-linked-list/0876-middle-of-the-linked-list.cpp
@@ -0,0 +1,25 @@
+/**
+ * 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* middleNode(ListNode* head) {
+
+ ListNode* fast = head, *slow = head;
+
+ while(fast and fast->next)
+ {
+ slow = slow->next;
+ fast = fast->next->next;
+ }
+
+ return slow;
+ }
+};
\ No newline at end of file
diff --git a/0876-middle-of-the-linked-list/README.md b/0876-middle-of-the-linked-list/README.md
new file mode 100644
index 00000000..bb08722c
--- /dev/null
+++ b/0876-middle-of-the-linked-list/README.md
@@ -0,0 +1,27 @@
+Easy
Given the head of a singly linked list, return the middle node of the linked list.
+
+
If there are two middle nodes, return the second middle node.
+
+
+
Example 1:
+

+
Input: head = [1,2,3,4,5]
+Output: [3,4,5]
+Explanation: The middle node of the list is node 3.
+
+
+
Example 2:
+

+
Input: head = [1,2,3,4,5,6]
+Output: [4,5,6]
+Explanation: Since the list has two middle nodes with values 3 and 4, we return the second one.
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the list is in the range
[1, 100].
+ 1 <= Node.val <= 100
+
+
\ No newline at end of file
diff --git a/0880-decoded-string-at-index/0880-decoded-string-at-index.cpp b/0880-decoded-string-at-index/0880-decoded-string-at-index.cpp
new file mode 100644
index 00000000..09875315
--- /dev/null
+++ b/0880-decoded-string-at-index/0880-decoded-string-at-index.cpp
@@ -0,0 +1,30 @@
+class Solution {
+public:
+ string decodeAtIndex(string s, int k) {
+
+ int n = s.size();
+
+ long long totalLength = 0;
+
+ for(int i = 0; i < n; ++i)
+ {
+ if(isalpha(s[i]))
+ ++totalLength;
+ else
+ totalLength = totalLength * (s[i] - '0');
+ }
+
+ for(int i = n-1; i >= 0; --i)
+ {
+ k = k % totalLength;
+ if(k == 0 and isalpha(s[i]))
+ return string(1, s[i]);
+ if(isalpha(s[i]))
+ totalLength -= 1;
+ else
+ totalLength /= (s[i] - '0');
+ }
+
+ return "";
+ }
+};
\ No newline at end of file
diff --git a/0880-decoded-string-at-index/README.md b/0880-decoded-string-at-index/README.md
new file mode 100644
index 00000000..2831eaa7
--- /dev/null
+++ b/0880-decoded-string-at-index/README.md
@@ -0,0 +1,46 @@
+Medium
You are given an encoded string s. To decode the string to a tape, the encoded string is read one character at a time and the following steps are taken:
+
+
+ - If the character read is a letter, that letter is written onto the tape.
+ - If the character read is a digit
d, the entire current tape is repeatedly written d - 1 more times in total.
+
+
+
Given an integer k, return the kth letter (1-indexed) in the decoded string.
+
+
+
Example 1:
+
+
Input: s = "leet2code3", k = 10
+Output: "o"
+Explanation: The decoded string is "leetleetcodeleetleetcodeleetleetcode".
+The 10th letter in the string is "o".
+
+
+
Example 2:
+
+
Input: s = "ha22", k = 5
+Output: "h"
+Explanation: The decoded string is "hahahaha".
+The 5th letter is "h".
+
+
+
Example 3:
+
+
Input: s = "a2345678999999999999999", k = 1
+Output: "a"
+Explanation: The decoded string is "a" repeated 8301530446056247680 times.
+The 1st letter is "a".
+
+
+
+
Constraints:
+
+
+ 2 <= s.length <= 100
+ s consists of lowercase English letters and digits 2 through 9.
+ s starts with a letter.
+ 1 <= k <= 109
+ - It is guaranteed that
k is less than or equal to the length of the decoded string.
+ - The decoded string is guaranteed to have less than
263 letters.
+
+
\ No newline at end of file
diff --git a/0881-boats-to-save-people/0881-boats-to-save-people.cpp b/0881-boats-to-save-people/0881-boats-to-save-people.cpp
new file mode 100644
index 00000000..9bdda773
--- /dev/null
+++ b/0881-boats-to-save-people/0881-boats-to-save-people.cpp
@@ -0,0 +1,25 @@
+class Solution {
+public:
+ int numRescueBoats(vector& people, int limit) {
+
+ int cnt = 0;
+
+ sort(people.begin(),people.end());
+
+ int n = people.size();
+ int start = 0, end = n-1;
+
+ while(start <= end)
+ {
+ if(people[start] + people[end] <= limit)
+ {
+ ++start, --end;
+ }
+ else
+ --end;
+ ++cnt;
+ }
+
+ return cnt;
+ }
+};
\ No newline at end of file
diff --git a/0881-boats-to-save-people/NOTES.md b/0881-boats-to-save-people/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0881-boats-to-save-people/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0885-spiral-matrix-iii/0885-spiral-matrix-iii.cpp b/0885-spiral-matrix-iii/0885-spiral-matrix-iii.cpp
new file mode 100644
index 00000000..78e13cb1
--- /dev/null
+++ b/0885-spiral-matrix-iii/0885-spiral-matrix-iii.cpp
@@ -0,0 +1,50 @@
+class Solution {
+public:
+ vector> spiralMatrixIII(int rows, int cols, int rStart, int cStart) {
+
+ vector> res;
+ int step = 1, ctr = 0;
+
+ auto isValid = [&]()
+ {
+ return (rStart >= 0 and rStart < rows and cStart >= 0 and cStart < cols);
+ };
+
+ while(ctr < rows * cols)
+ {
+ for(int i = 0; i < step; ++i)
+ {
+ if(isValid())
+ res.push_back({rStart, cStart}), ++ctr;
+ ++cStart;
+ }
+
+ for(int i = 0; i < step; ++i)
+ {
+ if(isValid())
+ res.push_back({rStart, cStart}), ++ctr;
+ ++rStart;
+ }
+
+ ++step;
+
+ for(int i = 0; i < step; ++i)
+ {
+ if(isValid())
+ res.push_back({rStart, cStart}), ++ctr;
+ --cStart;
+ }
+
+ for(int i = 0; i < step; ++i)
+ {
+ if(isValid())
+ res.push_back({rStart, cStart}), ++ctr;
+ --rStart;
+ }
+
+ ++step;
+ }
+
+ return res;
+ }
+};
\ No newline at end of file
diff --git a/0885-spiral-matrix-iii/README.md b/0885-spiral-matrix-iii/README.md
new file mode 100644
index 00000000..721d4ed3
--- /dev/null
+++ b/0885-spiral-matrix-iii/README.md
@@ -0,0 +1,28 @@
+Medium
You start at the cell (rStart, cStart) of an rows x cols grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column.
+
+
You will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's boundary, we continue our walk outside the grid (but may return to the grid boundary later.). Eventually, we reach all rows * cols spaces of the grid.
+
+
Return an array of coordinates representing the positions of the grid in the order you visited them.
+
+
+
Example 1:
+

+
Input: rows = 1, cols = 4, rStart = 0, cStart = 0
+Output: [[0,0],[0,1],[0,2],[0,3]]
+
+
+
Example 2:
+

+
Input: rows = 5, cols = 6, rStart = 1, cStart = 4
+Output: [[1,4],[1,5],[2,5],[2,4],[2,3],[1,3],[0,3],[0,4],[0,5],[3,5],[3,4],[3,3],[3,2],[2,2],[1,2],[0,2],[4,5],[4,4],[4,3],[4,2],[4,1],[3,1],[2,1],[1,1],[0,1],[4,0],[3,0],[2,0],[1,0],[0,0]]
+
+
+
+
Constraints:
+
+
+ 1 <= rows, cols <= 100
+ 0 <= rStart < rows
+ 0 <= cStart < cols
+
+
\ No newline at end of file
diff --git a/0912-sort-an-array/README.md b/0912-sort-an-array/README.md
new file mode 100644
index 00000000..9b50c617
--- /dev/null
+++ b/0912-sort-an-array/README.md
@@ -0,0 +1,27 @@
+Medium
Given an array of integers nums, sort the array in ascending order and return it.
+
+
You must solve the problem without using any built-in functions in O(nlog(n)) time complexity and with the smallest space complexity possible.
+
+
+
Example 1:
+
+
Input: nums = [5,2,3,1]
+Output: [1,2,3,5]
+Explanation: After sorting the array, the positions of some numbers are not changed (for example, 2 and 3), while the positions of other numbers are changed (for example, 1 and 5).
+
+
+
Example 2:
+
+
Input: nums = [5,1,1,2,0,0]
+Output: [0,0,1,1,2,5]
+Explanation: Note that the values of nums are not necessairly unique.
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 5 * 104
+ -5 * 104 <= nums[i] <= 5 * 104
+
+
\ No newline at end of file
diff --git a/0930-binary-subarrays-with-sum/0930-binary-subarrays-with-sum.cpp b/0930-binary-subarrays-with-sum/0930-binary-subarrays-with-sum.cpp
new file mode 100644
index 00000000..d9a7b100
--- /dev/null
+++ b/0930-binary-subarrays-with-sum/0930-binary-subarrays-with-sum.cpp
@@ -0,0 +1,25 @@
+class Solution {
+public:
+ int numSubarraysWithSum(vector& nums, int goal) {
+
+ int ans = 0, n = nums.size();
+
+ map mp;
+ mp.insert({0, 1});
+
+ int sum = 0;
+
+ for(int j = 0; j < n; ++j)
+ {
+ sum += nums[j];
+ if(mp.find(sum - goal) != mp.end())
+ {
+ ans += mp[sum - goal];
+ }
+
+ ++mp[sum];
+ }
+
+ return ans;
+ }
+};
diff --git a/0930-binary-subarrays-with-sum/NOTES.md b/0930-binary-subarrays-with-sum/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0930-binary-subarrays-with-sum/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0930-binary-subarrays-with-sum/README.md b/0930-binary-subarrays-with-sum/README.md
new file mode 100644
index 00000000..63710621
--- /dev/null
+++ b/0930-binary-subarrays-with-sum/README.md
@@ -0,0 +1,30 @@
+Medium
Given a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal.
+
+
A subarray is a contiguous part of the array.
+
+
+
Example 1:
+
+
Input: nums = [1,0,1,0,1], goal = 2
+Output: 4
+Explanation: The 4 subarrays are bolded and underlined below:
+[1,0,1,0,1]
+[1,0,1,0,1]
+[1,0,1,0,1]
+[1,0,1,0,1]
+
+
+
Example 2:
+
+
Input: nums = [0,0,0,0,0], goal = 0
+Output: 15
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 3 * 104
+ nums[i] is either 0 or 1.
+ 0 <= goal <= nums.length
+
\ No newline at end of file
diff --git a/0931-minimum-falling-path-sum/0931-minimum-falling-path-sum.cpp b/0931-minimum-falling-path-sum/0931-minimum-falling-path-sum.cpp
new file mode 100644
index 00000000..f480dd49
--- /dev/null
+++ b/0931-minimum-falling-path-sum/0931-minimum-falling-path-sum.cpp
@@ -0,0 +1,21 @@
+class Solution {
+public:
+ int minFallingPathSum(vector>& A) {
+ int m = A.size();
+ vector> t(m, vector(m));
+
+ for(int col = 0; col931. Minimum Falling Path SumMedium
Given an n x n array of integers matrix, return the minimum sum of any falling path through matrix.
+
+
A falling path starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element from position (row, col) will be (row + 1, col - 1), (row + 1, col), or (row + 1, col + 1).
+
+
+
Example 1:
+

+
Input: matrix = [[2,1,3],[6,5,4],[7,8,9]]
+Output: 13
+Explanation: There are two falling paths with a minimum sum as shown.
+
+
+
Example 2:
+

+
Input: matrix = [[-19,57],[-40,-5]]
+Output: -59
+Explanation: The falling path with a minimum sum is shown.
+
+
+
+
Constraints:
+
+
+ n == matrix.length == matrix[i].length
+ 1 <= n <= 100
+ -100 <= matrix[i][j] <= 100
+
+
\ No newline at end of file
diff --git a/0938-range-sum-of-bst/0938-range-sum-of-bst.cpp b/0938-range-sum-of-bst/0938-range-sum-of-bst.cpp
new file mode 100644
index 00000000..235bfc29
--- /dev/null
+++ b/0938-range-sum-of-bst/0938-range-sum-of-bst.cpp
@@ -0,0 +1,27 @@
+/**
+ * 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 low, int high) {
+
+ if(!root)
+ return 0;
+
+ if(root->val < low)
+ return rangeSumBST(root->right, low, high);
+
+ if(root->val > high)
+ return rangeSumBST(root->left, low, high);
+
+ return root->val + rangeSumBST(root->left, low, high) + rangeSumBST(root->right, low, high);
+ }
+};
\ No newline at end of file
diff --git a/0938-range-sum-of-bst/NOTES.md b/0938-range-sum-of-bst/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0938-range-sum-of-bst/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0938-range-sum-of-bst/README.md b/0938-range-sum-of-bst/README.md
new file mode 100644
index 00000000..25f2c7e6
--- /dev/null
+++ b/0938-range-sum-of-bst/README.md
@@ -0,0 +1,27 @@
+Easy
Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [low, high].
+
+
+
Example 1:
+

+
Input: root = [10,5,15,3,7,null,18], low = 7, high = 15
+Output: 32
+Explanation: Nodes 7, 10, and 15 are in the range [7, 15]. 7 + 10 + 15 = 32.
+
+
+
Example 2:
+

+
Input: root = [10,5,15,3,7,13,18,1,null,6], low = 6, high = 10
+Output: 23
+Explanation: Nodes 6, 7, and 10 are in the range [6, 10]. 6 + 7 + 10 = 23.
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 2 * 104].
+ 1 <= Node.val <= 105
+ 1 <= low <= high <= 105
+ - All
Node.val are unique.
+
+
\ No newline at end of file
diff --git a/0945-minimum-increment-to-make-array-unique/0945-minimum-increment-to-make-array-unique.cpp b/0945-minimum-increment-to-make-array-unique/0945-minimum-increment-to-make-array-unique.cpp
new file mode 100644
index 00000000..c46746a6
--- /dev/null
+++ b/0945-minimum-increment-to-make-array-unique/0945-minimum-increment-to-make-array-unique.cpp
@@ -0,0 +1,23 @@
+class Solution {
+public:
+ int minIncrementForUnique(vector& nums) {
+
+ int n = nums.size();
+
+ sort(nums.begin(), nums.end());
+
+ int ans = 0;
+
+ for(int i = 1; i < n; ++i)
+ {
+ if(nums[i-1] >= nums[i])
+ {
+ ans += (nums[i-1] - nums[i] + 1);
+ nums[i] = nums[i-1] + 1;
+ }
+ }
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0945-minimum-increment-to-make-array-unique/NOTES.md b/0945-minimum-increment-to-make-array-unique/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0945-minimum-increment-to-make-array-unique/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0945-minimum-increment-to-make-array-unique/README.md b/0945-minimum-increment-to-make-array-unique/README.md
new file mode 100644
index 00000000..b81b99e4
--- /dev/null
+++ b/0945-minimum-increment-to-make-array-unique/README.md
@@ -0,0 +1,30 @@
+Medium
You are given an integer array nums. In one move, you can pick an index i where 0 <= i < nums.length and increment nums[i] by 1.
+
+
Return the minimum number of moves to make every value in nums unique.
+
+
The test cases are generated so that the answer fits in a 32-bit integer.
+
+
+
Example 1:
+
+
Input: nums = [1,2,2]
+Output: 1
+Explanation: After 1 move, the array could be [1, 2, 3].
+
+
+
Example 2:
+
+
Input: nums = [3,2,1,2,1,7]
+Output: 6
+Explanation: After 6 moves, the array could be [3, 4, 1, 2, 5, 7].
+It can be shown with 5 or less moves that it is impossible for the array to have all unique values.
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 105
+ 0 <= nums[i] <= 105
+
+
\ No newline at end of file
diff --git a/0948-bag-of-tokens/0948-bag-of-tokens.cpp b/0948-bag-of-tokens/0948-bag-of-tokens.cpp
new file mode 100644
index 00000000..b1fbb888
--- /dev/null
+++ b/0948-bag-of-tokens/0948-bag-of-tokens.cpp
@@ -0,0 +1,29 @@
+class Solution {
+public:
+ int bagOfTokensScore(vector& tokens, int power) {
+
+ int start = 0, end = tokens.size()-1;
+ int score = 0, maxScore = 0;
+
+ sort(tokens.begin(), tokens.end());
+
+ while(start <= end)
+ {
+ if(power >= tokens[start])
+ {
+ ++score;
+ maxScore = max(maxScore, score);
+ power -= tokens[start++];
+ }
+ else if(score > 0)
+ {
+ power += tokens[end--];
+ --score;
+ }
+ else
+ break;
+ }
+
+ return maxScore;
+ }
+};
\ No newline at end of file
diff --git a/0948-bag-of-tokens/NOTES.md b/0948-bag-of-tokens/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0948-bag-of-tokens/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0948-bag-of-tokens/README.md b/0948-bag-of-tokens/README.md
new file mode 100644
index 00000000..968d02c5
--- /dev/null
+++ b/0948-bag-of-tokens/README.md
@@ -0,0 +1,106 @@
+Medium
You start with an initial power of power, an initial score of 0, and a bag of tokens given as an integer array tokens, where each tokens[i] donates the value of tokeni.
+
+
Your goal is to maximize the total score by strategically playing these tokens. In one move, you can play an unplayed token in one of the two ways (but not both for the same token):
+
+
+ - Face-up: If your current power is at least
tokens[i], you may play tokeni, losing tokens[i] power and gaining 1 score.
+ - Face-down: If your current score is at least
1, you may play tokeni, gaining tokens[i] power and losing 1 score.
+
+
+
Return the maximum possible score you can achieve after playing any number of tokens.
+
+
+
Example 1:
+
+
+
Input: tokens = [100], power = 50
+
+
Output: 0
+
+
Explanation: Since your score is 0 initially, you cannot play the token face-down. You also cannot play it face-up since your power (50) is less than tokens[0] (100).
+
+
+
Example 2:
+
+
+
Input: tokens = [200,100], power = 150
+
+
Output: 1
+
+
Explanation: Play token1 (100) face-up, reducing your power to 50 and increasing your score to 1.
+
+
There is no need to play token0, since you cannot play it face-up to add to your score. The maximum score achievable is 1.
+
+
+
Example 3:
+
+
+
Input: tokens = [100,200,300,400], power = 200
+
+
Output: 2
+
+
Explanation: Play the tokens in this order to get a score of 2:
+
+
+ - Play token0 (
100) face-up, reducing power to 100 and increasing score to 1.
+ - Play token3 (
400) face-down, increasing power to 500 and reducing score to 0.
+ - Play token1 (
200) face-up, reducing power to 300 and increasing score to 1.
+ - Play token2 (
300) face-up, reducing power to 0 and increasing score to 2.
+
+
+
The maximum score achievable is 2.
+
+
+
+
Constraints:
+
+
+ 0 <= tokens.length <= 1000
+ 0 <= tokens[i], power < 104
+
+
\ No newline at end of file
diff --git a/0950-reveal-cards-in-increasing-order/0950-reveal-cards-in-increasing-order.cpp b/0950-reveal-cards-in-increasing-order/0950-reveal-cards-in-increasing-order.cpp
new file mode 100644
index 00000000..5c3092eb
--- /dev/null
+++ b/0950-reveal-cards-in-increasing-order/0950-reveal-cards-in-increasing-order.cpp
@@ -0,0 +1,15 @@
+class Solution {
+public:
+ vector deckRevealedIncreasing(vector& deck) {
+ sort(deck.rbegin(), deck.rend());
+ deque d;
+ d.push_back(deck[0]);
+ for (int i = 1; i < deck.size(); i++) {
+ d.push_front(d.back());
+ d.pop_back();
+ d.push_front(deck[i]);
+ }
+ vector res(d.begin(), d.end());
+ return res;
+ }
+};
\ No newline at end of file
diff --git a/0950-reveal-cards-in-increasing-order/NOTES.md b/0950-reveal-cards-in-increasing-order/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0950-reveal-cards-in-increasing-order/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0950-reveal-cards-in-increasing-order/README.md b/0950-reveal-cards-in-increasing-order/README.md
new file mode 100644
index 00000000..8fd4c765
--- /dev/null
+++ b/0950-reveal-cards-in-increasing-order/README.md
@@ -0,0 +1,49 @@
+Medium
You are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the ith card is deck[i].
+
+
You can order the deck in any order you want. Initially, all the cards start face down (unrevealed) in one deck.
+
+
You will do the following steps repeatedly until all cards are revealed:
+
+
+ - Take the top card of the deck, reveal it, and take it out of the deck.
+ - If there are still cards in the deck then put the next top card of the deck at the bottom of the deck.
+ - If there are still unrevealed cards, go back to step 1. Otherwise, stop.
+
+
+
Return an ordering of the deck that would reveal the cards in increasing order.
+
+
Note that the first entry in the answer is considered to be the top of the deck.
+
+
+
Example 1:
+
+
Input: deck = [17,13,11,2,3,5,7]
+Output: [2,13,3,11,5,17,7]
+Explanation:
+We get the deck in the order [17,13,11,2,3,5,7] (this order does not matter), and reorder it.
+After reordering, the deck starts as [2,13,3,11,5,17,7], where 2 is the top of the deck.
+We reveal 2, and move 13 to the bottom. The deck is now [3,11,5,17,7,13].
+We reveal 3, and move 11 to the bottom. The deck is now [5,17,7,13,11].
+We reveal 5, and move 17 to the bottom. The deck is now [7,13,11,17].
+We reveal 7, and move 13 to the bottom. The deck is now [11,17,13].
+We reveal 11, and move 17 to the bottom. The deck is now [13,17].
+We reveal 13, and move 17 to the bottom. The deck is now [17].
+We reveal 17.
+Since all the cards revealed are in increasing order, the answer is correct.
+
+
+
Example 2:
+
+
Input: deck = [1,1000]
+Output: [1,1000]
+
+
+
+
Constraints:
+
+
+ 1 <= deck.length <= 1000
+ 1 <= deck[i] <= 106
+ - All the values of
deck are unique.
+
+
\ No newline at end of file
diff --git a/0959-regions-cut-by-slashes/0959-regions-cut-by-slashes.cpp b/0959-regions-cut-by-slashes/0959-regions-cut-by-slashes.cpp
new file mode 100644
index 00000000..614e2c88
--- /dev/null
+++ b/0959-regions-cut-by-slashes/0959-regions-cut-by-slashes.cpp
@@ -0,0 +1,56 @@
+class Solution {
+public:
+ int regionsBySlashes(vector& grid) {
+
+ int n = grid.size();
+ int m = grid[0].size();
+ int cnt = 0;
+
+ vector> mat(n*3, vector(m*3, 0));
+ vector> visited = mat;
+
+ for(int i = 0; i < n; ++i)
+ {
+ for(int j = 0; j < m; ++j)
+ {
+ if(grid[i][j] == '/')
+ {
+ mat[i*3][j*3+2] = 1;
+ mat[i*3+1][j*3+1] = 1;
+ mat[i*3+2][j*3] = 1;
+ }
+ else if(grid[i][j] == '\\')
+ {
+ mat[i*3][j*3] = 1;
+ mat[i*3+1][j*3+1] = 1;
+ mat[i*3+2][j*3+2] = 1;
+ }
+ }
+ }
+
+ function dfs = [&](int i, int j)
+ {
+ if(i < 0 or j < 0 or i >= n*3 or j >= m*3 or visited[i][j] or mat[i][j] == 1)
+ return;
+ visited[i][j] = 1;
+ dfs(i-1, j);
+ dfs(i, j+1);
+ dfs(i+1, j);
+ dfs(i, j-1);
+ };
+
+ for(int i = 0; i < n*3; ++i)
+ {
+ for(int j = 0; j < m*3; ++j)
+ {
+ if(!visited[i][j] and mat[i][j] == 0)
+ {
+ ++cnt;
+ dfs(i, j);
+ }
+ }
+ }
+
+ return cnt;
+ }
+};
\ No newline at end of file
diff --git a/0959-regions-cut-by-slashes/NOTES.md b/0959-regions-cut-by-slashes/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0959-regions-cut-by-slashes/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0959-regions-cut-by-slashes/README.md b/0959-regions-cut-by-slashes/README.md
new file mode 100644
index 00000000..fc2c5d3b
--- /dev/null
+++ b/0959-regions-cut-by-slashes/README.md
@@ -0,0 +1,35 @@
+Medium
An n x n grid is composed of 1 x 1 squares where each 1 x 1 square consists of a '/', '\', or blank space ' '. These characters divide the square into contiguous regions.
+
+
Given the grid grid represented as a string array, return the number of regions.
+
+
Note that backslash characters are escaped, so a '\' is represented as '\\'.
+
+
+
Example 1:
+

+
Input: grid = [" /","/ "]
+Output: 2
+
+
+
Example 2:
+

+
Input: grid = [" /"," "]
+Output: 1
+
+
+
Example 3:
+

+
Input: grid = ["/\\","\\/"]
+Output: 5
+Explanation: Recall that because \ characters are escaped, "\\/" refers to \/, and "/\\" refers to /\.
+
+
+
+
Constraints:
+
+
+ n == grid.length == grid[i].length
+ 1 <= n <= 30
+ grid[i][j] is either '/', '\', or ' '.
+
+
\ No newline at end of file
diff --git a/0977-squares-of-a-sorted-array/0977-squares-of-a-sorted-array.cpp b/0977-squares-of-a-sorted-array/0977-squares-of-a-sorted-array.cpp
new file mode 100644
index 00000000..b31ae1e2
--- /dev/null
+++ b/0977-squares-of-a-sorted-array/0977-squares-of-a-sorted-array.cpp
@@ -0,0 +1,27 @@
+class Solution {
+public:
+ vector sortedSquares(vector& nums) {
+
+ int n = nums.size();
+ vector squares(n);
+
+ int i = 0, j = n-1, k = n-1;
+
+ while(k >= 0)
+ {
+ if(abs(nums[i]) > abs(nums[j]))
+ {
+ squares[k] = nums[i] * nums[i];
+ ++i;
+ }
+ else
+ {
+ squares[k] = nums[j] * nums[j];
+ --j;
+ }
+ --k;
+ }
+
+ return squares;
+ }
+};
\ No newline at end of file
diff --git a/0977-squares-of-a-sorted-array/NOTES.md b/0977-squares-of-a-sorted-array/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0977-squares-of-a-sorted-array/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0977-squares-of-a-sorted-array/README.md b/0977-squares-of-a-sorted-array/README.md
new file mode 100644
index 00000000..9e0b7c42
--- /dev/null
+++ b/0977-squares-of-a-sorted-array/README.md
@@ -0,0 +1,28 @@
+Easy
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.
+
+
+
Example 1:
+
+
Input: nums = [-4,-1,0,3,10]
+Output: [0,1,9,16,100]
+Explanation: After squaring, the array becomes [16,1,0,9,100].
+After sorting, it becomes [0,1,9,16,100].
+
+
+
Example 2:
+
+
Input: nums = [-7,-3,2,3,11]
+Output: [4,9,9,49,121]
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 104
+ -104 <= nums[i] <= 104
+ nums is sorted in non-decreasing order.
+
+
+
+
Follow up: Squaring each element and sorting the new array is very trivial, could you find an
O(n) solution using a different approach?
\ No newline at end of file
diff --git a/0979-distribute-coins-in-binary-tree/0979-distribute-coins-in-binary-tree.cpp b/0979-distribute-coins-in-binary-tree/0979-distribute-coins-in-binary-tree.cpp
new file mode 100644
index 00000000..a8764161
--- /dev/null
+++ b/0979-distribute-coins-in-binary-tree/0979-distribute-coins-in-binary-tree.cpp
@@ -0,0 +1,37 @@
+/**
+ * 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 helper(TreeNode* root, int& moves)
+ {
+ if(!root)
+ return 0;
+
+ int left = helper(root->left, moves);
+ int right = helper(root->right, moves);
+
+ moves += (abs(left) + abs(right));
+
+ return (left + right + root->val - 1);
+ }
+
+ int distributeCoins(TreeNode* root) {
+
+ int moves = 0;
+
+ helper(root, moves);
+
+ return moves;
+
+ }
+};
\ No newline at end of file
diff --git a/0979-distribute-coins-in-binary-tree/README.md b/0979-distribute-coins-in-binary-tree/README.md
new file mode 100644
index 00000000..e7b0415a
--- /dev/null
+++ b/0979-distribute-coins-in-binary-tree/README.md
@@ -0,0 +1,31 @@
+Medium
You are given the root of a binary tree with n nodes where each node in the tree has node.val coins. There are n coins in total throughout the whole tree.
+
+
In one move, we may choose two adjacent nodes and move one coin from one node to another. A move may be from parent to child, or from child to parent.
+
+
Return the minimum number of moves required to make every node have exactly one coin.
+
+
+
Example 1:
+

+
Input: root = [3,0,0]
+Output: 2
+Explanation: From the root of the tree, we move one coin to its left child, and one coin to its right child.
+
+
+
Example 2:
+

+
Input: root = [0,3,0]
+Output: 3
+Explanation: From the left child of the root, we move two coins to the root [taking two moves]. Then, we move one coin from the root of the tree to the right child.
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is
n.
+ 1 <= n <= 100
+ 0 <= Node.val <= n
+ - The sum of all
Node.val is n.
+
+
\ No newline at end of file
diff --git a/0987-vertical-order-traversal-of-a-binary-tree/0987-vertical-order-traversal-of-a-binary-tree.cpp b/0987-vertical-order-traversal-of-a-binary-tree/0987-vertical-order-traversal-of-a-binary-tree.cpp
new file mode 100644
index 00000000..2fa6c38d
--- /dev/null
+++ b/0987-vertical-order-traversal-of-a-binary-tree/0987-vertical-order-traversal-of-a-binary-tree.cpp
@@ -0,0 +1,45 @@
+/**
+ * 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:
+
+ map>> mp;
+
+ void helper(TreeNode* root, int id, int level)
+ {
+ if(root)
+ {
+ mp[id][level].insert(root->val);
+ helper(root->left, id-1, level + 1);
+ helper(root->right, id+1, level + 1);
+ }
+ }
+
+ vector> verticalTraversal(TreeNode* root) {
+
+ int id = 0;
+ helper(root, id, 0);
+
+ vector> ans;
+
+ for(auto&[f, s] : mp)
+ {
+ vector col;
+ for(auto& ms : s)
+ col.insert(col.end(),ms.second.begin(),ms.second.end());
+ ans.push_back(col);
+ }
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0987-vertical-order-traversal-of-a-binary-tree/README.md b/0987-vertical-order-traversal-of-a-binary-tree/README.md
new file mode 100644
index 00000000..6ca03394
--- /dev/null
+++ b/0987-vertical-order-traversal-of-a-binary-tree/README.md
@@ -0,0 +1,50 @@
+Hard
Given the root of a binary tree, calculate the vertical order traversal of the binary tree.
+
+
For each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) and (row + 1, col + 1) respectively. The root of the tree is at (0, 0).
+
+
The vertical order traversal of a binary tree is a list of top-to-bottom orderings for each column index starting from the leftmost column and ending on the rightmost column. There may be multiple nodes in the same row and same column. In such a case, sort these nodes by their values.
+
+
Return the vertical order traversal of the binary tree.
+
+
+
Example 1:
+

+
Input: root = [3,9,20,null,null,15,7]
+Output: [[9],[3,15],[20],[7]]
+Explanation:
+Column -1: Only node 9 is in this column.
+Column 0: Nodes 3 and 15 are in this column in that order from top to bottom.
+Column 1: Only node 20 is in this column.
+Column 2: Only node 7 is in this column.
+
+
Example 2:
+

+
Input: root = [1,2,3,4,5,6,7]
+Output: [[4],[2],[1,5,6],[3],[7]]
+Explanation:
+Column -2: Only node 4 is in this column.
+Column -1: Only node 2 is in this column.
+Column 0: Nodes 1, 5, and 6 are in this column.
+ 1 is at the top, so it comes first.
+ 5 and 6 are at the same position (2, 0), so we order them by their value, 5 before 6.
+Column 1: Only node 3 is in this column.
+Column 2: Only node 7 is in this column.
+
+
+
Example 3:
+

+
Input: root = [1,2,3,4,6,5,7]
+Output: [[4],[2],[1,5,6],[3],[7]]
+Explanation:
+This case is the exact same as example 2, but with nodes 5 and 6 swapped.
+Note that the solution remains the same since 5 and 6 are in the same location and should be ordered by their values.
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 1000].
+ 0 <= Node.val <= 1000
+
+
\ No newline at end of file
diff --git a/0988-smallest-string-starting-from-leaf/0988-smallest-string-starting-from-leaf.cpp b/0988-smallest-string-starting-from-leaf/0988-smallest-string-starting-from-leaf.cpp
new file mode 100644
index 00000000..c71963a8
--- /dev/null
+++ b/0988-smallest-string-starting-from-leaf/0988-smallest-string-starting-from-leaf.cpp
@@ -0,0 +1,35 @@
+/**
+ * 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:
+
+ string ans = "~";
+
+ void helper(TreeNode* root, string curr)
+ {
+ if(!root)
+ return;
+
+ if(!root->left and !root->right)
+ ans = min(ans, char(root->val + 'a') + curr);
+
+ helper(root->left, char(root->val + 'a') + curr);
+ helper(root->right, char(root->val + 'a') + curr);
+ }
+
+ string smallestFromLeaf(TreeNode* root) {
+
+ helper(root, "");
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0988-smallest-string-starting-from-leaf/README.md b/0988-smallest-string-starting-from-leaf/README.md
new file mode 100644
index 00000000..2ba3cfed
--- /dev/null
+++ b/0988-smallest-string-starting-from-leaf/README.md
@@ -0,0 +1,39 @@
+Medium
You are given the root of a binary tree where each node has a value in the range [0, 25] representing the letters 'a' to 'z'.
+
+
Return the lexicographically smallest string that starts at a leaf of this tree and ends at the root.
+
+
As a reminder, any shorter prefix of a string is lexicographically smaller.
+
+
+ - For example,
"ab" is lexicographically smaller than "aba".
+
+
+
A leaf of a node is a node that has no children.
+
+
+
Example 1:
+

+
Input: root = [0,1,2,3,4,3,4]
+Output: "dba"
+
+
+
Example 2:
+

+
Input: root = [25,1,3,1,3,0,2]
+Output: "adz"
+
+
+
Example 3:
+

+
Input: root = [2,2,1,null,1,0,null,0]
+Output: "abc"
+
+
+
+
Constraints:
+
+
+ - The number of nodes in the tree is in the range
[1, 8500].
+ 0 <= Node.val <= 25
+
+
\ No newline at end of file
diff --git a/0992-subarrays-with-k-different-integers/README.md b/0992-subarrays-with-k-different-integers/README.md
new file mode 100644
index 00000000..cde878b8
--- /dev/null
+++ b/0992-subarrays-with-k-different-integers/README.md
@@ -0,0 +1,33 @@
+Hard
Given an integer array nums and an integer k, return the number of good subarrays of nums.
+
+
A good array is an array where the number of different integers in that array is exactly k.
+
+
+ - For example,
[1,2,3,1,2] has 3 different integers: 1, 2, and 3.
+
+
+
A subarray is a contiguous part of an array.
+
+
+
Example 1:
+
+
Input: nums = [1,2,1,2,3], k = 2
+Output: 7
+Explanation: Subarrays formed with exactly 2 different integers: [1,2], [2,1], [1,2], [2,3], [1,2,1], [2,1,2], [1,2,1,2]
+
+
+
Example 2:
+
+
Input: nums = [1,2,1,3,4], k = 3
+Output: 3
+Explanation: Subarrays formed with exactly 3 different integers: [1,2,1,3], [2,1,3], [1,3,4].
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 2 * 104
+ 1 <= nums[i], k <= nums.length
+
+
\ No newline at end of file
diff --git a/0995-minimum-number-of-k-consecutive-bit-flips/0995-minimum-number-of-k-consecutive-bit-flips.cpp b/0995-minimum-number-of-k-consecutive-bit-flips/0995-minimum-number-of-k-consecutive-bit-flips.cpp
new file mode 100644
index 00000000..c2bc0ee2
--- /dev/null
+++ b/0995-minimum-number-of-k-consecutive-bit-flips/0995-minimum-number-of-k-consecutive-bit-flips.cpp
@@ -0,0 +1,40 @@
+class Solution {
+public:
+ int minKBitFlips(vector& nums, int k) {
+
+ int n = nums.size(), ans = 0;
+
+ vector> pref(n, {0, 0});
+
+ bool flag = true;
+
+ for(int i = 0; i < n; ++i)
+ {
+ pref[i].second = (i-1 >= 0 ? pref[i-1].second : 0);
+
+ if(i - k >= 0)
+ {
+ if(pref[i-k].first)
+ --pref[i].second;
+ }
+
+ int moves = pref[i].second;
+
+ int op = (nums[i] % 2 == 0 ? (moves % 2 == 0 ? 1 : 0) : (moves % 2 == 0 ? 0 : 1));
+
+ if(op){
+ if(i <= n-k)
+ {
+ pref[i].first = 1;
+ ++ans;
+ }
+ else
+ flag = false;
+ }
+
+ pref[i].second += op;
+ }
+
+ return (flag ? ans : -1);
+ }
+};
\ No newline at end of file
diff --git a/0995-minimum-number-of-k-consecutive-bit-flips/NOTES.md b/0995-minimum-number-of-k-consecutive-bit-flips/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0995-minimum-number-of-k-consecutive-bit-flips/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0995-minimum-number-of-k-consecutive-bit-flips/README.md b/0995-minimum-number-of-k-consecutive-bit-flips/README.md
new file mode 100644
index 00000000..4a559ed8
--- /dev/null
+++ b/0995-minimum-number-of-k-consecutive-bit-flips/README.md
@@ -0,0 +1,41 @@
+Hard
You are given a binary array nums and an integer k.
+
+
A k-bit flip is choosing a subarray of length k from nums and simultaneously changing every 0 in the subarray to 1, and every 1 in the subarray to 0.
+
+
Return the minimum number of k-bit flips required so that there is no 0 in the array. If it is not possible, return -1.
+
+
A subarray is a contiguous part of an array.
+
+
+
Example 1:
+
+
Input: nums = [0,1,0], k = 1
+Output: 2
+Explanation: Flip nums[0], then flip nums[2].
+
+
+
Example 2:
+
+
Input: nums = [1,1,0], k = 2
+Output: -1
+Explanation: No matter how we flip subarrays of size 2, we cannot make the array become [1,1,1].
+
+
+
Example 3:
+
+
Input: nums = [0,0,0,1,0,1,1,0], k = 3
+Output: 3
+Explanation:
+Flip nums[0],nums[1],nums[2]: nums becomes [1,1,1,1,0,1,1,0]
+Flip nums[4],nums[5],nums[6]: nums becomes [1,1,1,1,1,0,0,0]
+Flip nums[5],nums[6],nums[7]: nums becomes [1,1,1,1,1,1,1,1]
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 105
+ 1 <= k <= nums.length
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element.cpp
new file mode 100644
index 00000000..d401154d
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element.cpp
@@ -0,0 +1,55 @@
+#define ll long long int
+
+class Solution {
+public:
+ int maxFrequency(vector& nums, int k) {
+
+ int n = nums.size();
+
+ sort(nums.begin(), nums.end());
+
+ vector pref(n+1, 0);
+
+ for(int i = 1; i <= n; ++i)
+ {
+ pref[i] = (pref[i-1] + nums[i-1]);
+ }
+
+ function calculate = [&](int targetIdx)
+ {
+ int ans = 0, val = nums[targetIdx];
+
+ int low = 0, high = targetIdx;
+
+ while(low <= high)
+ {
+ int mid = (low + high) >> 1;
+
+ int cnt = targetIdx - mid + 1;
+
+ ll windowSum = val * 1LL * cnt;
+
+ ll currSum = pref[targetIdx+1] - pref[mid];
+
+ if((windowSum - currSum) <= k)
+ {
+ ans = max(ans, cnt);
+ high = mid-1;
+ }
+ else
+ low = mid+1;
+ }
+
+ return ans;
+ };
+
+ int res = 0;
+
+ for(int i = 0; i < n; ++i)
+ {
+ res = max(res, calculate(i));
+ }
+
+ return res;
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element/NOTES.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-hidden-flex-wrap-wrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondiv-styletransform-rotate180deg-svg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1838-frequency-of-the-most-frequent-element/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar.cpp
new file mode 100644
index 00000000..2acce397
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar.cpp
@@ -0,0 +1,15 @@
+class Solution {
+public:
+ int kthGrammar(int n, int k) {
+
+ if(n == 1 and k == 1)
+ return 0;
+
+ int mid = pow(2, n-1) / 2;
+
+ if(k <= mid)
+ return kthGrammar(n-1, k);
+ else
+ return !kthGrammar(n-1, k-mid);
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar/NOTES.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div779-k-th-symbol-in-grammar/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap.cpp
new file mode 100644
index 00000000..81cf155a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap.cpp
@@ -0,0 +1,29 @@
+class MyHashMap {
+public:
+
+ int arr[1000001];
+
+ MyHashMap() {
+ fill(arr, arr+1000001, -1);
+ }
+
+ void put(int key, int value) {
+ arr[key] = value;
+ }
+
+ int get(int key) {
+ return arr[key];
+ }
+
+ void remove(int key) {
+ arr[key] = -1;
+ }
+};
+
+/**
+ * Your MyHashMap object will be instantiated and called as such:
+ * MyHashMap* obj = new MyHashMap();
+ * obj->put(key,value);
+ * int param_2 = obj->get(key);
+ * obj->remove(key);
+ */
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/NOTES.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/README.md
new file mode 100644
index 00000000..afd9c7ec
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence10-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divlinkedin-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divwalmart-global-tech-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div706-design-hashmap/README.md
@@ -0,0 +1,40 @@
+Easy
Design a HashMap without using any built-in hash table libraries.
+
+
Implement the MyHashMap class:
+
+
+ MyHashMap() initializes the object with an empty map.
+ void put(int key, int value) inserts a (key, value) pair into the HashMap. If the key already exists in the map, update the corresponding value.
+ int get(int key) returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key.
+ void remove(key) removes the key and its corresponding value if the map contains the mapping for the key.
+
+
+
+
Example 1:
+
+
Input
+["MyHashMap", "put", "put", "get", "get", "put", "get", "remove", "get"]
+[[], [1, 1], [2, 2], [1], [3], [2, 1], [2], [2], [2]]
+Output
+[null, null, null, 1, -1, null, 1, null, -1]
+
+Explanation
+MyHashMap myHashMap = new MyHashMap();
+myHashMap.put(1, 1); // The map is now [[1,1]]
+myHashMap.put(2, 2); // The map is now [[1,1], [2,2]]
+myHashMap.get(1); // return 1, The map is now [[1,1], [2,2]]
+myHashMap.get(3); // return -1 (i.e., not found), The map is now [[1,1], [2,2]]
+myHashMap.put(2, 1); // The map is now [[1,1], [2,1]] (i.e., update the existing value)
+myHashMap.get(2); // return 1, The map is now [[1,1], [2,1]]
+myHashMap.remove(2); // remove the mapping for 2, The map is now [[1,1]]
+myHashMap.get(2); // return -1 (i.e., not found), The map is now [[1,1]]
+
+
+
+
Constraints:
+
+
+ 0 <= key, value <= 106
+ - At most
104 calls will be made to put, get, and remove.
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string.cpp
new file mode 100644
index 00000000..776c6783
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string.cpp
@@ -0,0 +1,14 @@
+class Solution {
+public:
+ string findDifferentBinaryString(vector& nums) {
+
+ int n = nums.size();
+
+ for(int i = 0; i < n; ++i)
+ {
+ if(nums[0][i] = nums[i][i] == '0' ? '1' : '0');
+ }
+
+ return nums[0];
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string/NOTES.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1980-find-unique-binary-string/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors.cpp
new file mode 100644
index 00000000..d2d96ba0
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors.cpp
@@ -0,0 +1,39 @@
+class Solution {
+public:
+
+ const int mod = 1e9+7;
+
+ int numFactoredBinaryTrees(vector& arr) {
+
+ int n = arr.size();
+
+ unordered_map mp;
+
+ for(auto& itr : arr)
+ ++mp[itr];
+
+ sort(arr.begin(), arr.end());
+
+ int ans = 0;
+
+ for(int i = 1; i < n; ++i)
+ {
+ for(int j = 0; j < i; ++j)
+ {
+ if(arr[i] % arr[j] == 0)
+ {
+ long long count = (mp[arr[j]] * 1LL * mp[arr[i]/arr[j]]) % mod;
+ mp[arr[i]] = (mp[arr[i]] % mod + count)% mod;
+ }
+ }
+ }
+
+ for(auto& itr : mp)
+ {
+ ans = (ans + itr.second) % mod;
+ }
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors/README.md
new file mode 100644
index 00000000..7292e9fd
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div823-binary-trees-with-factors/README.md
@@ -0,0 +1,28 @@
+Medium
Given an array of unique integers, arr, where each integer arr[i] is strictly greater than 1.
+
+
We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children.
+
+
Return the number of binary trees we can make. The answer may be too large so return the answer modulo 109 + 7.
+
+
+
Example 1:
+
+
Input: arr = [2,4]
+Output: 3
+Explanation: We can make these trees: [2], [4], [4, 2, 2]
+
+
Example 2:
+
+
Input: arr = [2,4,5,10]
+Output: 7
+Explanation: We can make these trees: [2], [4], [5], [10], [4, 2, 2], [10, 2, 5], [10, 5, 2].
+
+
+
Constraints:
+
+
+ 1 <= arr.length <= 1000
+ 2 <= arr[i] <= 109
+ - All the values of
arr are unique.
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence32-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence8-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divuber-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divcitadel-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbytedance-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtwilio-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtiktok-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divvmware-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbookingcom-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divdoordash-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divde-shaw-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divquora-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div239-sliding-window-maximum/NOTES.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence32-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence8-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divuber-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divcitadel-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbytedance-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtwilio-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtiktok-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divvmware-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbookingcom-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divdoordash-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divde-shaw-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divquora-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div239-sliding-window-maximum/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence32-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence8-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divuber-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divcitadel-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbytedance-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtwilio-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtiktok-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divvmware-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbookingcom-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divdoordash-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divde-shaw-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divquora-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div239-sliding-window-maximum/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence32-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence8-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divuber-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divcitadel-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbytedance-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtwilio-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtiktok-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divvmware-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbookingcom-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divdoordash-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divde-shaw-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divquora-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div239-sliding-window-maximum/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence32-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence8-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divuber-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divcitadel-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbytedance-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtwilio-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtiktok-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divvmware-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbookingcom-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divdoordash-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divde-shaw-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divquora-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div239-sliding-window-maximum/README.md
new file mode 100644
index 00000000..158d4a8f
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence32-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence8-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divuber-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divcitadel-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbytedance-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtwilio-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divtiktok-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divvmware-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbookingcom-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divdoordash-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divde-shaw-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divquora-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div239-sliding-window-maximum/README.md
@@ -0,0 +1,35 @@
+Hard
You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.
+
+
Return the max sliding window.
+
+
+
Example 1:
+
+
Input: nums = [1,3,-1,-3,5,3,6,7], k = 3
+Output: [3,3,5,5,6,7]
+Explanation:
+Window position Max
+--------------- -----
+[1 3 -1] -3 5 3 6 7 3
+ 1 [3 -1 -3] 5 3 6 7 3
+ 1 3 [-1 -3 5] 3 6 7 5
+ 1 3 -1 [-3 5 3] 6 7 5
+ 1 3 -1 -3 [5 3 6] 7 6
+ 1 3 -1 -3 5 [3 6 7] 7
+
+
+
Example 2:
+
+
Input: nums = [1], k = 1
+Output: [1]
+
+
+
+
Constraints:
+
+
+ 1 <= nums.length <= 105
+ -104 <= nums[i] <= 104
+ 1 <= k <= nums.length
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring.cpp
new file mode 100644
index 00000000..b9aeff39
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring.cpp
@@ -0,0 +1,40 @@
+class Solution {
+public:
+ string longestPalindrome(string s) {
+
+ int n = s.size();
+
+ vector> dp(n+1, vector(n+1, 0));
+
+ int maxLength = 0;
+
+ string ans;
+
+ for(int diff = 0; diff < n; ++ diff)
+ {
+ for(int i = 0, j = diff; i < n and j < n; ++i, ++j)
+ {
+ if(i == j)
+ {
+ dp[i][j] = 1;
+ }
+ else if(diff == 1 and s[i] == s[j])
+ {
+ dp[i][j] = 2;
+ }
+ else if(diff > 1 and s[i] == s[j] and dp[i+1][j-1])
+ {
+ dp[i][j] = dp[i+1][j-1] + 2;
+ }
+
+ if(dp[i][j] > maxLength)
+ {
+ maxLength = dp[i][j];
+ ans = s.substr(i, j-i+1);
+ }
+ }
+ }
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/NOTES.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/README.md
new file mode 100644
index 00000000..2a2b8010
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence35-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence18-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoogle-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence12-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divoracle-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence6-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence5-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div5-longest-palindromic-substring/README.md
@@ -0,0 +1,24 @@
+Medium
Given a string s, return the longest palindromic substring in s.
+
+
+
Example 1:
+
+
Input: s = "babad"
+Output: "bab"
+Explanation: "aba" is also a valid answer.
+
+
+
Example 2:
+
+
Input: s = "cbbd"
+Output: "bb"
+
+
+
+
Constraints:
+
+
+ 1 <= s.length <= 1000
+ s consist of only digits and English letters.
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern.cpp
new file mode 100644
index 00000000..ead08dec
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern.cpp
@@ -0,0 +1,31 @@
+class Solution {
+public:
+ bool find132pattern(vector& nums) {
+
+ int n = nums.size();
+
+ vector prefMin(n);
+
+ prefMin[0] = nums[0];
+
+ for(int i = 1; i < n; ++i)
+ prefMin[i] = min(nums[i], prefMin[i-1]);
+
+ stack st;
+
+ for(int i = n-1; i >= 0; --i)
+ {
+ if(nums[i] > prefMin[i])
+ {
+ while(!st.empty() and st.top() <= prefMin[i])
+ st.pop();
+ if(!st.empty() and nums[i] > st.top())
+ return true;
+ st.push(nums[i]);
+ }
+ }
+
+ return false;
+
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern/README.md
new file mode 100644
index 00000000..c0815542
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div456-132-pattern/README.md
@@ -0,0 +1,35 @@
+Medium
Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j].
+
+
Return true if there is a 132 pattern in nums, otherwise, return false.
+
+
+
Example 1:
+
+
Input: nums = [1,2,3,4]
+Output: false
+Explanation: There is no 132 pattern in the sequence.
+
+
+
Example 2:
+
+
Input: nums = [3,1,4,2]
+Output: true
+Explanation: There is a 132 pattern in the sequence: [1, 4, 2].
+
+
+
Example 3:
+
+
Input: nums = [-1,3,2,0]
+Output: true
+Explanation: There are three 132 patterns in the sequence: [-1, 3, 2], [-1, 3, 0] and [-1, 2, 0].
+
+
+
+
Constraints:
+
+
+ n == nums.length
+ 1 <= n <= 2 * 105
+ -109 <= nums[i] <= 109
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii.cpp
new file mode 100644
index 00000000..cb2c75f3
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii.cpp
@@ -0,0 +1,57 @@
+class Solution {
+public:
+ vector majorityElement(vector& nums) {
+
+ int n = nums.size();
+
+ int count1 = 0, count2 = 0;
+
+ int num1 = INT_MAX, num2 = INT_MAX;
+
+ for(auto& itr : nums)
+ {
+ if(itr == num1)
+ {
+ ++count1;
+ }
+ else if(itr == num2)
+ {
+ ++count2;
+ }
+ else if(count1 == 0)
+ {
+ count1 = 1;
+ num1 = itr;
+ }
+ else if(count2 == 0)
+ {
+ count2 = 1;
+ num2 = itr;
+ }
+ else
+ {
+ --count1, --count2;
+ }
+ }
+
+ count1 = count2 = 0;
+
+ for(auto& itr : nums)
+ {
+ if(itr == num1)
+ ++count1;
+ else if(itr == num2)
+ ++count2;
+ }
+
+ vector ans;
+
+ if(count1 > n/3)
+ ans.push_back(num1);
+ if(count2 > n/3)
+ ans.push_back(num2);
+
+ return ans;
+
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii/NOTES.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divmicrosoft-divdiv-classcompanytagscontainer-tagoccurence3-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div229-majority-element-ii/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs.cpp
new file mode 100644
index 00000000..383cab45
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs.cpp
@@ -0,0 +1,18 @@
+class Solution {
+public:
+ int minCostClimbingStairs(vector& cost) {
+
+ int n = cost.size();
+
+ vector dp(n+1, 0);
+
+ for(int i = 2; i <= n; ++i)
+ {
+ int oneStep = cost[i-1] + dp[i-1];
+ int twoStep = cost[i-2] + dp[i-2];
+ dp[i] = min(oneStep, twoStep);
+ }
+
+ return dp[n];
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/NOTES.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/NOTES.md
new file mode 100644
index 00000000..38c1374a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/NOTES.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/README.md
new file mode 100644
index 00000000..5ca7f39b
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence5-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divadobe-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div746-min-cost-climbing-stairs/README.md
@@ -0,0 +1,38 @@
+Easy
You are given an integer array cost where cost[i] is the cost of ith step on a staircase. Once you pay the cost, you can either climb one or two steps.
+
+
You can either start from the step with index 0, or the step with index 1.
+
+
Return the minimum cost to reach the top of the floor.
+
+
+
Example 1:
+
+
Input: cost = [10,15,20]
+Output: 15
+Explanation: You will start at index 1.
+- Pay 15 and climb two steps to reach the top.
+The total cost is 15.
+
+
+
Example 2:
+
+
Input: cost = [1,100,1,1,1,100,1,1,100,1]
+Output: 6
+Explanation: You will start at index 0.
+- Pay 1 and climb two steps to reach index 2.
+- Pay 1 and climb two steps to reach index 4.
+- Pay 1 and climb two steps to reach index 6.
+- Pay 1 and climb one step to reach index 7.
+- Pay 1 and climb two steps to reach index 9.
+- Pay 1 and climb one step to reach the top.
+The total cost is 6.
+
+
+
+
Constraints:
+
+
+ 2 <= cost.length <= 1000
+ 0 <= cost[i] <= 999
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent.cpp
new file mode 100644
index 00000000..08c3a3b1
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent.cpp
@@ -0,0 +1,21 @@
+class Solution {
+public:
+ bool arrayStringsAreEqual(vector& word1, vector& word2) {
+
+ int i = 0, j = 0;
+ int n = 0, m = 0;
+
+ while(i < word1.size() and j < word2.size())
+ {
+ if(word1[i][n] != word2[j][m])
+ return false;
+
+ ++n, ++m;
+
+ if(n >= word1[i].size()) n = 0, ++i;
+ if(m >= word2[j].size()) m = 0, ++j;
+ }
+
+ return (i == word1.size() and j == word2.size());
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent/README.md
new file mode 100644
index 00000000..3e4a16f2
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1662-check-if-two-string-arrays-are-equivalent/README.md
@@ -0,0 +1,36 @@
+Easy
Given two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise.
+
+
A string is represented by an array if the array elements concatenated in order forms the string.
+
+
+
Example 1:
+
+
Input: word1 = ["ab", "c"], word2 = ["a", "bc"]
+Output: true
+Explanation:
+word1 represents string "ab" + "c" -> "abc"
+word2 represents string "a" + "bc" -> "abc"
+The strings are the same, so return true.
+
+
Example 2:
+
+
Input: word1 = ["a", "cb"], word2 = ["ab", "c"]
+Output: false
+
+
+
Example 3:
+
+
Input: word1 = ["abc", "d", "defg"], word2 = ["abcddefg"]
+Output: true
+
+
+
+
Constraints:
+
+
+ 1 <= word1.length, word2.length <= 103
+ 1 <= word1[i].length, word2[i].length <= 103
+ 1 <= sum(word1[i].length), sum(word2[i].length) <= 103
+ word1[i] and word2[i] consist of lowercase letters.
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points.cpp
new file mode 100644
index 00000000..a4e92859
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points.cpp
@@ -0,0 +1,17 @@
+class Solution {
+public:
+ int minTimeToVisitAllPoints(vector>& points) {
+
+ int n = points.size();
+
+ int t = 0;
+
+ for(int i = 1; i < n; ++i)
+ {
+ t += max(abs(points[i][1] - points[i-1][1]), abs(points[i][0] - points[i-1][0]));
+ }
+
+ return t;
+
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points/README.md
new file mode 100644
index 00000000..2fd5cedb
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence3-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div1266-minimum-time-visiting-all-points/README.md
@@ -0,0 +1,43 @@
+Easy
On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return the minimum time in seconds to visit all the points in the order given by points.
+
+
You can move according to these rules:
+
+
+ - In
1 second, you can either:
+
+
+ - move vertically by one unit,
+ - move horizontally by one unit, or
+ - move diagonally
sqrt(2) units (in other words, move one unit vertically then one unit horizontally in 1 second).
+
+
+ - You have to visit the points in the same order as they appear in the array.
+ - You are allowed to pass through points that appear later in the order, but these do not count as visits.
+
+
+
+
Example 1:
+

+
Input: points = [[1,1],[3,4],[-1,0]]
+Output: 7
+Explanation: One optimal path is [1,1] -> [2,2] -> [3,3] -> [3,4] -> [2,3] -> [1,2] -> [0,1] -> [-1,0]
+Time from [1,1] to [3,4] = 3 seconds
+Time from [3,4] to [-1,0] = 4 seconds
+Total time = 7 seconds
+
+
Example 2:
+
+
Input: points = [[3,2],[-2,2]]
+Output: 5
+
+
+
+
Constraints:
+
+
+ points.length == n
+ 1 <= n <= 100
+ points[i].length == 2
+ -1000 <= points[i][0], points[i][1] <= 1000
+
+
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters.cpp b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters.cpp
new file mode 100644
index 00000000..9f335b1a
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters.cpp
@@ -0,0 +1,37 @@
+class Solution {
+public:
+ string removeDuplicateLetters(string s) {
+
+ int n = s.size();
+
+ vector freq(26, 0);
+
+ vector visited(26, 0);
+
+ string ans;
+
+ for(int i = 0; i < n; ++i)
+ {
+ ++freq[s[i] - 'a'];
+ }
+
+ for(int i = 0; i < n; ++i)
+ {
+ while(!ans.empty() and !visited[s[i] - 'a'] and s[i] < ans.back() and freq[ans.back()-'a'])
+ {
+ visited[ans.back() - 'a'] = false;
+ ans.pop_back();
+ }
+
+ if(!visited[s[i] - 'a'])
+ {
+ ans += s[i];
+ visited[s[i] - 'a'] = 1;
+ }
+
+ --freq[s[i] - 'a'];
+ }
+
+ return ans;
+ }
+};
\ No newline at end of file
diff --git a/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters/README.md b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters/README.md
new file mode 100644
index 00000000..86a62d23
--- /dev/null
+++ b/0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divapple-divdiv-classcompanytagscontainer-tagoccurence4-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence2-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divsalesforce-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlink-x0px-y0px-viewbox0-0-32-32-fill4087f1-xml-spacepreserve-stylewidth-20px-polygon-points16-22-6-12-74-106-16-192-246-106-26-12-polygonrect-id-x3c-transparent-rectangle-x3e-classst0-fillnone-width32-height32-rect-svg-div-div-div-div316-remove-duplicate-letters/README.md
@@ -0,0 +1,26 @@
+