Wrong solution is accepted when submitted
See original GitHub issueChallenge Return Largest Numbers in Arrays has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36.
The code below uses map/reduce as suggested in the medium forum (I’ve reviewed the solutions over there) and is accepted when submitted.
The problem is that there is an assumption that in every subarray not all of the values are negatives and it is not shown in the description of the problem. That is, if one of the subarray contains only negatives values, the accepted solution below isn’t correct.
My code:
function largestOfFour(arr) {
return arr.map(function(subArray) {
return subArray.reduce(function(prev, curr) {
return (curr > prev ? curr : prev);
}, 0);
});
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Issue Analytics
- State:
- Created 7 years ago
- Comments:22 (18 by maintainers)
Top Results From Across the Web
All Test Cases Accepted, but Marks me a Wrong Answer when ...
I've tested my final solution in multiple IDE's with no issues, and have only correct/expected results.
Read more >How do I dispute an error on my credit report?
To dispute an error on your credit report, contact both the credit reporting company and the company that provided the information.
Read more >Technical difficulties submitting my ESTA application
If any of the biographical information is incorrect on the existing application, the application is then invalid, and you must click "continue" ...
Read more >Resolve Application Errors - Universal Service Administrative ...
An application may result in an error that requires the consumer to submit additional documentation to the Lifeline Support Center for manual review....
Read more >How to Submit, Track and View Your Application
How to Submit, Track and View Your Application · Verified all required registrations are in place and your System for Award Management (SAM) ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@91aman in the future, please comment on the thread before working on the PR. @rajpatel507 looks like there is a PR in process at this point. I’m sure we’ll have more first-timer issues soon, or feel welcome to look at our issue backlog.
Wow, I’m really slacking on this issue! Thanks @91aman, I updated and tested that as well.