Ad
  • Default User Avatar

    There's no need for "innerLen". Description states: "All 2D arrays passed into your function will be square (NxN)". Therefore "innerLen" always equals to "len".

  • Custom User Avatar

    Our algorithms are the same, but a few neat hacks I added FYI:

    1. the "len" and "innerLen" variables cache the lengths of the inner and outer arrays, so they only be computed once
    2. the number 1 is truthy, so your if statement need not require the equals condition