Company: ebay

Difficulty: medium

Problem Statement

Matrix Diagonal Sorting You are given an n by n matrix of lowercase letters. For each diagonal whose cells have the same `row + column`, read it from bottom-left to top-right. Repeat that diagonal cyclically until its length is n. Sort these 2n-1 constructed strings lexicographically and print their diagonal indices in sorted order. Input Format The first line contains n. The next n lines each contain n lowercase letters. Output Format Print the sorted diagonal indices, separated by spaces. Constraints - 1 <= n <= 500

More ebay OA questionsInterview experiences