Getting Top 10 Highest Numbers From Array?

后端 未结 5 1305
轮回少年
轮回少年 2021-01-24 23:00

I am having a bit of a issue. I have an NSMutableDictionary with 10 NSMutableArrays in it. Each array has somewhere between 0-10 numbers which could each be any integer, e.g. 12

5条回答
  •  一向
    一向 (楼主)
    2021-01-24 23:36

    Easiest way, is to sort the array in Descending order, and then grab the first 10 indexes

    Or if they are inside dictionaries, iterate the dictionary allValues, grab all the arrays, add all the elements inside a common array, and sort that

提交回复
热议问题