Update 5_Silver_2P.md
This commit is contained in:
parent
c99c5cac0c
commit
c643c39aee
1 changed files with 14 additions and 4 deletions
|
@ -1,15 +1,25 @@
|
|||
---
|
||||
slug: /silver/two-pointers
|
||||
title: "Two Pointers"
|
||||
author: Unknown
|
||||
author: Darren Yao
|
||||
order: 5
|
||||
prerequisites:
|
||||
-
|
||||
- Silver - Sorting
|
||||
---
|
||||
|
||||
- CPH 8.1
|
||||
# Two Pointers
|
||||
Iterating two monotonic pointers across an array to search for a pair of indices satisfying some condition in O(n).
|
||||
|
||||
See 14.1 of https://www.overleaf.com/project/5e73f65cde1d010001224d8a
|
||||
# Tutorials
|
||||
- Intro to USACO, 14.1: [Java](http://darrenyao.com/usacobook/java.pdf) [C++](http://darrenyao.com/usacobook/cpp.pdf)
|
||||
- CPH 8.1
|
||||
|
||||
<!-- END DESCRIPTION -->
|
||||
# Problems
|
||||
- [CSES Sum of Two Values](https://cses.fi/problemset/task/1640)
|
||||
- [CSES Maximum Subarray Sum](https://cses.fi/problemset/task/1643)
|
||||
|
||||
# Extensions
|
||||
The two pointers technique can be extended to the two dimensional sliding window algorithm. If you're looking for a more challenging problem using 2-D sliding window, see [USACO Fort Moo](http://usaco.org/index.php?page=viewproblem2&cpid=600)
|
||||
|
||||
<!-- END DESCRIPTION -->
|
||||
|
|
Reference in a new issue