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

Create count_pair_with_given_sum.cpp#83

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
Tusharr0305 wants to merge1 commit intoignacio-chiazzo:master
base:master
Choose a base branch
Loading
fromTusharr0305:patch-1

Conversation

Tusharr0305
Copy link

Added Subarray problem

Copy link
Owner

@ignacio-chiazzoignacio-chiazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hey! Thanks for contributing!

This repository is only for solutions in Javascript. We are also following aspecific format.

I'd be happy to accept this problem but in Javascript.

Thanks again for contributing.

Copy link
Collaborator

@hot9cupshot9cups left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Additionally to what Ignacio mentioned, I would also request a change in the solution when you do translate to javascript.
You have an O(N^2) solution, but I believe you can achieve an O(N) solution using a Map/Dictionary that stores the frequency of every number in the array, and then traversing the map to get count of pairs.

ignacio-chiazzo reacted with thumbs up emoji
@Tusharr0305
Copy link
Author

Okay will share 0(N) solution soon.

hot9cups reacted with thumbs up emoji

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

@ignacio-chiazzoignacio-chiazzoignacio-chiazzo left review comments

@hot9cupshot9cupshot9cups requested changes

Requested changes must be addressed to merge this pull request.

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

Successfully merging this pull request may close these issues.

3 participants
@Tusharr0305@ignacio-chiazzo@hot9cups

[8]ページ先頭

©2009-2025 Movatter.jp