← Morgan Stanley questions
CodingEasyReported in a candidate post, Jul 2025

Sum of squares of diagonal elements

Filed under Morgan Stanley

Given a square 2D matrix of integers, calculate the sum of the squares of all elements located on both the primary diagonal (from top-left to bottom-right) and the secondary diagonal (from top-right…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Morgan Stanley questions

Collected from public candidate posts and coding forums. Updated Nov 2026.