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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tusharr0305 wants to merge 1 commit into ignacio-chiazzo:master
base: master
Choose a base branch
Loading
from Tusharr0305:patch-1

Conversation

Copy link

@Tusharr0305 Tusharr0305 commented Oct 29, 2022

Added Subarray problem

Copy link
Owner

@ignacio-chiazzo ignacio-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 a specific format.

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

Thanks again for contributing.

Copy link
Collaborator

@hot9cups hot9cups 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
Copy link
Author

Okay will share 0(N) solution soon.

hot9cups reacted with thumbs up emoji

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

@ignacio-chiazzo ignacio-chiazzo ignacio-chiazzo left review comments

@hot9cups hot9cups hot9cups 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.

AltStyle によって変換されたページ (->オリジナル) /