Programming Questions

  • Newest
  • Popular Tags
  • Ask A Question
  • SecondGreatLow instructions not clear
    One of the test cases being run on this code is ([80, 80]) and it says that the correct answer is "80 80". This seems completely wrong given the wording of the instructions. It asks for the second lowest and second greatest. If there is only one value being presented (i.e. the value of 80 being presented twice), then logically there is no second greatest and second lowest number. There is only one number, and it is the greatest and lowest number. This is also reinforced in the wording of the question when they say that given the array [7, 7, 12, 98, 102] we must disregard one of the 7's in the solution. We aren't looking for the second lowest and second greatest position in the array, but the second greatest and second lowest value in the array. It seems like one or the other must be the case, but not both. I think this should be corrected.
    eraserface asked this question on 8/4/17 | second, great, low, javascript
    Answers
  • +
  • 0
  • -
  • The question did say hat it could get tricky when there are only two elements in the array. I guess that was meant to indicate that you can't ignore thetop/low duplicates in that particular case.
    Login to write an answer