-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:add two pointer algorithm #1207
base: main
Are you sure you want to change the base?
Conversation
Visit the preview URL for this PR (for commit dd01e8e): https://cp-algorithms--preview-1207-1ftu0mhq.web.app (expires 2023-12-18T12:06:43.474286555Z) |
Visit the preview URL for this PR (for commit 77906fb): https://cp-algorithms--preview-1207-1ftu0mhq.web.app (expires 2023-12-18T12:19:11.016074097Z) |
Visit the preview URL for this PR (for commit 00c7ee0): https://cp-algorithms--preview-1207-1ftu0mhq.web.app (expires 2023-12-23T10:45:44.193696310Z) |
Visit the preview URL for this PR (for commit 3fb8ecc): https://cp-algorithms--preview-1207-1ftu0mhq.web.app (expires 2023-12-23T14:08:43.870563390Z) |
Visit the preview URL for this PR (for commit 00c7ee0): https://cp-algorithms--preview-1207-1ftu0mhq.web.app (expires 2023-12-23T14:14:03.094310265Z) |
I'm not a maintainer, but don't forget: when creating a new article, modify the navigation.md and README.md. How to contribute: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure of the page is good, however I believe you are missing a lot of details. I don't think this is specific enough for someone new to 2-pointers.
|
||
## Example | ||
|
||
### Two Sum Problem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to put problem description here, or problem link for practice.
|
||
## Basic Idea | ||
|
||
The basic idea behind the Two Pointer Algorithm is to maintain two pointers that traverse the data structure in a way that reduces the time complexity. The pointers move towards each other or in a specific pattern based on the problem requirements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want to mention that two pointers doesn't overlap, and hence it is at most
4. **Repeat:** | ||
- Repeat steps 2 and 3 until the pointers meet or fulfill the problem requirements. | ||
|
||
## Common Use Cases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please give specific details on how you use 2-pointers to solve each of the followings. You should assume people who are reading this doesn't know how 2-pointers works beforehand.
Preview the changes for PR #1207 (for commit e547697) at https://gh.cp-algorithms.com/1207/. |
No description provided.