mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update README.md
This commit is contained in:
parent
ba0780c240
commit
ac1f70506a
@ -31,6 +31,28 @@
|
|||||||
* in the **sliding window** technique, the two pointers usually move in the same direction and never overtake each other. examples are: longest substring without repeating characters, minumum size subarray sum, minimum window substring.
|
* in the **sliding window** technique, the two pointers usually move in the same direction and never overtake each other. examples are: longest substring without repeating characters, minumum size subarray sum, minimum window substring.
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
### intervals
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
* checking if two intervals overlap:
|
||||||
|
|
||||||
|
```python
|
||||||
|
def is_overlap(a, b):
|
||||||
|
return a[0] < b[1] and b[0] < a[1]
|
||||||
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
* merging two intervals:
|
||||||
|
|
||||||
|
```python
|
||||||
|
def merge_overlapping_intervals(a, b):
|
||||||
|
return [min(a[0], b[0]), max(a[1], b[1])]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user