Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions problems/evaluate-division/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@

## 399. Evaluate Division (Medium)

<p>
Equations are given in the format <code>A / B = k</code>, where <code>A</code> and <code>B</code> are variables represented as strings, and <code>k</code> is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return <code>-1.0</code>.
</p>
<p><b>Example:</b><br/>
Given <code> a / b = 2.0, b / c = 3.0.</code> <br/>queries are: <code> a / c = ?, b / a = ?, a / e = ?, a / a = ?, x / x = ? .</code> <br/>return <code> [6.0, 0.5, -1.0, 1.0, -1.0 ].</code>
</p>
<p>
The input is: <code> vector&lt;pair&lt;string, string&gt;&gt; equations, vector&lt;double&gt;&amp; values, vector&lt;pair&lt;string, string&gt;&gt; queries </code>, where <code>equations.size() == values.size()</code>, and the values are positive. This represents the equations. Return <code> vector&lt;double&gt;</code>.
</p>

<p>According to the example above:
<pre>equations = [ ["a", "b"], ["b", "c"] ],
<p>Equations are given in the format <code>A / B = k</code>, where <code>A</code> and <code>B</code> are variables represented as strings, and <code>k</code> is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return <code>-1.0</code>.</p>

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

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

<p>According to the example above:</p>

<pre>
equations = [ [&quot;a&quot;, &quot;b&quot;], [&quot;b&quot;, &quot;c&quot;] ],
values = [2.0, 3.0],
queries = [ ["a", "c"], ["b", "a"], ["a", "e"], ["a", "a"], ["x", "x"] ]. </pre>
</p>
queries = [ [&quot;a&quot;, &quot;c&quot;], [&quot;b&quot;, &quot;a&quot;], [&quot;a&quot;, &quot;e&quot;], [&quot;a&quot;, &quot;a&quot;], [&quot;x&quot;, &quot;x&quot;] ]. </pre>

<p>&nbsp;</p>

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

### Related Topics
[[Union Find](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)]
Expand Down
3 changes: 3 additions & 0 deletions problems/perfect-rectangle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ Return false. Because two of the rectangles overlap with each other.
</pre>

<p>&nbsp;</p>

### Related Topics
[[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)]
1 change: 1 addition & 0 deletions problems/rectangle-area-ii/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
20 changes: 10 additions & 10 deletions problems/single-element-in-a-sorted-array/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@

## 540. Single Element in a Sorted Array (Medium)

<p>
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.
</p>
<p>Given a sorted array consisting of only integers where every element appears exactly twice except for one element which appears exactly&nbsp;once. Find this single element that appears only once.</p>

<p>&nbsp;</p>

<p><b>Example 1:</b></p>

<p><b>Example 1:</b><br />
<pre>
<b>Input:</b> [1,1,2,3,3,4,4,8,8]
<b>Output:</b> 2
</pre>
</p>

<p><b>Example 2:</b><br />
<p><b>Example 2:</b></p>

<pre>
<b>Input:</b> [3,3,7,7,10,11,11]
<b>Output:</b> 10
</pre>
</p>

<p><b>Note:</b>
Your solution should run in O(log n) time and O(1) space.
</p>
<p>&nbsp;</p>

<p><b>Note:</b> Your solution should run in O(log n) time and O(1) space.</p>
21 changes: 11 additions & 10 deletions problems/symmetric-tree/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,32 @@

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

<p>
For example, this binary tree <code>[1,2,2,3,4,4,3]</code> is symmetric:
<p>For example, this binary tree <code>[1,2,2,3,4,4,3]</code> is symmetric:</p>

<pre>
1
/ \
2 2
/ \ / \
3 4 4 3
</pre>
</p>
<p>
But the following <code>[1,2,2,null,3,null,3]</code> is not:<br />

<p>&nbsp;</p>

<p>But the following <code>[1,2,2,null,3,null,3]</code> is not:</p>

<pre>
1
/ \
2 2
\ \
3 3
</pre>
</p>

<p>
<b>Note:</b><br />
Bonus points if you could solve it both recursively and iteratively.
</p>
<p>&nbsp;</p>

<p><b>Note:</b><br />
Bonus points if you could solve it both recursively and iteratively.</p>

### Related Topics
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
Expand Down
1 change: 1 addition & 0 deletions problems/the-skyline-problem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 7 additions & 3 deletions problems/validate-binary-search-tree/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
<li>Both the left and right subtrees must also be binary search trees.</li>
</ul>

<p>&nbsp;</p>

<p><strong>Example 1:</strong></p>

<pre>
<strong>Input:</strong>
2
/ \
1 3

<strong>Input:</strong>&nbsp;[2,1,3]
<strong>Output:</strong> true
</pre>

Expand All @@ -39,9 +42,10 @@
1 4
&nbsp; / \
&nbsp; 3 6

<strong>Input:</strong> [5,1,4,null,null,3,6]
<strong>Output:</strong> false
<strong>Explanation:</strong> The input is: [5,1,4,null,null,3,6]. The root node&#39;s value
&nbsp; is 5 but its right child&#39;s value is 4.
<strong>Explanation:</strong> The root node&#39;s value is 5 but its right child&#39;s value is 4.
</pre>

### Related Topics
Expand Down