Algo-Kotlin

Algorithm Training from AlgoMonster

Set up Kotlin project with Gradle in the Codespace

  1. Add a new Repository in the github
  2. Clone to Codespace and auto prepared the develop environment
  3. Add extention for Git and Kotlin
  4. Install Gradle plugin in the Terminal by commond of sdk install gradle

     $ sdk install gradle
     ==== BROADCAST =================================================================
     2022-08-22: neo4jmigrations 1.10.0 available on SDKMAN! https://github.com/michael-simons/neo4j-migrations/releases/tag/1.10.0
     2022-08-19: asciidoctorj 2.5.5 available on SDKMAN!
     2022-08-19: micronaut 3.6.1 available on SDKMAN!
     ================================================================================
     gradle 7.5.1 is already installed.
    
  5. Init the Kotlin project with gradle Building Kotlin Applications Sample
  6. Generated folder as following:

    ├── gradle 
    │   └── wrapper
    │       ├── gradle-wrapper.jar
    │       └── gradle-wrapper.properties
    ├── gradlew 
    ├── gradlew.bat 
    ├── settings.gradle 
    └── app
       ├── build.gradle 
       └── src
          ├── main
          │   └── kotlin 
          │       └── demo
          │           └── App.kt
          └── test
                └── kotlin 
                   └── demo
                      └── AppTest.kt
    

Algorithm Basic

Basic Data Structure

  1. Stack
  2. Queue
  3. Hashmap

Basic ALgorithms

  1. Sorting
  2. Advanced Sorting Algorighms
    1. Merge Sort
    2. Quick Sort

Binary Search

Overview

  1. Vanilla Binary Search
  2. Finding the Boundary

Sorted Array

  1. First Element Not Smaller than Target
  2. First Occurrence
  3. Square Root

Implicitely Sorted Array

  1. Minimum in Rotated Sorted Array
  2. Peak of Mountain Array

Advanced

  1. Capacity to Ship Packages Within D Days
  2. Newspapers

Depth First Search

Introduction

  1. Recursion Reveiw
  2. Introduction to Tree Data Struture
  3. DFS Fundamentals

DFS on Tree

  1. Introduction
  2. Max Depth of A Tree
  3. Visible Tree Node
  4. Balanced Binary Tree
  5. Serializing and Deserializing Binary Tree

Binary Search Tree

  1. Binary Search Tree Info
  2. Valid Binary Seach Tree
  3. Insert Into BST
  4. Invert Binary Tree
  5. Lowest Common Ancestor of a Binary Search Tree

Advanced

  1. Lowest Common Ancestor

Backtracking

Combinatorial Search

  1. DFS with States
  2. Backtracking Fundamentals
  3. Permutations
  4. Letter Combinations of A Phone Number

Memoization

  1. Memoization Intro
  2. Word Break
  3. Decode Ways

Pruning

  1. Pruning Introduction
  2. Palindrome Partitioning

Dedup

  1. Combination Sum

Additional Practices

  1. Subsets

Breadth First Search

Introdution

  1. BFS Fundamentals

BFS on Tree

  1. Binary Tree Level Order Traversal
  2. Binary Tree ZigZag Level Order Traversal
  3. Binary Tree Right Side View
  4. Binary Tree Min Depth

Graph

Introduction

  1. Graph Fundamentals
  2. BFS on Graphs
  3. DFS on Graphy
  4. BFS or DFS

Vanilla BFS

  1. Shortest Path

Matrix as Graph

  1. Matrix as Graph
  2. Flood Fill
  3. Number of Islands
  4. Knight Miniimum Moves
  5. Walls and Gates / Zombie in Matrix

Implicit Graph

  1. Open the Lock
  2. Word Ladder
  3. Sliding Puzzle

Directed Graph / Topological Sort

  1. Topological Sort Introduction
  2. Task Scheduling
  3. Reconstructing Sequence
  4. Task Scheduling 2
  5. Alien Dictionary
  6. Course Schedule

Weighted Graph

  1. Dijkastra’s Algorithm | Shortest Path in a Weighted Graph
  2. Uniform Cost Search | Shortest Path in a Weighted Graph

Minimum Spanning Tree

  1. Introdution to Minimum Spanning Tree
  2. Minimum Spanning Tree | Forests

Two Pointers

Introduction

  1. Two Pointers Introduction

Same Direction

  1. Remove Duplicates
  2. Middle of a Linked List
  3. Move Zeros

Opposite Direction

  1. Two Sum Sorted
  2. Valid Palindrome

Sliding Window

  1. Longest Substring without Repeating Characters
  2. Find All Anagrams in a String
  3. Minimum Window Substring

Prefix Sum

  1. Subarray Sum

Cycle Finding

  1. Linked List Cycle

Advanced

  1. Get the Maximum Score
  2. Trapping Rain Water

Priority Queue / Heap

Instrodution

  1. Heap Fundamentals

Top K

  1. K Closest points
  2. Merge K Sorted Lists
  3. Kth Largest ELement in an Array
  4. Kth Smallest Eletment in a Sorted Matrix

Moving Best

  1. Reorganze String
  2. Ugly Number

Multiple Heaps

  1. Median of Data Stream

Dynamic Programming

Introdution

  1. Dynamic Programming Introduction

Knapsack

  1. Knapsack, Weight-Only
  2. Partion to Two Equal Sum Subsets
  3. Triangle

Coin Change

  1. Coin Change
  2. Coin Change 2

Grid

  1. Number of Robots Paths
  2. Minimal Path Sum
  3. Maximal Square

Dynamic number of subproblems

  1. Longest Increasing Subsquences
  2. Russian Doll Envelopes
  3. Largest Divisible Subset
  4. Perfect Squares

Game Theory

  1. Divisor Game

interval

  1. Interval Dynamic Programming | Coin Game
  2. Festival Game

Two Sequences

  1. Longest Common Subsquence
  2. Edit Distance
  3. Delete String

0-1 Knapsack

  1. 0-1 Knapsack

Bitmask

  1. Bitmask Introduction
  2. Min Cost to Visit Every Node

Advanced Data Structures

Dsijoint Set Union | Union Find

  1. DSU/Union Find Fundamentals
  2. DSU Introduction Problem
  3. Size of Connect Components
  4. Umbristan | Reverse Union Find
  5. Merge User Accounts
  6. Number of Connected Components

Trie

  1. Trie Introduction
  2. Autocomplete
  3. Prefix Count

Data Structure Design

  1. LRU Cache

Segment Tree

  1. Segment Tree
  2. Range max

GitHub

View Github