row-th maximum row elements - MATLAB Cody - MATLAB Central

Problem 2345. row-th maximum row elements

Difficulty:Rate

Input a is a square matrix of size n*n. Output vector v is of size 1*n. The ith element of output v is the ith largest element of ith row of input matrix a. In case of a tie, take the ith member of the sorted elements.

Example:

Input:

    a=[  1 2 4; 
         4 5 5; 
         8 9 1];

Output:

v=[4 5 1]

Solution Stats

63.51% Correct | 36.49% Incorrect
Last Solution submitted on Nov 17, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...

Problem Recent Solvers42

Suggested Problems

More from this Author44

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!