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

max-product-of-3-numbers error throw #28

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

Merged
ashokdey merged 2 commits into master from max-product-of-3-numbers
Oct 4, 2019
Merged

Conversation

Copy link
Member

@TheSTL TheSTL commented Oct 4, 2019

Changes:

  • Throw error if array length less than 3.

Copy link
Member

@ashokdey ashokdey left a comment

Choose a reason for hiding this comment

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

Please have a look at comment for change.

@@ -9,7 +9,7 @@

/** The following solution is O(nlogn) because of sorting */
function maxProductof3Numbers(arr) {
if (!Array.isArray(arr)) {
if (!Array.isArray(arr) || arr.length <= 2) {
Copy link
Member

@ashokdey ashokdey Oct 4, 2019

Choose a reason for hiding this comment

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

Can't it be arr.length < 3 ? 😕

Copy link
Member Author

TheSTL commented Oct 4, 2019

Changes are implemented.

Copy link
Member

@ashokdey ashokdey left a comment

Choose a reason for hiding this comment

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

👍

@ashokdey ashokdey merged commit 15cf252 into master Oct 4, 2019
@ashokdey ashokdey deleted the max-product-of-3-numbers branch October 4, 2019 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@ashokdey ashokdey ashokdey approved these changes

Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

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