如何在Objective C中找到NSMutableArray中的最小值

use*_*001 3 math coordinate

我在NSMutableArray中有7个浮点值短路,我需要找到它们之间的最短值,我如何找到最短的值

pmk*_*pmk 8

也许这样的事情会起作用:

int k = [yourArray objectAtIndex:0];
for (unsigned i = 1; i < [yourArray count]; i++){
    if([yourArray objectAtIndex:i] < k) k = [yourArray objectAtIndex:i];
}
Run Code Online (Sandbox Code Playgroud)