标签:span nbsp gpo int return amp bsp turn ssi
class Solution { public int firstMissingPositive(int[] nums) { int i=0; while(i<nums.length) { if(nums[i]>0&&nums[i]<=nums.length&&nums[i]!=nums[nums[i]-1]) { int tmp=nums[i]; nums[i]=nums[tmp-1]; nums[tmp-1]=tmp; } else i++; } for(int j=0;j<nums.length;j++) if(nums[j]!=j+1) return j+1; return nums.length+1; } }
标签:span nbsp gpo int return amp bsp turn ssi
原文地址:http://www.cnblogs.com/asuran/p/7586943.html