Algorithms

Algorithms

Simple Array Sum

 

Compare the Triplets

 

Diagonal Difference

Sample Input

Sample Output

 

Explanation

The primary diagonal is:
11
5
-12

Sum across the primary diagonal: 11 + 5 – 12 = 4

The secondary diagonal is:
4
5
10
Sum across the secondary diagonal: 4 + 5 + 10 = 19
Difference: |4 – 19| = 15


 
 staircase

 
Time Conversion

 
 Circular Array Rotation