Programming Questions

  • Newest
  • Popular Tags
  • Ask Question
  • Discrepancy between my results and Coderbyte results?
    I just completed challenge 19 with JavaScript (Second GreatLow). My code returns three incorrect test cases. When I try the incorrect test cases on my end, the results are correct (or at least I assume so). Can someone help me address the problem? function SecondGreatLow(arr) { var sorted = arr.sort(function(a,b){return a-b}); console.log(sorted); if(sorted.length == 2) { console.log(sorted[0] + " " + sorted[1]); return sorted[0] + " " + sorted[1]; } else if (sorted.length < 2) { return false; } else { console.log(sorted[1] + " " + sorted[sorted.length-2]); return sorted[1] + " " + sorted[sorted.length-2]; } } SecondGreatLow([2,2,2,5,5,5,6]) Incorrect test cases: 1. When the input was (2,2,2,5,5,5,6) your output was incorrect. 2. When the input was (90, 23) your output was incorrect. 3. When the input was (7, 7, 90, 1000003) your output was incorrect.
    cassac posted this question on 4/22/14 | javascript
    Answers
  • +
  • 3
  • -
  • I think there's some bugginess in the Coderbyte system. I have been working through problems in Ruby and I will run the problem on my own machine and get the identical output to the target answer, but Coderbyte gives me an error message and can't parse some bit of my program. I love the exercises here, but I'm taking the success rating with a grain of salt.
  • +
  • 2
  • -
  • Hi cassac, in 1st and 3rd test cases you forget to remove duplicate values from array. Your results are: 1st: "2 5" -> should be "5 5" 3rd: "7 90" -> should be "90 90" The 2nd test case: Your output is in reverse order. (Remember, first number in output is the second lowest of input)
  • +
  • 2
  • -
  • Same issue than @Philippz in java, with basical challenges (1 and 2)... and I'm not a beginner. So what's going on? The Codersystem is not working? Is that a new challenge? ;-)
  • +
  • 0
  • -
  • I also have these problem in my first atempt...
  • +
  • 0
  • -
  • I have experienced same with Javascript "power of two" task
  • +
  • 0
  • -
  • The same thing is happening to me in JavaScript with the LetterChanges function. I think I'm just going to move on from it though and do a check for myself for future problems. I've spent way too much time on trying to figure this out already.
    Log in to write an answer.