first Missing Positive number
来源:互联网 发布:java下载 编辑:程序博客网 时间:2024/05/01 19:14
classSolution {
public:
int firstMissingPositive(intA[],intn) {
for (int index = 0; index<n; index++)
{
while (A[index]>0 && A[index] != index + 1 && A[index] <= n && A[index] != A[A[index] - 1])
{
int temp = A[index];
A[index] = A[temp - 1];
A[temp - 1] = temp;
}
}
for (int index = 0; index<n; index++)
{
if (A[index] != index + 1) return index + 1;
}
returnn + 1;
}
};
0 0
- first Missing Positive number
- LeetCode:Missing Number And First Missing Positive
- leetcode 41|268. First Missing Positive 268. Missing Number
- python求解LeetCode习题Find the First Missing Positive Number
- LeetCode: First Missing Positive
- LeetCode First Missing Positive
- LeetCode: First Missing Positive
- [Leetcode] First Missing Positive
- leetcode12: First Missing Positive
- First Missing Positive
- [LeetCode] First Missing Positive
- [Leetcode] First Missing Positive
- leetcode First Missing Positive
- LeetCode First Missing Positive
- [leetcode] first missing positive
- First Missing Positive
- LeetCode: First Missing Positive
- First Missing Positive
- 一个国内的 ngrok 服务器
- HDU2444 The Accomodation of Students(二分匹配 匈牙利算法)
- Practical C Programming - Chapter 9
- 如何导入frm格式MYD格式MYI格式文件到MySQL中
- oracle 中的translate函数
- first Missing Positive number
- IOS缓存基本知识和清除缓存的方法
- mapreduce编程:求平均值
- QueryBuilder: A Simple Way to Read and Write Query Strings
- highCharts+ajax+json+ashx混合图形动态生成
- iOS开发中的多线程
- android设备判断网络连接状态
- JS解析json数据[转]
- vs自动注释add-in插件编写(一)--辅助函数