The third approach is giving selective different answers than the other 2 approaches for the same matrix. Eg for a 2x3 matrix of elements:
1 2 3
4 5 6
answer from approach 1: 140
(https://ide.codingblocks.com/s/219089)
answer from approach 2: 140
answer from (this) approach 3: 90 (https://ide.codingblocks.com/s/219088)
Please check