1 Star 0 Fork 0

4叶草/MyLeetCode

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
Code41.java 500 Bytes
Copy Edit Raw Blame History
sunzuhan authored 2015-05-20 08:25 +08:00 . leetcode from pc
package code;
import java.util.HashSet;
import java.util.Set;
public class Code41 {
public int firstMissingPositive(int[] nums) {
int i,j;
Set<Integer> has=new HashSet<Integer>();
int n=nums.length;
for(i=0;i<n;i++){
has.add(nums[i]);
}
int min=1;
while(has.contains(min)){
min++;
}
return min;
}
public static void main(String[] args){
int[] A={2};
System.out.println(new Code41().firstMissingPositive(A));
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/4clover/MyLeetCode.git
git@gitee.com:4clover/MyLeetCode.git
4clover
MyLeetCode
MyLeetCode
master

Search