diff --git a/problems/evaluate-division/README.md b/problems/evaluate-division/README.md index b83d4f7ca..e100aeac1 100644 --- a/problems/evaluate-division/README.md +++ b/problems/evaluate-division/README.md @@ -11,25 +11,25 @@ ## 399. Evaluate Division (Medium) -

-Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return -1.0. -

-

Example:
-Given a / b = 2.0, b / c = 3.0.
queries are: a / c = ?, b / a = ?, a / e = ?, a / a = ?, x / x = ? .
return [6.0, 0.5, -1.0, 1.0, -1.0 ]. -

-

-The input is: vector<pair<string, string>> equations, vector<double>& values, vector<pair<string, string>> queries , where equations.size() == values.size(), and the values are positive. This represents the equations. Return vector<double>. -

- -

According to the example above: -

equations = [ ["a", "b"], ["b", "c"] ],
+

Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return -1.0.

+ +

Example:
+Given a / b = 2.0, b / c = 3.0.
+queries are: a / c = ?, b / a = ?, a / e = ?, a / a = ?, x / x = ? .
+return [6.0, 0.5, -1.0, 1.0, -1.0 ].

+ +

The input is: vector<pair<string, string>> equations, vector<double>& values, vector<pair<string, string>> queries , where equations.size() == values.size(), and the values are positive. This represents the equations. Return vector<double>.

+ +

According to the example above:

+ +
+equations = [ ["a", "b"], ["b", "c"] ],
 values = [2.0, 3.0],
-queries = [ ["a", "c"], ["b", "a"], ["a", "e"], ["a", "a"], ["x", "x"] ]. 
-

+queries = [ ["a", "c"], ["b", "a"], ["a", "e"], ["a", "a"], ["x", "x"] ].
+ +

 

-

-The input is always valid. You may assume that evaluating the queries will result in no division by zero and there is no contradiction. -

+

The input is always valid. You may assume that evaluating the queries will result in no division by zero and there is no contradiction.

### Related Topics [[Union Find](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] diff --git a/problems/perfect-rectangle/README.md b/problems/perfect-rectangle/README.md index 9ca3dd8b2..29d2822a4 100644 --- a/problems/perfect-rectangle/README.md +++ b/problems/perfect-rectangle/README.md @@ -89,3 +89,6 @@ Return false. Because two of the rectangles overlap with each other.

 

+ +### Related Topics + [[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)] diff --git a/problems/rectangle-area-ii/README.md b/problems/rectangle-area-ii/README.md index ba2806e13..04ffd0902 100644 --- a/problems/rectangle-area-ii/README.md +++ b/problems/rectangle-area-ii/README.md @@ -44,3 +44,4 @@ ### Related Topics [[Segment Tree](https://github.com/openset/leetcode/tree/master/tag/segment-tree/README.md)] + [[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)] diff --git a/problems/single-element-in-a-sorted-array/README.md b/problems/single-element-in-a-sorted-array/README.md index 437485645..ba84b9057 100644 --- a/problems/single-element-in-a-sorted-array/README.md +++ b/problems/single-element-in-a-sorted-array/README.md @@ -11,24 +11,24 @@ ## 540. Single Element in a Sorted Array (Medium) -

-Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element that appears only once. -

+

Given a sorted array consisting of only integers where every element appears exactly twice except for one element which appears exactly once. Find this single element that appears only once.

+ +

 

+ +

Example 1:

-

Example 1:

 Input: [1,1,2,3,3,4,4,8,8]
 Output: 2
 
-

-

Example 2:
+

Example 2:

+
 Input: [3,3,7,7,10,11,11]
 Output: 10
 
-

-

Note: -Your solution should run in O(log n) time and O(1) space. -

+

 

+ +

Note: Your solution should run in O(log n) time and O(1) space.

diff --git a/problems/symmetric-tree/README.md b/problems/symmetric-tree/README.md index 0ad1d886e..662694488 100644 --- a/problems/symmetric-tree/README.md +++ b/problems/symmetric-tree/README.md @@ -13,8 +13,8 @@

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

-

-For example, this binary tree [1,2,2,3,4,4,3] is symmetric: +

For example, this binary tree [1,2,2,3,4,4,3] is symmetric:

+
     1
    / \
@@ -22,9 +22,11 @@ For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
  / \ / \
 3  4 4  3
 
-

-

-But the following [1,2,2,null,3,null,3] is not:
+ +

 

+ +

But the following [1,2,2,null,3,null,3] is not:

+
     1
    / \
@@ -32,12 +34,11 @@ But the following [1,2,2,null,3,null,3]  is not:
\ \ 3 3
-

-

-Note:
-Bonus points if you could solve it both recursively and iteratively. -

+

 

+ +

Note:
+Bonus points if you could solve it both recursively and iteratively.

### Related Topics [[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)] diff --git a/problems/the-skyline-problem/README.md b/problems/the-skyline-problem/README.md index 554a5c6ae..d6cfe74b1 100644 --- a/problems/the-skyline-problem/README.md +++ b/problems/the-skyline-problem/README.md @@ -36,6 +36,7 @@ [[Binary Indexed Tree](https://github.com/openset/leetcode/tree/master/tag/binary-indexed-tree/README.md)] [[Segment Tree](https://github.com/openset/leetcode/tree/master/tag/segment-tree/README.md)] [[Divide and Conquer](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)] + [[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)] ### Similar Questions 1. [Falling Squares](https://github.com/openset/leetcode/tree/master/problems/falling-squares) (Hard) diff --git a/problems/validate-binary-search-tree/README.md b/problems/validate-binary-search-tree/README.md index be2e6e08a..04219c17b 100644 --- a/problems/validate-binary-search-tree/README.md +++ b/problems/validate-binary-search-tree/README.md @@ -21,13 +21,16 @@
  • Both the left and right subtrees must also be binary search trees.
  • +

     

    +

    Example 1:

    -Input:
         2
        / \
       1   3
    +
    +Input: [2,1,3]
     Output: true
     
    @@ -39,9 +42,10 @@ 1 4   / \   3 6 + +Input: [5,1,4,null,null,3,6] Output: false -Explanation: The input is: [5,1,4,null,null,3,6]. The root node's value -  is 5 but its right child's value is 4. +Explanation: The root node's value is 5 but its right child's value is 4. ### Related Topics