Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat:add two pointer algorithm#1207

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Harshdev098 wants to merge5 commits intocp-algorithms:main
base:main
Choose a base branch
Loading
fromHarshdev098:master

Conversation

Harshdev098
Copy link
Contributor

No description provided.

@github-actionsGitHub Actions
Copy link
Contributor

Visit the preview URL for this PR (for commitdd01e8e):

https://cp-algorithms--preview-1207-1ftu0mhq.web.app

(expires 2023-12-18T12:06:43.474286555Z)

@github-actionsGitHub Actions
Copy link
Contributor

Visit the preview URL for this PR (for commit77906fb):

https://cp-algorithms--preview-1207-1ftu0mhq.web.app

(expires 2023-12-18T12:19:11.016074097Z)

@github-actionsGitHub Actions
Copy link
Contributor

Visit the preview URL for this PR (for commit00c7ee0):

https://cp-algorithms--preview-1207-1ftu0mhq.web.app

(expires 2023-12-23T10:45:44.193696310Z)

@github-actionsGitHub Actions
Copy link
Contributor

Visit the preview URL for this PR (for commit3fb8ecc):

https://cp-algorithms--preview-1207-1ftu0mhq.web.app

(expires 2023-12-23T14:08:43.870563390Z)

@github-actionsGitHub Actions
Copy link
Contributor

Visit the preview URL for this PR (for commit00c7ee0):

https://cp-algorithms--preview-1207-1ftu0mhq.web.app

(expires 2023-12-23T14:14:03.094310265Z)

@mhayter
Copy link
Contributor

mhayter commentedDec 17, 2023
edited
Loading

I'm not a maintainer, but don't forget: when creating a new article, modify the navigation.md and README.md.

How to contribute:
https://cp-algorithms.com/contrib.html

Copy link
Contributor

@fffelix-huangfffelix-huang left a 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
Copy link
Contributor

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, orproblem 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.
Copy link
Contributor

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$O(n)$ to traverse the whole array.

4. **Repeat:**
- Repeat steps 2 and 3 until the pointers meet or fulfill the problem requirements.

## Common Use Cases
Copy link
Contributor

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.

@adamant-pwnadamant-pwn deleted the branchcp-algorithms:mainOctober 14, 2024 18:52
@adamant-pwnadamant-pwn changed the base branch frommaster tomainOctober 14, 2024 19:20
@github-actionsGitHub Actions
Copy link
Contributor

Preview the changes for PR#1207 (for commite547697) athttps://gh.cp-algorithms.com/1207/.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fffelix-huangfffelix-huangfffelix-huang left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@Harshdev098@mhayter@fffelix-huang@adamant-pwn

[8]ページ先頭

©2009-2025 Movatter.jp