Step 1 – Launch the HackerRank Website and “Sign In”. Ref: https://www.hackerrank.com/

Step 2 – Click into “Continue Preparation” under Problem Solving. Choose “Diagonal Difference” Challenge.

Step 3 – Read the Instructions Carefully.
Change the Programming Language to Python 3.

Step 4 – List the Requirements and Constraints in a Notepad/Drawing board in simple words. Learn to take notes.

For this problem, it is best to draw it out to visualise what it is asking you to solve.
You are supposed to ensure the diagonal columns of the grid is extracted for adding up.
The first and second diagonals’ sum of numbers will be subtracted against each other.
Due to the requirement of absolute difference, we only take the absolute value of the result of the subtraction. The positive or negative aspect of the diagonals’ sum is not a concern.
Step 5 – Convert What You Understand of the Requirements and Constraints into code.
Convert the logic into code as below’s screenshoot.
Note that it was declared initially that arr was listed in Functional Description as an array of integer.

Step 6 – Click “Run Code” to Test Your Code. Do Note if you submit code with errors, you will lose points. So “Run Code” first to ensure everything works.

Step 7 – Once you have tested that your code works, “Submit Code” to clear the challenge and earn some Hacker points.
