Ad
  • Default User Avatar

    That's quite allright, no problem at all :) Yes, from a competitive standpoint, this definitely takes way too much time to write!

  • Default User Avatar

    Can you articulate why? :)

    The fact that it is much longer than other solutions does not make it inefficient, and especially not bad code. Multi-layered ternary operators in a single line may be more clever, but not "better"(see note in the bottom). In fact I think my code is exceptionally readable, though others are free to disagree. As for efficiency, we could debate it, but the use case is a grid of 12 elements, so it is quite pointless.

    Note: I do not believe that there is a general definition of better. Sometimes time complexity is paramount, other times space complexity, yet other times developer time/maintainability/extendability are way more important.