Ad
  • Custom User Avatar

    Seems harder than a 6 to me due to the sheer complexity. Fixed tests should include situations that appear in the random tests like:

    • only 3 characters in a word
    • non alpha character at start or end of string
  • Custom User Avatar

    Instructions confusing. Needed to read the instructions from the leetcode website https://leetcode.com/problems/two-sum/.

  • Custom User Avatar
    var original = function original_name(a, b) { return a + b; };
    
    var cloned = o.clone();
    // cloned == function(a, b) { return a + b; }
    

    Shouldn't "o.clone()" read "original.clone()" ?

  • Custom User Avatar

    This kata relies on parsing a function's .toString() :(

    The kata is not well defined: JavaScript's parameters can contain arbritrary code that will fail all existing solutions, and whose handling would require writing a complete JavaScript engine:

    function f (param1 = function goodLuckHandling(defaultParameters) { arbitaryCode() }, [youCanAlso, [DestructureParameters]], ...andWhatAboutRestParameters) {}
    
  • Custom User Avatar

    You don't have to worry about the name of the function; it's impossible to override that property of a function.

    This is not strictly true:

    function foo() {}
    Object.defineProperty(foo, 'name', {value: 'bar'});
    console.log(foo.name); // bar
    

    though this will not make the function callable as bar() afterwards

  • Custom User Avatar
  • Custom User Avatar

    Ok, I changed it to indexes. Now, I'll go back about where is the ambiguity:

    ambiguity
    /ˌambɪˈɡjuːɪti/
    noun
    the quality of being open to more than one interpretation; inexactness.

    Now tell me, how would you interprete indices there if not as a synonym of indexes?

  • Custom User Avatar

    If it wasn't ambigous I wouldn't bother, but I did, didn't I?

    More serious though - it was just a suggestion. According to Oracle:

    "Indices" is the mathematical formulation whereas in publishing they use "indexes" (which is probably why so many people in IT consider "indices" to be more correct than "indexes").

    I think that a table index is analogous to an index in a book rather than an exponent in maths, so the publishing variant is the appropriate plural to use in this context.

    Furthermore, at least in Oracle, the data dictionary views are called DBA_INDEXES, ALL_INDEXES and USER_INDEXES. It is usually a good idea to employ the same terminology which the domain uses."

    And Microsoft:

    "Use indexes as the plural form of index. Use indices only in the context of mathematical expressions."

    I think if you can spare another person ambiguity, then its worth to at least add /indexes.

  • Custom User Avatar

    Isn't indices a plural form of index? Why do you say it's ambiguous? In the description there are two examples where you can see the arrays/lists are zero-indexed.

  • Custom User Avatar

    Your description is ambigues. Use or add 'index', instead of indices. Use programing language, not mathematical if you can help it.

  • Custom User Avatar
  • Custom User Avatar

    What does (n) represent?

  • Custom User Avatar

    You should defer calculations of sqrt as late as you can (not do it right away), trying to return as early as you can, and considering various edge cases.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
  • Loading more items...