LeetCode 581. Shortest Unsorted Continuous Subarray - Python
581. Shortest Unsorted Continuous Subarray Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too. You need to find the shortest such subarray and output its length. Example: Input: [2, 6, 4, 8, 10, 9, 15] Output: 5 Explanation: You need to sort [6, 4, 8, 10, 9] in ascend..
2020. 9. 22.
[Python] 자료구조와 알고리즘 기초 - 재귀 알고리즘, 동적 계획법, 연결리스트, 스택, 큐, 이진트리
Contents 선형 배열(Linear Array) 정렬(Sort) 탐색(Search) 재귀 알고리즘 동적계획법 연결리스트 양방향 연결리스트 스택 큐 환형큐 우선순위 큐 이진 트리 이진 탐색 트리 힙 선형 배열(Linear Array) #Python 리스트에 활용할 수 있는 연산들 (1) 리스트 길이과 관계 없이 빠르게 실행 결과를 보게되는 연산들 원소 덧붙이기 .append() 원소 하나를 꺼내기 .pop() (2) 리스트의 길이에 비례해서 실행 시간이 걸리는 연산들 원소 삽입하기 .insert() 원소 삭제하기 .del() #리스트에서 원소 찾아내기 Example 1: Input: L = [64, 72, 83, 72, 54] x = 72 Output: [1, 3] Example 2: Input: L ..
2020. 9. 12.