Retired

Find the 2nd largest integer in array (retired)

327 of 1,078nakulgupta18
Description
Loading description...
Fundamentals
View
AllIssues7Questions1Suggestions1Show Resolved
  • Please sign in or sign up to leave a comment.
  • hobovsky Avatar

    This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/132.
    Please join the discussion to help us identify duplicate kata and retire them.

  • BitemNet Avatar

    Can anyone help me? Basic tests pass, random tests fail. Here is an example result:

    Random Tests
    Array = ['i', 'h', 41865, 'l', 'm', 76804, 97421, 'Y', 91768, 'F', 34449, 'p', 'D', '6', 89357, 'd', 26226, 60361, 27486, 92302]
    Log
    Input array: ['i', 'h', 41865, 'l', 'm', 76804, 97421, 'Y', 91768, 'F', 34449, 'p', 'D', '6', 89357, 'd', 26226, 60361, 27486, 92302]
    Here is my result: 92302
    Assertion OK
    Result = 92302
    

    Why is it not working? After all, I have the same result?

  • lbvf50mobile Avatar

    Added improved JS translation. Review and accept, please. Thank you.

  • lbvf50mobile Avatar

    JavaScrpit translation is ready for review. (some how this is buggy version, it dose not have JS selected. Added new well working fork

  • pragmaticLearner Avatar

    This comment has been hidden.

  • Root-Exec Avatar

    For the Python users, there is a problem with the definition of Nil...

    Nil is not a defined statement for the language. So I had the function return Nil as a string and had to change the expected in the test cases to expect "Nil" as a string. So, change the test case expected in the bottom window.

    Then, Nil isn't an expected return in the final cases, it says to expect None. So when you go to do the final tests, change the function to return None and not "Nil". None is a known statement in Python.

    Looks like there is a fork coming up for it but in the mean time you have to mess with the Kata a bit. The rest of the Kata is up to you!

  • user6235553 Avatar

    Nil is not undefined, what might be the problem here? I tried to return None,empty list and 0

  • Blind4Basics Avatar

    python:

    • sample tests: test.assert_equals(find_2nd_largest([1,1,1,1,1,1,1]), nil, 'expected nil') (lol...)
    • python 3 should be enabled. Because...
    • requirement doesn't fit the implementation:

    rejecting non integers

    tho: 1 should equal 3333333333333333333334L -> except that in python 2, that's not an integer that's a long (ok,, I'm nitpicking, here. But what's the point of having this difference only because of the outdated opython version...?)

  • john c Avatar

    My code seems to try to return 'nil' in all the right cases but "NameError: global name 'nil' is not defined" is generated. Not sure what to do about it.

  • FArekkusu Avatar

    No random tests.

  • raulbc777 Avatar

    Python translation kumited

  • Insti Avatar

    There should be a test case where the array elements are Bignums to catch people who filter on Fixnum

  • Insti Avatar

    typo in text description "hten" should be "then"

  • Insti Avatar

    Tests give no information about why they failed.