missingintegers python personal notes

missingintegers

Of course, if you do it normally, it will be returned with N ** 2. So, it seems to be the usual way, but I will make a flag and set it cumulatively. And one lap + the last judgment (live in size (N))

def solution(A):
    A = sorted(A)
    B = [i for i in A if (0 < i) and (i <= len(A))]
    tester = [0] * len(A)
    for i in B:
        tester[i-1] +=1
    try:
        return tester.index(0) + 1
    except:
        return len(B)+1

Recommended Posts

missingintegers python personal notes
python personal notes
[Personal notes] Python, Django
Personal notes for python image processing
Python Pandas Data Preprocessing Personal Notes
(Personal notes) Python metaclasses and metaprogramming
Python scraping notes
Python study notes _000
Python learning notes
Python beginner notes
Python study notes_006
python C ++ notes
Python study notes _005
Python grammar notes
Python Library notes
Python personal Q.A
python pandas notes
Python study notes_001
python learning notes
Python3.4 installation notes
WEB scraping with Python (for personal notes)
Python package development notes
Personal notes to doc Python code in Sphinx
Python memorandum (personal bookmark)
python decorator usage notes
Python ipaddress package notes
Python Pickle format notes
[Python] pytest-mock Usage notes
First Python miscellaneous notes
Matlab => Python migration notes
Notes around Python3 assignments
Notes using Python subprocesses
Python try / except notes
Python framework bottle notes
Manipulate excel files from python with xlrd (personal notes)
Python notes using perl-ternary operator
Python3 programming functions personal summary
O'Reilly python3 Primer Learning Notes
Web scraping notes in python3
Python standard unittest usage notes
Python notes to forget soon
python * args, ** kwargs Usage notes
Python notes using perl-special variables
Python 處 處 regular expression Notes
Python Tkinter notes (for myself)
[Python] Notes on data analysis
[Python] Decision Tree Personal Tutorial
Python data analysis learning notes
Notes on installing Python on Mac
[AtCoder] ABC165C Personal Note [Python]
Get Evernote notes in Python
Notes on installing Python on CentOS
Notes on Python and dictionary types
Python
Minimum grammar notes for writing Python
[Personal memo] Python virtual environment command memo
Notes on using MeCab from Python
Laplacian eigenmaps with Scikit-learn (personal notes)
Python package management tool personal summary
Git & Github & python & VScode Personal memorandum
Typing automation notes by Python beginners