leetcode python 041首个缺失正数
##限定时间复杂度O(n)
num=[0,5,3,1,2,-2,4,8,5,6]
num=set(num)
d=1
for i in range(1,len(num)+1):
if d in num:
d+=1
else:
break
print(d)
leetcode python 041首个缺失正数的更多相关文章
- LeetCode python实现题解(持续更新)
目录 LeetCode Python实现算法简介 0001 两数之和 0002 两数相加 0003 无重复字符的最长子串 0004 寻找两个有序数组的中位数 0005 最长回文子串 0006 Z字型变 ...
- Leetcode Python Solution(continue update)
leetcode python solution 1. two sum (easy) Given an array of integers, return indices of the two num ...
- [LeetCode] First Missing Positive 首个缺失的正数
Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] ...
- [LeetCode] 41. First Missing Positive 首个缺失的正数
Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2, ...
- LeetCode(41):缺失的第一个正数
Hard! 题目描述: 给定一个未排序的整数数组,找出其中没有出现的最小的正整数. 示例 1: 输入: [1,2,0] 输出: 3 示例 2: 输入: [3,4,-1,1] 输出: 2 示例 3: 输 ...
- LeetCode Python 位操作 1
Python 位操作: 按位与 &, 按位或 | 体会不到 按位异或 ^ num ^ num = 0 左移 << num << 1 == num * 2**1 右移 & ...
- 【LeetCode】1413. 逐步求和得到正数的最小值 Minimum Value to Get Positive Step by Step Sum
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 求和 日期 题目地址:https://leetcode ...
- [Leetcode][Python]41: First Missing Positive
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com' 41: First Missing Positivehttps://oj.le ...
- [LeetCode][Python]Container With Most Water
# -*- coding: utf8 -*-'''https://oj.leetcode.com/problems/container-with-most-water/ Given n non-neg ...
随机推荐
- 软件测试4gkd
一.性能测试有几种类型,它们之间什么关系? (1)性能测试包括:负载测试.压力测试.配置测试.并发测试.容量测试.可靠性测试.失败测试. 负载测试:通过逐渐增加系统的负载,测试系统性能的变化,并最终确 ...
- python第一天2.28
2019年2月28日 今日内容大纲: 01 cpu 内存 硬盘 操作系统 CPU:中央处理器,相当于人大脑. 运行速度:飞机 内存:临时存储数据. 8g,16g, 运行速度:高铁 1,成 ...
- 软考自查:UML建模
UML建模 内容提要 用例图 类图与对象图 顺序图 活动图 状态图 通信图 构件图 用例图 包含关系 扩展关系 泛化关系 类图与对象图 填类名,方法名,属性名 填多重度 填关系 1: ...
- ASP.NET MVC 访问静态文件
When use asp.net MVC, we can add a special route to access the image files. the code like below: 1. ...
- JavaScript 随意记
js 志异: <script> // ----- 1 --------- alert(new Date()) alert(+new Date()) </script>
- conda命令简单使用
Anaconda是一种Python语言的免费增值开源发行版,用于进行大规模数据处理.预测分析,和科学计算,致力于简化包的管理和部署.Anaconda使用软件包管理系统Conda进行包管理. 1.查看系 ...
- HDU 6521 Party
6521 思路: 线段树玄学剪枝, 俗称吉司机线段树. 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize ...
- MySQL 存储过程参数
MySQL 存储过程参数 MySQL存储过程参数简介 在现实应用中,开发的存储过程几乎都需要参数.这些参数使存储过程更加灵活和有用. 在MySQL中,参数有三种模式:IN,OUT或INOUT. IN ...
- Active Record Query Interface 数据查询接口(界面) 看到第8节。
http://guides.rubyonrails.org/active_record_querying.html ✅How to find records using a variety of me ...
- vue使用webapck的最基本最简单的开发环境配置
这个配置生成出来的代码只能支持ES6的浏览器下正常显示. npm init -y npm install vue-loader vue-template-compiler vue-style-load ...