개발자 뺚
[Cody] Problem 128. Sorted highest to lowest? 본문
Return 1 if the input is sorted from highest to lowest, 0 if not.
Example:
1:7 -> 0
[7 5 2] -> 1
function y = your_fcn_name(x)
des_x = sort(x, 'descend')
if isequal(x, des_x)
y = 1
else
y = 0
end
end
'Solution > MATLAB' 카테고리의 다른 글
[Cody] Problem 44951. Verify Law of Large Numbers (11) | 2023.08.23 |
---|---|
[Cody] Problem 44944. Convert from Fahrenheit to Celsius (0) | 2023.08.23 |
[Cody] Problem 44943. Calculate Amount of Cake Frosting (0) | 2023.08.22 |
[Cody] Problem 106. Weighted average (0) | 2023.08.22 |
[Cody] Problem 2447. Musical Note Interval 1 - Diatonic Scale (21) | 2023.08.22 |