🦔

[英語解説] Techniques You Need To Know when Working with Arrays

2023/05/15に公開

Double Pointer

The Two-Pointers Method, also referred to as the Fast-Slow Pointer Method, is an approach that enables the simultaneous execution of two loops within a single loop.

LeetCode No. 977
LeetCode No. 27

Sliding Window

LeetCode No. 209

Maintaining Consistency in Interval Openness/Closure

When working with intervals, it is common to employ one of two approaches:

1.Left-closed, right-open:

2.Left-closed, right-closed:

Both approaches are acceptable, but it is crucial to maintain consistency in your solution to prevent confusion or errors.

Good example that you can exercise with:
LeetCode No.59
LeetCode No.704

Discussion