Well Mr. Rifat, this is nice coding but does not fulfill the purpose. I dont know how did this solution checked as correct. Let me tell you about Toeplitz Matrix. A matrix in which all elements of main diagonal are equal and elements of other sub-diagonals parallel to main diagonal are equal. plz check this eg:a=[2 0 7 8 9;3 2 0 7 8;6 3 2 0 7;4 6 3 2 0;1 4 6 3 2]. Your coding still gives true even for non-toeplitz matrix. I'll check my reference solution again. Thanks for your time.
Sorry... I misread the definition. I thought it was only the main diagonal. I will submit another solution. Anyway.. your test suite should contain matrices to prevent such cases.
Test for balanced parentheses
It dseon't mettar waht oedrr the lrettes in a wrod are.
Generate a vector like 1,2,2,3,3,3,4,4,4,4
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office