question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong solution is accepted when submitted

See original GitHub issue

Challenge 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:closed
  • Created 7 years ago
  • Comments:22 (18 by maintainers)

github_iconTop GitHub Comments

3reactions
dhcodescommented, Jan 9, 2017

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

1reaction
systimoticcommented, Jan 12, 2017

Wow, I’m really slacking on this issue! Thanks @91aman, I updated and tested that as well.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found