Python Algorithms Training Advanced

Python Algorithms Training Advanced

written by sean base on following site
https://github.com/xuelangZF/LeetCode
_images/chapter0_4.png _images/chapter0_5.png

Github | https://github.com/newsteinking/High_pythonalgorithms_training_advanced

Chapter 0: About

Python Algorithms Advanced Curriculm

_images/chapter0_5.png

Thanks to

잠시나마 오픈소스에 대한 희망을 안겨주었던 멤버들에게 감사의 마음을 전합니다.
다들 다른곳에서 각자 열심히 일하는데 모두들 건승하길 바랍니다.

.

  • sean
  • Mr Ju SS
  • OSS Members

SEAN's Paradise

I think that My Life as Software Engineer was torrible , but it's role for social is important so, I keep going for better life & software development

chapter 1: Array

26. Remove Duplicated From Sorted Array

Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.

Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.

Example 1:

Given nums = [1,1,2],

Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively.

It doesn't matter what you leave beyond the returned length. Example 2:

Given nums = [0,0,1,1,1,2,2,3,3,4],

Your function should return length = 5, with the first five elements of nums being modified to 0, 1, 2, 3,

and 4 respectively.

It doesn't matter what values are set beyond the returned length.

#! /usr/bin/env python
# -*- coding: utf-8 -*-


class Solution(object):
    def removeDuplicates(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        if not nums:
            return 0

        removed_end = 0
        for i in range(1, len(nums)):
            if nums[i] != nums[removed_end]:
                removed_end += 1
                nums[removed_end] = nums[i]

        return removed_end + 1

"""
[]
[1,1,2,2,3]
[1,3,5,8,9,9,9]
"""

27. Remove Element


31. Next Permutation


41. First Missing Positive


54. Spiral Matrix


57. Insert Interval


59. Spiral Matrix 2


73. Set Matrix Zeroes


118. Pascal Triange


119. Pascal Triangel 2


164. Maximum Gap


189. Rotate Array


228. Summary Ranges


283. Move Zeroes


289. Game of Life


chapter 2: Backtracking

2.1 Bitmask

chapter 3: BinarySearch

3.1 Stack

3.2 Queue

3.3 Double Linked List

3.4 Deque

chapter 4: BitManipulation

4.1 Linear Probing

4.2 Quadratic Probing

4.3 Double Hashing

4.4 Seperate Chaining

chapter 6: Combination

6.1 Laziness is a Virtue

chapter 8: DFA

8.1 Undirected/Unweighted

8.2 Undirected/Weighted

8.3 Directed/Unweighted

8.4 Directed/Weighted

chapter 9: Divide Conquer

9.1 Union-Find DISJOINT SETS(UFDS)

chapter 10: Dynamic Programming

10.1 MIN Segment Tree

10.2 MAX Segment Tree

10.3 SUM Segment Tree

chapter 11: Graph

11.1 Fenwick Tree(Point Update Range Query)

11.2 Fenwick Tree(RU PG)

11.3 Fenwick Tree(RU RQ)

chapter 12: Greedy

12.1 Recursion Tree

12.2 URecursion DAG(DP)

chapter 13: HashTable

13.1 Graph Traversal(DFS/BFS)

chapter 14: Heap

14.1 MIN Spanning Tree

14.5 A Quick Summary

chapter 15: Linked List

15.1 Single Source Shortest Paths

chapter 16: Math

16.1 MAX Flow/MIN CUT

chapter 17: Others

17.1 (Unweighted Bipartite)Graph Matching

17.2 (Unweighted General)Graph Matching

chapter 18: Recursion

18.1 Floyd's Tortoise-Hare Cycle-Finding

chapter 19: Stack

19.1 Suffix Tree

chapter 20: String

20.1 Suffix Array

chapter 21: ToBeOptimized

21.1 Computational Geometery(POLYGON)

chapter 22: Tree

22.1 Convex Hull

chapter 23: Two Pointers

23.1 Unweighted Min Vertex Cover

23.2 Weighted Min Vertex Cover