int findMagicIndex(int* nums, int numsSize){ for (int i=0; i<numsSize; i++) { if (i == nums[i]) return i; } return -1; }
【leetcode】魔术索引
原文:https://www.cnblogs.com/ganxiang/p/13705279.html