Diagonal Difference

  • + 1 comment

    IMHO, I would preffer saying "it depends", if I had to reuse this code for some reason,it would be written as a function or a method, in this case the array would be provided as a parameter, therefore storing it is not an option, it is mandatory.

    Another scenario would be calculating the difference as part of the processing, as you've mentioned.

    But I defenitely agree that to solve this specific problem you don't need to store the information.