Update README.md

This commit is contained in:
bt3gl 2023-08-08 17:10:49 -07:00 committed by GitHub
parent ba0780c240
commit ac1f70506a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,29 @@
* in any case, this technique is usually used when the array is sorted.
* 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>