##限定时间复杂度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首个缺失正数的更多相关文章

  1. LeetCode python实现题解(持续更新)

    目录 LeetCode Python实现算法简介 0001 两数之和 0002 两数相加 0003 无重复字符的最长子串 0004 寻找两个有序数组的中位数 0005 最长回文子串 0006 Z字型变 ...

  2. Leetcode Python Solution(continue update)

    leetcode python solution 1. two sum (easy) Given an array of integers, return indices of the two num ...

  3. [LeetCode] First Missing Positive 首个缺失的正数

    Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0]  ...

  4. [LeetCode] 41. First Missing Positive 首个缺失的正数

    Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2, ...

  5. LeetCode(41):缺失的第一个正数

    Hard! 题目描述: 给定一个未排序的整数数组,找出其中没有出现的最小的正整数. 示例 1: 输入: [1,2,0] 输出: 3 示例 2: 输入: [3,4,-1,1] 输出: 2 示例 3: 输 ...

  6. LeetCode Python 位操作 1

    Python 位操作: 按位与 &, 按位或 | 体会不到 按位异或 ^ num ^ num = 0 左移 << num << 1 == num * 2**1 右移 & ...

  7. 【LeetCode】1413. 逐步求和得到正数的最小值 Minimum Value to Get Positive Step by Step Sum

    作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 求和 日期 题目地址:https://leetcode ...

  8. [Leetcode][Python]41: First Missing Positive

    # -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com' 41: First Missing Positivehttps://oj.le ...

  9. [LeetCode][Python]Container With Most Water

    # -*- coding: utf8 -*-'''https://oj.leetcode.com/problems/container-with-most-water/ Given n non-neg ...

随机推荐

  1. gulp自动化构建工具的使用

    gulp自动化构建工具: 把前端开发常见的处理(“搬砖”)程序,通过一个工具模块管理起来,只需配置一次,达到自动处理目的,简化开发,提高效率!! 安装: 1.全局安装(全局安装一个gulp命令) A. ...

  2. (转)AutoML for Data Augmentation

    AutoML for Data Augmentation 2019-04-01 09:26:19 This blog is copied from: https://blog.insightdatas ...

  3. Git 帮助

    Git 配置 配置 git config --global user.name "..." git config --global user.email "...&quo ...

  4. 使用卷积神经网络CNN完成验证码识别

    gen_sample_by_captcha.py 生成验证码图片 # -*- coding: UTF-8 -*- """ 使用captcha lib生成验证码(前提:pi ...

  5. [ Servlet / JSP ] J2EE Web Application 中的 JSESSIONID 是什么?

    JSESSIONID is a cookie in J2EE web application which is used in session tracking. Since HTTP is a st ...

  6. oracle 12 c 创建表空间,用户名,及表

      -----------------------------------------12C start------------------------------------------- -- 创 ...

  7. LINUX内核PCI扫描过程

    LINUX内核PCI扫描过程 内核版本 3.10.103 1. ACPI热插拔扫描subsys_initcall(acpi_init)@drivers/acpi/bus.c |-acpi_scan_i ...

  8. SQL运行优化收藏

    如何让你的SQL运行得更快(转贴) ---- 人们在使用SQL时往往会陷入一个误区,即太关注于所得的结果是否正确,而忽略了不同的实现方法之间可能存在的性能差异,这种性能差异在大型的或是复杂的数据库环境 ...

  9. 爬虫(七)图片懒加载技术、selenium和PhantomJS

    动态数据加载处理 一.图片懒加载 什么是图片懒加载? 案例分析:抓取站长素材http://sc.chinaz.com/中的图片数据 #!/usr/bin/env python # -*- coding ...

  10. post传递中文时,可以使用urlEncode编码进行转码

    http://tool.chinaz.com/tools/urlencode.aspx