diff --git a/.circleci/config.yml b/.circleci/config.yml
index b1020b09b..f711b60c1 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -9,7 +9,7 @@ jobs:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- - image: cimg/openjdk:11.0.19
+ - image: cimg/openjdk:21.0.2
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000..7af8a4f3d
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,11 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: "maven" # See documentation for possible values
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "weekly"
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index a5ee5eb3e..9ccc8fc42 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -15,50 +15,66 @@ on:
push:
branches: [ "main" ]
pull_request:
- # The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- - cron: '42 8 * * 6'
+ - cron: '18 1 * * 2'
+permissions: read-all
jobs:
analyze:
name: Analyze
- runs-on: ubuntu-latest
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
+ # - https://gh.io/supported-runners-and-hardware-resources
+ # - https://gh.io/using-larger-runners
+ # Consider using larger runners for possible analysis time improvements.
+ runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
+ timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
+ # required for all workflows
+ security-events: write
+
+ # only required for workflows in private repositories
actions: read
contents: read
- security-events: write
strategy:
fail-fast: false
matrix:
- language: [ 'java' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
- # Use only 'java' to analyze code written in Java, Kotlin or both
- # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
+ language: [ 'java-kotlin', 'javascript-typescript', 'python' ]
+ # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
+ # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
+ # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ cache: 'gradle'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@v2
+ uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
- # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@v2
+ uses: github/codeql-action/autobuild@v3
# âšī¸ Command-line programs to run using the OS shell.
# đ See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -71,6 +87,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 20065480c..82af099dc 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -17,17 +17,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: 0
- - name: Set up JDK 11
- uses: actions/setup-java@v3
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- name: Cache SonarCloud packages
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
@@ -44,14 +44,14 @@ jobs:
runs-on: windows-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: 0
- - name: Set up JDK 11
- uses: actions/setup-java@v3
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- name: Build with Gradle
run: ./gradlew test --no-daemon
@@ -62,14 +62,14 @@ jobs:
runs-on: macOS-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: 0
- - name: Set up JDK 11
- uses: actions/setup-java@v3
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- name: Build with Gradle
run: chmod +x gradlew && ./gradlew test --no-daemon
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
deleted file mode 100644
index 3a1d55781..000000000
--- a/.github/workflows/scorecard.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-# This workflow uses actions that are not certified by GitHub. They are provided
-# by a third-party and are governed by separate terms of service, privacy
-# policy, and support documentation.
-
-name: Scorecard supply-chain security
-on:
- # For Branch-Protection check. Only the default branch is supported. See
- # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
- branch_protection_rule:
- # To guarantee Maintained check is occasionally updated. See
- # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
- schedule:
- - cron: '15 18 * * 1'
- push:
- branches: [ "main" ]
-
-# Declare default permissions as read only.
-permissions: read-all
-
-jobs:
- analysis:
- name: Scorecard analysis
- runs-on: ubuntu-latest
- permissions:
- # Needed to upload the results to code-scanning dashboard.
- security-events: write
- # Needed to publish results and get a badge (see publish_results below).
- id-token: write
- # Uncomment the permissions below if installing in a private repository.
- # contents: read
- # actions: read
-
- steps:
- - name: "Checkout code"
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- with:
- persist-credentials: false
-
- - name: "Run analysis"
- uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
- with:
- results_file: results.sarif
- results_format: sarif
- # (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
- # - you want to enable the Branch-Protection check on a *public* repository, or
- # - you are installing Scorecard on a *private* repository
- # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
- # repo_token: ${{ secrets.SCORECARD_TOKEN }}
-
- # Public repositories:
- # - Publish results to OpenSSF REST API for easy access by consumers
- # - Allows the repository to include the Scorecard badge.
- # - See https://github.com/ossf/scorecard-action#publishing-results.
- # For private repositories:
- # - `publish_results` will always be set to `false`, regardless
- # of the value entered here.
- publish_results: true
-
- # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
- # format to the repository Actions tab.
- - name: "Upload artifact"
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
- with:
- name: SARIF file
- path: results.sarif
- retention-days: 5
-
- # Upload the results to GitHub's code scanning dashboard.
- - name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
- with:
- sarif_file: results.sarif
diff --git a/LICENSE b/LICENSE
index 050d548f6..0a3041226 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2021-2023 Valentyn Kolesnikov
+Copyright (c) 2021-2025 Valentyn Kolesnikov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index ef0364b3d..646507313 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# LeetCode-in-Kotlin
-[](https://central.sonatype.com/artifact/com.github.javadev/leetcode-in-kotlin/1.14)
+[](https://central.sonatype.com/artifact/com.github.javadev/leetcode-in-kotlin/1.37)
[ ](https://github.com/javadev/leetcode-in-kotlin/blob/main/LICENSE)
[](https://github.com/javadev/LeetCode-in-Kotlin/actions/workflows/maven.yml)
[](https://sonarcloud.io/summary/overall?id=javadev_LeetCode-in-Kotlin)
@@ -8,1841 +8,2109 @@
[](https://github.com/javadev/LeetCode-in-Kotlin)
[](https://github.com/javadev/LeetCode-in-Kotlin/fork)
-Kotlin Solution for LeetCode algorithm problems, continually updating.
+Kotlin-based LeetCode algorithm problem solutions, regularly updated.
## Installation
-Include the following in your `pom.xml` for Maven:
+To configure your Maven project, add the following code to your pom.xml file:
```xml
com.github.javadev
leetcode-in-kotlin
- 1.14
+ 1.37
...
```
-Gradle:
+Gradle configuration:
```groovy
-implementation 'com.github.javadev:leetcode-in-kotlin:1.14'
+implementation 'com.github.javadev:leetcode-in-kotlin:1.37'
```
> ["For coding interview preparation, LeetCode is one of the best online resource providing a rich library of more than 300 real coding interview questions for you to practice from using one of the 7 supported languages - C, C++, Java, Python, C#, JavaScript, Ruby."](https://www.quora.com/How-effective-is-Leetcode-for-preparing-for-technical-interviews)
##
+* [Dynamic Programming I](#dynamic-programming-i)
+* [Programming Skills I](#programming-skills-i)
+* [Programming Skills II](#programming-skills-ii)
+* [Graph Theory I](#graph-theory-i)
+* [SQL I](#sql-i)
+* [Level 1](#level-1)
* [Level 2](#level-2)
* [Udemy](#udemy)
+* [Top Interview 150](#top-interview-150)
* [Data Structure I](#data-structure-i)
* [Data Structure II](#data-structure-ii)
* [Algorithm I](#algorithm-i)
* [Algorithm II](#algorithm-ii)
* [Binary Search I](#binary-search-i)
* [Binary Search II](#binary-search-ii)
-* [Dynamic Programming I](#dynamic-programming-i)
-* [Programming Skills I](#programming-skills-i)
-* [Programming Skills II](#programming-skills-ii)
-* [Graph Theory I](#graph-theory-i)
-* [SQL I](#sql-i)
-* [Level 1](#level-1)
-### Level 2
+### Dynamic Programming I
-#### Day 1 Implementation/Simulation
+#### Day 1
| | | | | |
|-|-|-|-|-|-
-| 0202 |[Happy Number](src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt)| Easy | Top_Interview_Questions, Hash_Table, Math, Two_Pointers | 261 | 45.08
-| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_Interview_Questions, Array, Matrix, Simulation | 224 | 62.50
-| 1706 |[Where Will the Ball Fall](src/main/kotlin/g1701_1800/s1706_where_will_the_ball_fall/Solution.kt)| Medium | Array, Dynamic_Programming, Depth_First_Search, Matrix, Simulation | 270 | 67.86
+| 0509 |[Fibonacci Number](src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Recursion, Memoization | 139 | 82.72
+| 1137 |[N-th Tribonacci Number](src/main/kotlin/g1101_1200/s1137_n_th_tribonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Memoization, LeetCode_75_DP/1D | 122 | 69.35
-#### Day 2 String
+#### Day 2
| | | | | |
|-|-|-|-|-|-
-| 0014 |[Longest Common Prefix](src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt)| Easy | Top_Interview_Questions, String | 209 | 88.86
-| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation | 390 | 56.25
+| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization, Big_O_Time_O(n)_Space_O(n) | 124 | 71.98
+| 0746 |[Min Cost Climbing Stairs](src/main/kotlin/g0701_0800/s0746_min_cost_climbing_stairs/Solution.kt)| Easy | Array, Dynamic_Programming, LeetCode_75_DP/1D | 171 | 96.76
-#### Day 3 Linked List
+#### Day 3
| | | | | |
|-|-|-|-|-|-
-| 0019 |[Remove Nth Node From End of List](src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Two_Pointers, Linked_List | 180 | 91.58
-| 0234 |[Palindrome Linked List](src/main/kotlin/g0201_0300/s0234_palindrome_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Two_Pointers, Stack, Linked_List, Recursion | 641 | 79.53
+| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, LeetCode_75_DP/1D, Big_O_Time_O(n)_Space_O(n) | 156 | 92.24
+| 0213 |[House Robber II](src/main/kotlin/g0201_0300/s0213_house_robber_ii/Solution.kt)| Medium | Array, Dynamic_Programming | 257 | 59.62
+| 0740 |[Delete and Earn](src/main/kotlin/g0701_0800/s0740_delete_and_earn/Solution.kt)| Medium | Array, Hash_Table, Dynamic_Programming | 192 | 100.00
-#### Day 4 Linked List
+#### Day 4
| | | | | |
|-|-|-|-|-|-
-| 0328 |[Odd Even Linked List](src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt)| Medium | Top_Interview_Questions, Linked_List | 216 | 86.96
-| 0148 |[Sort List](src/main/kotlin/g0101_0200/s0148_sort_list/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Sorting, Two_Pointers, Linked_List, Divide_and_Conquer, Merge_Sort | 820 | 61.70
+| 0055 |[Jump Game](src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Greedy, Big_O_Time_O(n)_Space_O(1) | 332 | 89.35
+| 0045 |[Jump Game II](src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Greedy, Big_O_Time_O(n)_Space_O(1) | 208 | 93.37
-#### Day 5 Greedy
+#### Day 5
| | | | | |
|-|-|-|-|-|-
-| 2131 |[Longest Palindrome by Concatenating Two Letter Words](src/main/kotlin/g2101_2200/s2131_longest_palindrome_by_concatenating_two_letter_words/Solution.kt)| Medium | Array, String, Hash_Table, Greedy, Counting | 607 | 90.00
-| 0621 |[Task Scheduler](src/main/kotlin/g0601_0700/s0621_task_scheduler/Solution.kt)| Medium | Array, Hash_Table, Sorting, Greedy, Heap_Priority_Queue, Counting | 266 | 98.36
+| 0053 |[Maximum Subarray](src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Divide_and_Conquer, Big_O_Time_O(n)_Space_O(1) | 510 | 78.81
+| 0918 |[Maximum Sum Circular Subarray](src/main/kotlin/g0901_1000/s0918_maximum_sum_circular_subarray/Solution.kt)| Medium | Array, Dynamic_Programming, Divide_and_Conquer, Queue, Monotonic_Queue | 339 | 86.96
-#### Day 6 Tree
+#### Day 6
| | | | | |
|-|-|-|-|-|-
-| 0226 |[Invert Binary Tree](src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 233 | 54.90
-| 0110 |[Balanced Binary Tree](src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree | 310 | 63.63
+| 0152 |[Maximum Product Subarray](src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Big_O_Time_O(N)_Space_O(1) | 253 | 88.42
+| 1567 |[Maximum Length of Subarray With Positive Product](src/main/kotlin/g1501_1600/s1567_maximum_length_of_subarray_with_positive_product/Solution.kt)| Medium | Array, Dynamic_Programming, Greedy | 468 | 33.33
-#### Day 7 Tree
+#### Day 7
| | | | | |
|-|-|-|-|-|-
-| 0543 |[Diameter of Binary Tree](src/main/kotlin/g0501_0600/s0543_diameter_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree | 307 | 43.93
-| 0437 |[Path Sum III](src/main/kotlin/g0401_0500/s0437_path_sum_iii/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree | 403 | 54.12
+| 1014 |[Best Sightseeing Pair](src/main/kotlin/g1001_1100/s1014_best_sightseeing_pair/Solution.kt)| Medium | Array, Dynamic_Programming | 336 | 66.67
+| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Big_O_Time_O(N)_Space_O(1) | 609 | 94.06
+| 0122 |[Best Time to Buy and Sell Stock II](src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt)| Medium | Top_Interview_Questions, Array, Dynamic_Programming, Greedy | 197 | 95.10
-#### Day 8 Binary Search
+#### Day 8
| | | | | |
|-|-|-|-|-|-
-| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix | 290 | 40.17
-| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search | 184 | 86.08
+| 0309 |[Best Time to Buy and Sell Stock with Cooldown](src/main/kotlin/g0301_0400/s0309_best_time_to_buy_and_sell_stock_with_cooldown/Solution.kt)| Medium | Array, Dynamic_Programming | 272 | 73.33
+| 0714 |[Best Time to Buy and Sell Stock with Transaction Fee](src/main/kotlin/g0701_0800/s0714_best_time_to_buy_and_sell_stock_with_transaction_fee/Solution.kt)| Medium | Array, Dynamic_Programming, Greedy, LeetCode_75_DP/Multidimensional | 417 | 90.91
-#### Day 9 Binary Search Tree
+#### Day 9
| | | | | |
|-|-|-|-|-|-
-| 0108 |[Convert Sorted Array to Binary Search Tree](src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt)| Easy | Top_Interview_Questions, Array, Tree, Binary_Tree, Binary_Search_Tree, Divide_and_Conquer | 334 | 35.39
-| 0230 |[Kth Smallest Element in a BST](src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 393 | 33.33
-| 0173 |[Binary Search Tree Iterator](src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt)| Medium | Tree, Binary_Tree, Stack, Design, Binary_Search_Tree, Iterator | 563 | 46.91
+| 0139 |[Word Break](src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Dynamic_Programming, Trie, Memoization, Big_O_Time_O(M+max\*N)_Space_O(M+N+max) | 197 | 87.17
+| 0042 |[Trapping Rain Water](src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Two_Pointers, Stack, Monotonic_Stack, Big_O_Time_O(n)_Space_O(1) | 189 | 99.37
-#### Day 10 Graph/BFS/DFS
+#### Day 10
| | | | | |
|-|-|-|-|-|-
-| 0994 |[Rotting Oranges](src/main/kotlin/g0901_1000/s0994_rotting_oranges/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 164 | 82.95
-| 0417 |[Pacific Atlantic Water Flow](src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 319 | 100.00
+| 0413 |[Arithmetic Slices](src/main/kotlin/g0401_0500/s0413_arithmetic_slices/Solution.kt)| Medium | Array, Dynamic_Programming | 156 | 100.00
+| 0091 |[Decode Ways](src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt)| Medium | Top_Interview_Questions, String, Dynamic_Programming | 148 | 79.07
-#### Day 11 Graph/BFS/DFS
+#### Day 11
| | | | | |
|-|-|-|-|-|-
-| 0210 |[Course Schedule II](src/main/kotlin/g0201_0300/s0210_course_schedule_ii/Solution.kt)| Medium | Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Graph, Topological_Sort | 266 | 96.32
-| 0815 |[Bus Routes](src/main/kotlin/g0801_0900/s0815_bus_routes/Solution.kt)| Hard | Array, Hash_Table, Breadth_First_Search | 429 | 100.00
+| 0264 |[Ugly Number II](src/main/kotlin/g0201_0300/s0264_ugly_number_ii/Solution.kt)| Medium | Hash_Table, Dynamic_Programming, Math, Heap_Priority_Queue | 182 | 95.45
+| 0096 |[Unique Binary Search Trees](src/main/kotlin/g0001_0100/s0096_unique_binary_search_trees/Solution.kt)| Medium | Dynamic_Programming, Math, Tree, Binary_Tree, Binary_Search_Tree, Big_O_Time_O(n)_Space_O(1) | 116 | 92.31
-#### Day 12 Dynamic Programming
+#### Day 12
| | | | | |
|-|-|-|-|-|-
-| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 156 | 92.24
-| 0322 |[Coin Change](src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Breadth_First_Search | 332 | 50.68
+| 0118 |[Pascal's Triangle](src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 277 | 33.22
+| 0119 |[Pascal's Triangle II](src/main/kotlin/g0101_0200/s0119_pascals_triangle_ii/Solution.kt)| Easy | Array, Dynamic_Programming | 157 | 97.27
-#### Day 13 Dynamic Programming
+#### Day 13
| | | | | |
|-|-|-|-|-|-
-| 0416 |[Partition Equal Subset Sum](src/main/kotlin/g0401_0500/s0416_partition_equal_subset_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming | 204 | 98.82
-| 0152 |[Maximum Product Subarray](src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 253 | 88.42
+| 0931 |[Minimum Falling Path Sum](src/main/kotlin/g0901_1000/s0931_minimum_falling_path_sum/Solution.kt)| Medium | Array, Dynamic_Programming, Matrix | 201 | 84.21
+| 0120 |[Triangle](src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt)| Medium | Array, Dynamic_Programming | 194 | 97.87
-#### Day 14 Sliding Window/Two Pointer
+#### Day 14
| | | | | |
|-|-|-|-|-|-
-| 0003 |[Longest Substring Without Repeating Characters](src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window | 258 | 91.09
-| 0016 |[3Sum Closest](src/main/kotlin/g0001_0100/s0016_3sum_closest/Solution.kt)| Medium | Array, Sorting, Two_Pointers | 413 | 95.05
-| 0076 |[Minimum Window Substring](src/main/kotlin/g0001_0100/s0076_minimum_window_substring/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window | 346 | 85.20
+| 1314 |[Matrix Block Sum](src/main/kotlin/g1301_1400/s1314_matrix_block_sum/Solution.kt)| Medium | Array, Matrix, Prefix_Sum | 235 | 100.00
+| 0304 |[Range Sum Query 2D - Immutable](src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt)| Medium | Array, Matrix, Design, Prefix_Sum | 1373 | 85.71
-#### Day 15 Tree
+#### Day 15
| | | | | |
|-|-|-|-|-|-
-| 0100 |[Same Tree](src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 208 | 72.24
-| 0101 |[Symmetric Tree](src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 190 | 91.36
-| 0199 |[Binary Tree Right Side View](src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 194 | 92.89
+| 0062 |[Unique Paths](src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Combinatorics, LeetCode_75_DP/Multidimensional, Big_O_Time_O(m\*n)_Space_O(m\*n) | 118 | 94.65
+| 0063 |[Unique Paths II](src/main/kotlin/g0001_0100/s0063_unique_paths_ii/Solution.kt)| Medium | Array, Dynamic_Programming, Matrix | 151 | 81.94
-#### Day 16 Design
+#### Day 16
| | | | | |
|-|-|-|-|-|-
-| 0232 |[Implement Queue using Stacks](src/main/kotlin/g0201_0300/s0232_implement_queue_using_stacks/MyQueue.kt)| Easy | Stack, Design, Queue | 258 | 70.86
-| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design | 331 | 84.88
-| 0208 |[Implement Trie (Prefix Tree)](src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Design, Trie | 689 | 61.00
+| 0064 |[Minimum Path Sum](src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Matrix, Big_O_Time_O(m\*n)_Space_O(m\*n) | 164 | 100.00
+| 0221 |[Maximal Square](src/main/kotlin/g0201_0300/s0221_maximal_square/Solution.kt)| Medium | Array, Dynamic_Programming, Matrix, Big_O_Time_O(m\*n)_Space_O(m\*n) | 614 | 44.00
-#### Day 17 Interval
+#### Day 17
| | | | | |
|-|-|-|-|-|-
-| 0057 |[Insert Interval](src/main/kotlin/g0001_0100/s0057_insert_interval/Solution.kt)| Medium | Array | 257 | 99.52
-| 0056 |[Merge Intervals](src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting | 320 | 94.22
+| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Big_O_Time_O(n)_Space_O(n) | 162 | 99.00
+| 0516 |[Longest Palindromic Subsequence](src/main/kotlin/g0501_0600/s0516_longest_palindromic_subsequence/Solution.kt)| Medium | String, Dynamic_Programming | 243 | 87.50
-#### Day 18 Stack
+#### Day 18
| | | | | |
|-|-|-|-|-|-
-| 0735 |[Asteroid Collision](src/main/kotlin/g0701_0800/s0735_asteroid_collision/Solution.kt)| Medium | Array, Stack | 243 | 100.00
-| 0227 |[Basic Calculator II](src/main/kotlin/g0201_0300/s0227_basic_calculator_ii/Solution.kt)| Medium | Top_Interview_Questions, String, Math, Stack | 383 | 62.50
+| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Binary_Search, Big_O_Time_O(n\*log_n)_Space_O(n) | 318 | 82.28
+| 0376 |[Wiggle Subsequence](src/main/kotlin/g0301_0400/s0376_wiggle_subsequence/Solution.kt)| Medium | Array, Dynamic_Programming, Greedy | 162 | 88.89
-#### Day 19 Union Find
+#### Day 19
| | | | | |
|-|-|-|-|-|-
-| 0547 |[Number of Provinces](src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 229 | 79.73
-| 0947 |[Most Stones Removed with Same Row or Column](src/main/kotlin/g0901_1000/s0947_most_stones_removed_with_same_row_or_column/Solution.kt)| Medium | Depth_First_Search, Graph, Union_Find | 200 | 100.00
+| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers, LeetCode_75_Two_Pointers | 156 | 87.74
+| 1143 |[Longest Common Subsequence](src/main/kotlin/g1101_1200/s1143_longest_common_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming, LeetCode_75_DP/Multidimensional, Big_O_Time_O(n\*m)_Space_O(n\*m) | 307 | 38.36
+| 0072 |[Edit Distance](src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming, LeetCode_75_DP/Multidimensional, Big_O_Time_O(n^2)_Space_O(n2) | 182 | 92.16
-#### Day 20 Brute Force/Backtracking
+#### Day 20
| | | | | |
|-|-|-|-|-|-
-| 0039 |[Combination Sum](src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Backtracking | 317 | 86.85
-| 0046 |[Permutations](src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Backtracking | 186 | 100.00
-
-### Udemy
+| 0322 |[Coin Change](src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Breadth_First_Search, Big_O_Time_O(m\*n)_Space_O(amount) | 332 | 50.68
+| 0518 |[Coin Change II](src/main/kotlin/g0501_0600/s0518_coin_change_2/Solution.kt)| Medium | Array, Dynamic_Programming | 139 | 100.00
-#### Udemy Integers
+#### Day 21
| | | | | |
|-|-|-|-|-|-
-| 0412 |[Fizz Buzz](src/main/kotlin/g0401_0500/s0412_fizz_buzz/Solution.kt)| Easy | Top_Interview_Questions, String, Math, Simulation | 307 | 71.81
-| 0136 |[Single Number](src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation | 344 | 83.63
-| 0007 |[Reverse Integer](src/main/kotlin/g0001_0100/s0007_reverse_integer/Solution.kt)| Medium | Top_Interview_Questions, Math | 245 | 60.32
-| 0009 |[Palindrome Number](src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt)| Easy | Math | 238 | 96.24
-| 0172 |[Factorial Trailing Zeroes](src/main/kotlin/g0101_0200/s0172_factorial_trailing_zeroes/Solution.kt)| Medium | Top_Interview_Questions, Math | 220 | 67.65
-| 0050 |[Pow(x, n)](src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt)| Medium | Top_Interview_Questions, Math, Recursion | 264 | 52.98
+| 0377 |[Combination Sum IV](src/main/kotlin/g0301_0400/s0377_combination_sum_iv/Solution.kt)| Medium | Array, Dynamic_Programming | 217 | 72.41
+| 0343 |[Integer Break](src/main/kotlin/g0301_0400/s0343_integer_break/Solution.kt)| Medium | Dynamic_Programming, Math | 218 | 63.89
+| 0279 |[Perfect Squares](src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt)| Medium | Dynamic_Programming, Math, Breadth_First_Search | 176 | 98.80
-#### Udemy Strings
+### Programming Skills I
+
+#### Day 1 Basic Data Type
| | | | | |
|-|-|-|-|-|-
-| 0344 |[Reverse String](src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers, Recursion | 445 | 69.75
-| 0014 |[Longest Common Prefix](src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt)| Easy | Top_Interview_Questions, String | 209 | 88.86
-| 0187 |[Repeated DNA Sequences](src/main/kotlin/g0101_0200/s0187_repeated_dna_sequences/Solution.kt)| Medium | String, Hash_Table, Bit_Manipulation, Sliding_Window, Hash_Function, Rolling_Hash | 319 | 79.03
-| 0003 |[Longest Substring Without Repeating Characters](src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window | 258 | 91.09
-| 0020 |[Valid Parentheses](src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String, Stack | 226 | 72.53
-| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming | 323 | 75.48
-| 0394 |[Decode String](src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Stack, Recursion | 224 | 64.86
-| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | Top_Interview_Questions, String, Hash_Table, Sorting | 251 | 87.65
-| 0049 |[Group Anagrams](src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, String, Hash_Table, Sorting | 506 | 86.55
-| 0151 |[Reverse Words in a String](src/main/kotlin/g0101_0200/s0151_reverse_words_in_a_string/Solution.kt)| Medium | String, Two_Pointers | 206 | 98.90
-| 0273 |[Integer to English Words](src/main/kotlin/g0201_0300/s0273_integer_to_english_words/Solution.kt)| Hard | String, Math, Recursion | 273 | 82.93
+| 1523 |[Count Odd Numbers in an Interval Range](src/main/kotlin/g1501_1600/s1523_count_odd_numbers_in_an_interval_range/Solution.kt)| Easy | Math | 114 | 97.22
+| 1491 |[Average Salary Excluding the Minimum and Maximum Salary](src/main/kotlin/g1401_1500/s1491_average_salary_excluding_the_minimum_and_maximum_salary/Solution.kt)| Easy | Array, Sorting | 137 | 91.67
-#### Udemy Binary Search
+#### Day 2 Operator
| | | | | |
|-|-|-|-|-|-
-| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Array, Binary_Search | 261 | 77.91
-| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search | 184 | 86.08
-| 0153 |[Find Minimum in Rotated Sorted Array](src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search | 262 | 60.96
+| 0191 |[Number of 1 Bits](src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation | 237 | 68.44
+| 1281 |[Subtract the Product and Sum of Digits of an Integer](src/main/kotlin/g1201_1300/s1281_subtract_the_product_and_sum_of_digits_of_an_integer/Solution.kt)| Easy | Math | 128 | 61.82
-#### Udemy Arrays
+#### Day 3 Conditional Statements
| | | | | |
|-|-|-|-|-|-
-| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 609 | 94.06
-| 0283 |[Move Zeroes](src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Two_Pointers | 516 | 79.07
-| 0001 |[Two Sum](src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table | 234 | 92.75
-| 0217 |[Contains Duplicate](src/main/kotlin/g0201_0300/s0217_contains_duplicate/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting | 719 | 73.49
-| 0058 |[Length of Last Word](src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt)| Easy | String | 243 | 63.33
-| 0605 |[Can Place Flowers](src/main/kotlin/g0601_0700/s0605_can_place_flowers/Solution.kt)| Easy | Array, Greedy | 209 | 85.71
-| 0122 |[Best Time to Buy and Sell Stock II](src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt)| Medium | Top_Interview_Questions, Array, Dynamic_Programming, Greedy | 197 | 95.10
-| 0080 |[Remove Duplicates from Sorted Array II](src/main/kotlin/g0001_0100/s0080_remove_duplicates_from_sorted_array_ii/Solution.kt)| Medium | Array, Two_Pointers | 357 | 44.78
-| 0189 |[Rotate Array](src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Two_Pointers | 483 | 86.95
-| 0055 |[Jump Game](src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Greedy | 670 | 66.67
-| 0075 |[Sort Colors](src/main/kotlin/g0001_0100/s0075_sort_colors/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers | 198 | 85.66
-| 0066 |[Plus One](src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt)| Easy | Top_Interview_Questions, Array, Math | 303 | 35.18
-| 0238 |[Product of Array Except Self](src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Prefix_Sum | 669 | 48.96
-| 1291 |[Sequential Digits](src/main/kotlin/g1201_1300/s1291_sequential_digits/Solution.kt)| Medium | Enumeration | 114 | 100.00
-| 0448 |[Find All Numbers Disappeared in an Array](src/main/kotlin/g0401_0500/s0448_find_all_numbers_disappeared_in_an_array/Solution.kt)| Easy | Array, Hash_Table | 394 | 100.00
-| 0442 |[Find All Duplicates in an Array](src/main/kotlin/g0401_0500/s0442_find_all_duplicates_in_an_array/Solution.kt)| Medium | Array, Hash_Table | 480 | 73.81
-| 0041 |[First Missing Positive](src/main/kotlin/g0001_0100/s0041_first_missing_positive/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table | 345 | 100.00
-| 0697 |[Degree of an Array](src/main/kotlin/g0601_0700/s0697_degree_of_an_array/Solution.kt)| Easy | Array, Hash_Table | 289 | 84.62
-| 0532 |[K-diff Pairs in an Array](src/main/kotlin/g0501_0600/s0532_k_diff_pairs_in_an_array/Solution.kt)| Medium | Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 230 | 84.62
-| 0713 |[Subarray Product Less Than K](src/main/kotlin/g0701_0800/s0713_subarray_product_less_than_k/Solution.kt)| Medium | Array, Sliding_Window | 336 | 92.11
-| 1007 |[Minimum Domino Rotations For Equal Row](src/main/kotlin/g1001_1100/s1007_minimum_domino_rotations_for_equal_row/Solution.kt)| Medium | Array, Greedy | 421 | 50.00
-| 1306 |[Jump Game III](src/main/kotlin/g1301_1400/s1306_jump_game_iii/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search | 291 | 100.00
-| 0456 |[132 Pattern](src/main/kotlin/g0401_0500/s0456_132_pattern/Solution.kt)| Medium | Array, Binary_Search, Stack, Ordered_Set, Monotonic_Stack | 434 | 100.00
-| 0239 |[Sliding Window Maximum](src/main/kotlin/g0201_0300/s0239_sliding_window_maximum/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Heap_Priority_Queue, Sliding_Window, Queue, Monotonic_Queue | 1059 | 86.14
+| 0976 |[Largest Perimeter Triangle](src/main/kotlin/g0901_1000/s0976_largest_perimeter_triangle/Solution.kt)| Easy | Array, Math, Sorting, Greedy | 304 | 33.33
+| 1779 |[Find Nearest Point That Has the Same X or Y Coordinate](src/main/kotlin/g1701_1800/s1779_find_nearest_point_that_has_the_same_x_or_y_coordinate/Solution.kt)| Easy | Array | 364 | 100.00
-#### Udemy Two Pointers
+#### Day 4 Loop
| | | | | |
|-|-|-|-|-|-
-| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers | 156 | 87.74
-| 0125 |[Valid Palindrome](src/main/kotlin/g0101_0200/s0125_valid_palindrome/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers | 353 | 52.06
-| 0977 |[Squares of a Sorted Array](src/main/kotlin/g0901_1000/s0977_squares_of_a_sorted_array/Solution.kt)| Easy | Array, Sorting, Two_Pointers | 375 | 18.43
-| 0026 |[Remove Duplicates from Sorted Array](src/main/kotlin/g0001_0100/s0026_remove_duplicates_from_sorted_array/Solution.kt)| Easy | Top_Interview_Questions, Array, Two_Pointers | 361 | 77.19
-| 0042 |[Trapping Rain Water](src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Two_Pointers, Stack, Monotonic_Stack | 196 | 100.00
-| 0015 |[3Sum](src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers | 761 | 90.55
+| 1822 |[Sign of the Product of an Array](src/main/kotlin/g1801_1900/s1822_sign_of_the_product_of_an_array/Solution.kt)| Easy | Array, Math | 170 | 92.51
+| 1502 |[Can Make Arithmetic Progression From Sequence](src/main/kotlin/g1501_1600/s1502_can_make_arithmetic_progression_from_sequence/Solution.kt)| Easy | Array, Sorting | 156 | 94.82
+| 0202 |[Happy Number](src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt)| Easy | Top_Interview_Questions, Hash_Table, Math, Two_Pointers | 261 | 45.08
+| 1790 |[Check if One String Swap Can Make Strings Equal](src/main/kotlin/g1701_1800/s1790_check_if_one_string_swap_can_make_strings_equal/Solution.kt)| Easy | String, Hash_Table, Counting | 138 | 100.00
-#### Udemy Famous Algorithm
+#### Day 5 Function
| | | | | |
|-|-|-|-|-|-
-| 0053 |[Maximum Subarray](src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Divide_and_Conquer | 662 | 82.48
-| 0169 |[Majority Element](src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Sorting, Counting, Divide_and_Conquer | 460 | 51.25
+| 0589 |[N-ary Tree Preorder Traversal](src/main/kotlin/g0501_0600/s0589_n_ary_tree_preorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Stack | 233 | 84.02
+| 0496 |[Next Greater Element I](src/main/kotlin/g0401_0500/s0496_next_greater_element_i/Solution.kt)| Easy | Array, Hash_Table, Stack, Monotonic_Stack | 171 | 100.00
+| 1232 |[Check If It Is a Straight Line](src/main/kotlin/g1201_1300/s1232_check_if_it_is_a_straight_line/Solution.kt)| Easy | Array, Math, Geometry | 152 | 95.38
-#### Udemy Sorting Algorithms
+#### Day 6 Array
| | | | | |
|-|-|-|-|-|-
-| 0912 |[Sort an Array](src/main/kotlin/g0901_1000/s0912_sort_an_array/Solution.kt)| Medium | Array, Sorting, Heap_Priority_Queue, Divide_and_Conquer, Merge_Sort, Bucket_Sort, Counting_Sort, Radix_Sort | 606 | 98.48
+| 1588 |[Sum of All Odd Length Subarrays](src/main/kotlin/g1501_1600/s1588_sum_of_all_odd_length_subarrays/Solution.kt)| Easy | Array, Math, Prefix_Sum | 157 | 64.00
+| 0283 |[Move Zeroes](src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Two_Pointers, LeetCode_75_Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 516 | 79.07
+| 1672 |[Richest Customer Wealth](src/main/kotlin/g1601_1700/s1672_richest_customer_wealth/Solution.kt)| Easy | Array, Matrix | 155 | 94.54
-#### Udemy 2D Arrays/Matrix
+#### Day 7 Array
| | | | | |
|-|-|-|-|-|-
-| 0304 |[Range Sum Query 2D - Immutable](src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt)| Medium | Array, Matrix, Design, Prefix_Sum | 1373 | 85.71
-| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix | 290 | 40.17
-| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_Interview_Questions, Array, Matrix, Simulation | 224 | 62.50
-| 0048 |[Rotate Image](src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Matrix | 287 | 46.50
| 1572 |[Matrix Diagonal Sum](src/main/kotlin/g1501_1600/s1572_matrix_diagonal_sum/Solution.kt)| Easy | Array, Matrix | 221 | 67.61
-| 0073 |[Set Matrix Zeroes](src/main/kotlin/g0001_0100/s0073_set_matrix_zeroes/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Matrix | 255 | 100.00
-| 0056 |[Merge Intervals](src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting | 320 | 94.22
+| 0566 |[Reshape the Matrix](src/main/kotlin/g0501_0600/s0566_reshape_the_matrix/Solution.kt)| Easy | Array, Matrix, Simulation | 239 | 99.05
-#### Udemy Linked List
+#### Day 8 String
| | | | | |
|-|-|-|-|-|-
-| 0114 |[Flatten Binary Tree to Linked List](src/main/kotlin/g0101_0200/s0114_flatten_binary_tree_to_linked_list/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, Stack, Linked_List | 191 | 93.10
-| 0445 |[Add Two Numbers II](src/main/kotlin/g0401_0500/s0445_add_two_numbers_ii/Solution.kt)| Medium | Math, Stack, Linked_List | 240 | 82.61
-| 0328 |[Odd Even Linked List](src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt)| Medium | Top_Interview_Questions, Linked_List | 216 | 86.96
-| 0061 |[Rotate List](src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt)| Medium | Two_Pointers, Linked_List | 193 | 92.16
-| 0024 |[Swap Nodes in Pairs](src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt)| Medium | Top_100_Liked_Questions, Linked_List, Recursion | 149 | 99.39
-| 0876 |[Middle of the Linked List](src/main/kotlin/g0801_0900/s0876_middle_of_the_linked_list/Solution.kt)| Easy | Two_Pointers, Linked_List | 136 | 76.52
-| 0142 |[Linked List Cycle II](src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Hash_Table, Two_Pointers, Linked_List | 192 | 63.39
-| 0141 |[Linked List Cycle](src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List | 223 | 91.85
-| 0206 |[Reverse Linked List](src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion | 279 | 45.78
-| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion | 176 | 96.25
-| 0160 |[Intersection of Two Linked Lists](src/main/kotlin/g0101_0200/s0160_intersection_of_two_linked_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List | 262 | 83.50
-| 0234 |[Palindrome Linked List](src/main/kotlin/g0201_0300/s0234_palindrome_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Two_Pointers, Stack, Linked_List, Recursion | 641 | 79.53
-| 0138 |[Copy List with Random Pointer](src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Linked_List | 274 | 80.58
-| 0025 |[Reverse Nodes in k-Group](src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt)| Hard | Top_100_Liked_Questions, Linked_List, Recursion | 194 | 87.72
-| 0146 |[LRU Cache](src/main/kotlin/g0101_0200/s0146_lru_cache/LRUCache.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Design, Linked_List, Doubly_Linked_List | 1116 | 97.93
-| 0707 |[Design Linked List](src/main/kotlin/g0701_0800/s0707_design_linked_list/MyLinkedList.kt)| Medium | Design, Linked_List | 243 | 100.00
+| 1768 |[Merge Strings Alternately](src/main/kotlin/g1701_1800/s1768_merge_strings_alternately/Solution.kt)| Easy | String, Two_Pointers, LeetCode_75_Array/String | 138 | 93.81
+| 1678 |[Goal Parser Interpretation](src/main/kotlin/g1601_1700/s1678_goal_parser_interpretation/Solution.kt)| Easy | String | 136 | 88.24
+| 0389 |[Find the Difference](src/main/kotlin/g0301_0400/s0389_find_the_difference/Solution.kt)| Easy | String, Hash_Table, Sorting, Bit_Manipulation | 256 | 64.81
-#### Udemy Tree Stack Queue
+#### Day 9 String
| | | | | |
|-|-|-|-|-|-
-| 0144 |[Binary Tree Preorder Traversal](src/main/kotlin/g0101_0200/s0144_binary_tree_preorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Stack | 277 | 37.90
-| 0094 |[Binary Tree Inorder Traversal](src/main/kotlin/g0001_0100/s0094_binary_tree_inorder_traversal/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Stack | 269 | 38.80
-| 0145 |[Binary Tree Postorder Traversal](src/main/kotlin/g0101_0200/s0145_binary_tree_postorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Stack | 211 | 80.00
-| 0102 |[Binary Tree Level Order Traversal](src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree | 332 | 67.53
-| 0103 |[Binary Tree Zigzag Level Order Traversal](src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt)| Medium | Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree | 316 | 34.25
-| 0108 |[Convert Sorted Array to Binary Search Tree](src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt)| Easy | Top_Interview_Questions, Array, Tree, Binary_Tree, Binary_Search_Tree, Divide_and_Conquer | 334 | 35.39
-| 1008 |[Construct Binary Search Tree from Preorder Traversal](src/main/kotlin/g1001_1100/s1008_construct_binary_search_tree_from_preorder_traversal/Solution.kt)| Medium | Array, Tree, Binary_Tree, Stack, Monotonic_Stack, Binary_Search_Tree | 145 | 100.00
-| 0543 |[Diameter of Binary Tree](src/main/kotlin/g0501_0600/s0543_diameter_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree | 307 | 43.93
-| 0938 |[Range Sum of BST](src/main/kotlin/g0901_1000/s0938_range_sum_of_bst/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 356 | 55.36
-| 0100 |[Same Tree](src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 208 | 72.24
-| 0226 |[Invert Binary Tree](src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 233 | 54.90
-| 0111 |[Minimum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0111_minimum_depth_of_binary_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 525 | 90.51
-| 0104 |[Maximum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 236 | 83.39
-| 0110 |[Balanced Binary Tree](src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree | 310 | 63.63
-| 0701 |[Insert into a Binary Search Tree](src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt)| Medium | Tree, Binary_Tree, Binary_Search_Tree | 311 | 79.03
-| 0297 |[Serialize and Deserialize Binary Tree](src/main/kotlin/g0201_0300/s0297_serialize_and_deserialize_binary_tree/Codec.kt)| Hard | Top_Interview_Questions, String, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Design | 475 | 78.85
-| 0124 |[Binary Tree Maximum Path Sum](src/main/kotlin/g0101_0200/s0124_binary_tree_maximum_path_sum/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Depth_First_Search, Tree, Binary_Tree | 331 | 74.42
-| 0098 |[Validate Binary Search Tree](src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 330 | 41.38
-| 0337 |[House Robber III](src/main/kotlin/g0301_0400/s0337_house_robber_iii/Solution.kt)| Medium | Dynamic_Programming, Depth_First_Search, Tree, Binary_Tree | 282 | 84.62
-| 0236 |[Lowest Common Ancestor of a Binary Tree](src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree | 386 | 45.21
-| 0968 |[Binary Tree Cameras](src/main/kotlin/g0901_1000/s0968_binary_tree_cameras/Solution.kt)| Hard | Dynamic_Programming, Depth_First_Search, Tree, Binary_Tree | 176 | 100.00
+| 0709 |[To Lower Case](src/main/kotlin/g0701_0800/s0709_to_lower_case/Solution.kt)| Easy | String | 142 | 98.68
+| 1309 |[Decrypt String from Alphabet to Integer Mapping](src/main/kotlin/g1301_1400/s1309_decrypt_string_from_alphabet_to_integer_mapping/Solution.kt)| Easy | String | 0 | 100.00
+| 0953 |[Verifying an Alien Dictionary](src/main/kotlin/g0901_1000/s0953_verifying_an_alien_dictionary/Solution.kt)| Easy | Array, String, Hash_Table | 137 | 100.00
-#### Udemy Trie and Heap
+#### Day 10 Linked List and Tree
| | | | | |
|-|-|-|-|-|-
-| 0208 |[Implement Trie (Prefix Tree)](src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Design, Trie | 689 | 61.00
-| 0745 |[Prefix and Suffix Search](src/main/kotlin/g0701_0800/s0745_prefix_and_suffix_search/WordFilter.kt)| Hard | String, Design, Trie | 1638 | 100.00
+| 1290 |[Convert Binary Number in a Linked List to Integer](src/main/kotlin/g1201_1300/s1290_convert_binary_number_in_a_linked_list_to_integer/Solution.kt)| Easy | Math, Linked_List | 138 | 65.79
+| 0876 |[Middle of the Linked List](src/main/kotlin/g0801_0900/s0876_middle_of_the_linked_list/Solution.kt)| Easy | Two_Pointers, Linked_List | 136 | 76.52
+| 0104 |[Maximum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(N)_Space_O(H) | 166 | 83.53
+| 0404 |[Sum of Left Leaves](src/main/kotlin/g0401_0500/s0404_sum_of_left_leaves/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 173 | 86.05
-#### Udemy Graph
+#### Day 11 Containers and Libraries
| | | | | |
|-|-|-|-|-|-
-| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 252 | 95.41
-| 0133 |[Clone Graph](src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt)| Medium | Hash_Table, Depth_First_Search, Breadth_First_Search, Graph | 351 | 60.91
-| 0417 |[Pacific Atlantic Water Flow](src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 319 | 100.00
+| 1356 |[Sort Integers by The Number of 1 Bits](src/main/kotlin/g1301_1400/s1356_sort_integers_by_the_number_of_1_bits/Solution.kt)| Easy | Array, Sorting, Bit_Manipulation, Counting | 236 | 92.31
+| 0232 |[Implement Queue using Stacks](src/main/kotlin/g0201_0300/s0232_implement_queue_using_stacks/MyQueue.kt)| Easy | Stack, Design, Queue | 258 | 70.86
+| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | String, Hash_Table, Sorting | 251 | 87.65
+| 0217 |[Contains Duplicate](src/main/kotlin/g0201_0300/s0217_contains_duplicate/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting | 719 | 73.49
-#### Udemy Dynamic Programming
+#### Day 12 Class and Object
| | | | | |
|-|-|-|-|-|-
-| 0120 |[Triangle](src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt)| Medium | Array, Dynamic_Programming | 194 | 97.87
-| 0118 |[Pascal's Triangle](src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt)| Easy | Top_Interview_Questions, Array, Dynamic_Programming | 277 | 33.22
-| 0119 |[Pascal's Triangle II](src/main/kotlin/g0101_0200/s0119_pascals_triangle_ii/Solution.kt)| Easy | Array, Dynamic_Programming | 157 | 97.27
-| 0139 |[Word Break](src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Dynamic_Programming, Trie, Memoization | 197 | 87.17
-| 0152 |[Maximum Product Subarray](src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 253 | 88.42
-| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 156 | 92.24
-| 0213 |[House Robber II](src/main/kotlin/g0201_0300/s0213_house_robber_ii/Solution.kt)| Medium | Array, Dynamic_Programming | 257 | 59.62
-| 0509 |[Fibonacci Number](src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Recursion, Memoization | 139 | 82.72
-| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization | 127 | 97.06
-| 0064 |[Minimum Path Sum](src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Matrix | 222 | 95.70
-| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Binary_Search | 318 | 82.28
-| 1143 |[Longest Common Subsequence](src/main/kotlin/g1101_1200/s1143_longest_common_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming | 307 | 38.36
-| 0072 |[Edit Distance](src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt)| Hard | Top_100_Liked_Questions, String, Dynamic_Programming | 320 | 63.53
-| 0044 |[Wildcard Matching](src/main/kotlin/g0001_0100/s0044_wildcard_matching/Solution.kt)| Hard | Top_Interview_Questions, String, Dynamic_Programming, Greedy, Recursion | 401 | 86.11
-| 0010 |[Regular Expression Matching](src/main/kotlin/g0001_0100/s0010_regular_expression_matching/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Recursion | 292 | 58.58
+| 1603 |[Design Parking System](src/main/kotlin/g1601_1700/s1603_design_parking_system/ParkingSystem.kt)| Easy | Design, Simulation, Counting | 376 | 31.83
+| 0303 |[Range Sum Query - Immutable](src/main/kotlin/g0301_0400/s0303_range_sum_query_immutable/NumArray.kt)| Easy | Array, Design, Prefix_Sum | 472 | 63.64
-#### Udemy Backtracking/Recursion
+### Programming Skills II
+
+#### Day 1
| | | | | |
|-|-|-|-|-|-
-| 0022 |[Generate Parentheses](src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Backtracking | 210 | 78.51
-| 0039 |[Combination Sum](src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Backtracking | 317 | 86.85
-| 0216 |[Combination Sum III](src/main/kotlin/g0201_0300/s0216_combination_sum_iii/Solution.kt)| Medium | Array, Backtracking | 175 | 90.91
-| 0078 |[Subsets](src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, Backtracking | 191 | 97.44
-| 0017 |[Letter Combinations of a Phone Number](src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Backtracking | 262 | 73.59
-| 0046 |[Permutations](src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Backtracking | 186 | 100.00
+| 0896 |[Monotonic Array](src/main/kotlin/g0801_0900/s0896_monotonic_array/Solution.kt)| Easy | Array | 576 | 90.91
+| 0028 |[Find the Index of the First Occurrence in a String](src/main/kotlin/g0001_0100/s0028_find_the_index_of_the_first_occurrence_in_a_string/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers, String_Matching | 126 | 97.58
-#### Udemy Bit Manipulation
+#### Day 2
| | | | | |
|-|-|-|-|-|-
-| 0191 |[Number of 1 Bits](src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation | 237 | 68.44
-| 0389 |[Find the Difference](src/main/kotlin/g0301_0400/s0389_find_the_difference/Solution.kt)| Easy | String, Hash_Table, Sorting, Bit_Manipulation | 256 | 64.81
-| 0190 |[Reverse Bits](src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation, Divide_and_Conquer | 198 | 81.82
-| 0461 |[Hamming Distance](src/main/kotlin/g0401_0500/s0461_hamming_distance/Solution.kt)| Easy | Bit_Manipulation | 150 | 96.15
-| 1009 |[Complement of Base 10 Integer](src/main/kotlin/g1001_1100/s1009_complement_of_base_10_integer/Solution.kt)| Easy | Bit_Manipulation | 126 | 72.73
-| 0338 |[Counting Bits](src/main/kotlin/g0301_0400/s0338_counting_bits/Solution.kt)| Easy | Top_100_Liked_Questions, Dynamic_Programming, Bit_Manipulation | 186 | 99.26
-| 0371 |[Sum of Two Integers](src/main/kotlin/g0301_0400/s0371_sum_of_two_integers/Solution.kt)| Medium | Top_Interview_Questions, Math, Bit_Manipulation | 129 | 95.45
-| 0029 |[Divide Two Integers](src/main/kotlin/g0001_0100/s0029_divide_two_integers/Solution.kt)| Medium | Top_Interview_Questions, Math, Bit_Manipulation | 281 | 31.67
+| 0110 |[Balanced Binary Tree](src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree | 182 | 71.30
+| 0459 |[Repeated Substring Pattern](src/main/kotlin/g0401_0500/s0459_repeated_substring_pattern/Solution.kt)| Easy | String, String_Matching | 201 | 100.00
-#### Udemy Design
+#### Day 3
| | | | | |
|-|-|-|-|-|-
-| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design | 331 | 84.88
-
-### Data Structure I
+| 0150 |[Evaluate Reverse Polish Notation](src/main/kotlin/g0101_0200/s0150_evaluate_reverse_polish_notation/Solution.kt)| Medium | Top_Interview_Questions, Array, Math, Stack | 233 | 88.82
+| 0066 |[Plus One](src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt)| Easy | Top_Interview_Questions, Array, Math | 148 | 98.75
-#### Day 1 Array
+#### Day 4
| | | | | |
|-|-|-|-|-|-
-| 0217 |[Contains Duplicate](src/main/kotlin/g0201_0300/s0217_contains_duplicate/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting | 719 | 73.49
-| 0053 |[Maximum Subarray](src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Divide_and_Conquer | 662 | 82.48
+| 1367 |[Linked List in Binary Tree](src/main/kotlin/g1301_1400/s1367_linked_list_in_binary_tree/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Linked_List | 237 | 92.86
+| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation | 165 | 96.72
-#### Day 2 Array
+#### Day 5
| | | | | |
|-|-|-|-|-|-
-| 0001 |[Two Sum](src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table | 234 | 92.75
-| 0088 |[Merge Sorted Array](src/main/kotlin/g0001_0100/s0088_merge_sorted_array/Solution.kt)| Easy | Top_Interview_Questions, Array, Sorting, Two_Pointers | 311 | 33.40
+| 0067 |[Add Binary](src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt)| Easy | String, Math, Bit_Manipulation, Simulation | 164 | 90.60
+| 0989 |[Add to Array-Form of Integer](src/main/kotlin/g0901_1000/s0989_add_to_array_form_of_integer/Solution.kt)| Easy | Array, Math | 350 | 70.00
-#### Day 3 Array
+#### Day 6
| | | | | |
|-|-|-|-|-|-
-| 0350 |[Intersection of Two Arrays II](src/main/kotlin/g0301_0400/s0350_intersection_of_two_arrays_ii/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 321 | 73.37
-| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 609 | 94.06
+| 0739 |[Daily Temperatures](src/main/kotlin/g0701_0800/s0739_daily_temperatures/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Stack, Monotonic_Stack, LeetCode_75_Monotonic_Stack, Big_O_Time_O(n)_Space_O(n) | 936 | 80.54
+| 0058 |[Length of Last Word](src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt)| Easy | String | 135 | 93.67
-#### Day 4 Array
+#### Day 7
| | | | | |
|-|-|-|-|-|-
-| 0566 |[Reshape the Matrix](src/main/kotlin/g0501_0600/s0566_reshape_the_matrix/Solution.kt)| Easy | Array, Matrix, Simulation | 239 | 99.05
-| 0118 |[Pascal's Triangle](src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt)| Easy | Top_Interview_Questions, Array, Dynamic_Programming | 277 | 33.22
+| 0048 |[Rotate Image](src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Matrix, Big_O_Time_O(n^2)_Space_O(1) | 160 | 90.11
+| 1886 |[Determine Whether Matrix Can Be Obtained By Rotation](src/main/kotlin/g1801_1900/s1886_determine_whether_matrix_can_be_obtained_by_rotation/Solution.kt)| Easy | Array, Matrix | 147 | 85.71
-#### Day 5 Array
+#### Day 8
| | | | | |
|-|-|-|-|-|-
-| 0036 |[Valid Sudoku](src/main/kotlin/g0001_0100/s0036_valid_sudoku/Solution.kt)| Medium | Top_Interview_Questions, Array, Hash_Table, Matrix | 346 | 65.03
-| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix | 290 | 40.17
+| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Matrix, Simulation | 132 | 95.12
+| 0973 |[K Closest Points to Origin](src/main/kotlin/g0901_1000/s0973_k_closest_points_to_origin/Solution.kt)| Medium | Array, Math, Sorting, Heap_Priority_Queue, Divide_and_Conquer, Geometry, Quickselect | 800 | 37.89
-#### Day 6 String
+#### Day 9
| | | | | |
|-|-|-|-|-|-
-| 0387 |[First Unique Character in a String](src/main/kotlin/g0301_0400/s0387_first_unique_character_in_a_string/Solution.kt)| Easy | Top_Interview_Questions, String, Hash_Table, Counting, Queue | 369 | 82.68
-| 0383 |[Ransom Note](src/main/kotlin/g0301_0400/s0383_ransom_note/Solution.kt)| Easy | String, Hash_Table, Counting | 333 | 79.58
-| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | Top_Interview_Questions, String, Hash_Table, Sorting | 251 | 87.65
+| 1630 |[Arithmetic Subarrays](src/main/kotlin/g1601_1700/s1630_arithmetic_subarrays/Solution.kt)| Medium | Array, Sorting | 264 | 100.00
+| 0429 |[N-ary Tree Level Order Traversal](src/main/kotlin/g0401_0500/s0429_n_ary_tree_level_order_traversal/Solution.kt)| Medium | Breadth_First_Search, Tree | 248 | 75.86
-#### Day 7 Linked List
+#### Day 10
| | | | | |
|-|-|-|-|-|-
-| 0141 |[Linked List Cycle](src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List | 223 | 91.85
-| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion | 176 | 96.25
-| 0203 |[Remove Linked List Elements](src/main/kotlin/g0201_0300/s0203_remove_linked_list_elements/Solution.kt)| Easy | Linked_List, Recursion | 233 | 91.22
+| 0503 |[Next Greater Element II](src/main/kotlin/g0501_0600/s0503_next_greater_element_ii/Solution.kt)| Medium | Array, Stack, Monotonic_Stack | 331 | 92.68
+| 0556 |[Next Greater Element III](src/main/kotlin/g0501_0600/s0556_next_greater_element_iii/Solution.kt)| Medium | String, Math, Two_Pointers | 137 | 80.00
-#### Day 8 Linked List
+#### Day 11
| | | | | |
|-|-|-|-|-|-
-| 0206 |[Reverse Linked List](src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion | 279 | 45.78
-| 0083 |[Remove Duplicates from Sorted List](src/main/kotlin/g0001_0100/s0083_remove_duplicates_from_sorted_list/Solution.kt)| Easy | Linked_List | 274 | 77.82
+| 1376 |[Time Needed to Inform All Employees](src/main/kotlin/g1301_1400/s1376_time_needed_to_inform_all_employees/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree | 915 | 37.62
+| 0049 |[Group Anagrams](src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, String, Hash_Table, Sorting, Big_O_Time_O(n\*k_log_k)_Space_O(n) | 308 | 96.34
-#### Day 9 Stack Queue
+#### Day 12
| | | | | |
|-|-|-|-|-|-
-| 0020 |[Valid Parentheses](src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String, Stack | 226 | 72.53
-| 0232 |[Implement Queue using Stacks](src/main/kotlin/g0201_0300/s0232_implement_queue_using_stacks/MyQueue.kt)| Easy | Stack, Design, Queue | 258 | 70.86
+| 0438 |[Find All Anagrams in a String](src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(n+m)_Space_O(1) | 561 | 54.68
+| 0713 |[Subarray Product Less Than K](src/main/kotlin/g0701_0800/s0713_subarray_product_less_than_k/Solution.kt)| Medium | Array, Sliding_Window | 336 | 92.11
-#### Day 10 Tree
+#### Day 13
| | | | | |
|-|-|-|-|-|-
-| 0144 |[Binary Tree Preorder Traversal](src/main/kotlin/g0101_0200/s0144_binary_tree_preorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Stack | 277 | 37.90
-| 0094 |[Binary Tree Inorder Traversal](src/main/kotlin/g0001_0100/s0094_binary_tree_inorder_traversal/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Stack | 269 | 38.80
-| 0145 |[Binary Tree Postorder Traversal](src/main/kotlin/g0101_0200/s0145_binary_tree_postorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Stack | 211 | 80.00
+| 0304 |[Range Sum Query 2D - Immutable](src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt)| Medium | Array, Matrix, Design, Prefix_Sum | 1373 | 85.71
+| 0910 |[Smallest Range II](src/main/kotlin/g0901_1000/s0910_smallest_range_ii/Solution.kt)| Medium | Array, Math, Sorting, Greedy | 234 | 100.00
-#### Day 11 Tree
+#### Day 14
| | | | | |
|-|-|-|-|-|-
-| 0102 |[Binary Tree Level Order Traversal](src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree | 332 | 67.53
-| 0104 |[Maximum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 236 | 83.39
-| 0101 |[Symmetric Tree](src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 190 | 91.36
+| 0143 |[Reorder List](src/main/kotlin/g0101_0200/s0143_reorder_list/Solution.kt)| Medium | Two_Pointers, Stack, Linked_List, Recursion | 395 | 82.26
+| 0138 |[Copy List with Random Pointer](src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Linked_List, Big_O_Time_O(N)_Space_O(N) | 274 | 80.58
-#### Day 12 Tree
+#### Day 15
| | | | | |
|-|-|-|-|-|-
-| 0226 |[Invert Binary Tree](src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 233 | 54.90
-| 0112 |[Path Sum](src/main/kotlin/g0101_0200/s0112_path_sum/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 322 | 36.41
+| 0002 |[Add Two Numbers](src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Math, Linked_List, Recursion, Big_O_Time_O(max(N,M))_Space_O(max(N,M)), AI_can_be_used_to_solve_the_task | 203 | 96.13
+| 0445 |[Add Two Numbers II](src/main/kotlin/g0401_0500/s0445_add_two_numbers_ii/Solution.kt)| Medium | Math, Stack, Linked_List | 240 | 82.61
-#### Day 13 Tree
+#### Day 16
| | | | | |
|-|-|-|-|-|-
-| 0700 |[Search in a Binary Search Tree](src/main/kotlin/g0601_0700/s0700_search_in_a_binary_search_tree/Solution.kt)| Easy | Tree, Binary_Tree, Binary_Search_Tree | 251 | 88.31
-| 0701 |[Insert into a Binary Search Tree](src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt)| Medium | Tree, Binary_Tree, Binary_Search_Tree | 311 | 79.03
+| 0061 |[Rotate List](src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt)| Medium | Two_Pointers, Linked_List | 160 | 92.22
+| 0173 |[Binary Search Tree Iterator](src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt)| Medium | Tree, Binary_Tree, Stack, Design, Binary_Search_Tree, Iterator | 563 | 46.91
-#### Day 14 Tree
+#### Day 17
| | | | | |
|-|-|-|-|-|-
-| 0098 |[Validate Binary Search Tree](src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 330 | 41.38
-| 0653 |[Two Sum IV - Input is a BST](src/main/kotlin/g0601_0700/s0653_two_sum_iv_input_is_a_bst/Solution.kt)| Easy | Hash_Table, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Two_Pointers, Binary_Search_Tree | 231 | 96.08
-| 0235 |[Lowest Common Ancestor of a Binary Search Tree](src/main/kotlin/g0201_0300/s0235_lowest_common_ancestor_of_a_binary_search_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 404 | 75.59
-
-### Data Structure II
+| 1845 |[Seat Reservation Manager](src/main/kotlin/g1801_1900/s1845_seat_reservation_manager/SeatManager.kt)| Medium | Design, Heap_Priority_Queue | 834 | 100.00
+| 0860 |[Lemonade Change](src/main/kotlin/g0801_0900/s0860_lemonade_change/Solution.kt)| Easy | Array, Greedy | 413 | 86.96
-#### Day 1 Array
+#### Day 18
| | | | | |
|-|-|-|-|-|-
-| 0136 |[Single Number](src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation | 344 | 83.63
-| 0169 |[Majority Element](src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Sorting, Counting, Divide_and_Conquer | 460 | 51.25
-| 0015 |[3Sum](src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers | 761 | 90.55
+| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design, Big_O_Time_O(1)_Space_O(N) | 331 | 84.88
+| 0341 |[Flatten Nested List Iterator](src/main/kotlin/g0301_0400/s0341_flatten_nested_list_iterator/NestedIterator.kt)| Medium | Depth_First_Search, Tree, Stack, Design, Queue, Iterator | 210 | 100.00
-#### Day 2 Array
+#### Day 19
| | | | | |
|-|-|-|-|-|-
-| 0075 |[Sort Colors](src/main/kotlin/g0001_0100/s0075_sort_colors/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers | 198 | 85.66
-| 0056 |[Merge Intervals](src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting | 320 | 94.22
-| 0706 |[Design HashMap](src/main/kotlin/g0701_0800/s0706_design_hashmap/MyHashMap.kt)| Easy | Array, Hash_Table, Design, Linked_List, Hash_Function | 405 | 92.11
-
-#### Day 3 Array
+| 1797 |[Design Authentication Manager](src/main/kotlin/g1701_1800/s1797_design_authentication_manager/AuthenticationManager.kt)| Medium | Hash_Table, Design | 334 | 100.00
+| 0707 |[Design Linked List](src/main/kotlin/g0701_0800/s0707_design_linked_list/MyLinkedList.kt)| Medium | Design, Linked_List | 243 | 100.00
+
+#### Day 20
| | | | | |
|-|-|-|-|-|-
-| 0119 |[Pascal's Triangle II](src/main/kotlin/g0101_0200/s0119_pascals_triangle_ii/Solution.kt)| Easy | Array, Dynamic_Programming | 157 | 97.27
-| 0048 |[Rotate Image](src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Matrix | 287 | 46.50
-| 0059 |[Spiral Matrix II](src/main/kotlin/g0001_0100/s0059_spiral_matrix_ii/Solution.kt)| Medium | Array, Matrix, Simulation | 153 | 100.00
+| 0380 |[Insert Delete GetRandom O(1)](src/main/kotlin/g0301_0400/s0380_insert_delete_getrandom_o1/RandomizedSet.kt)| Medium | Array, Hash_Table, Math, Design, Randomized | 1326 | 68.23
+| 0622 |[Design Circular Queue](src/main/kotlin/g0601_0700/s0622_design_circular_queue/MyCircularQueue.kt)| Medium | Array, Design, Linked_List, Queue | 234 | 92.68
+| 0729 |[My Calendar I](src/main/kotlin/g0701_0800/s0729_my_calendar_i/MyCalendar.kt)| Medium | Binary_Search, Design, Ordered_Set, Segment_Tree | 378 | 69.70
-#### Day 4 Array
+### Graph Theory I
+
+#### Day 1 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
-| 0240 |[Search a 2D Matrix II](src/main/kotlin/g0201_0300/s0240_search_a_2d_matrix_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Matrix, Divide_and_Conquer | 460 | 66.08
-| 0435 |[Non-overlapping Intervals](src/main/kotlin/g0401_0500/s0435_non_overlapping_intervals/Solution.kt)| Medium | Array, Dynamic_Programming, Sorting, Greedy | 1040 | 85.07
+| 0733 |[Flood Fill](src/main/kotlin/g0701_0800/s0733_flood_fill/Solution.kt)| Easy | Array, Depth_First_Search, Breadth_First_Search, Matrix | 230 | 97.76
+| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find, Big_O_Time_O(M\*N)_Space_O(M\*N) | 252 | 95.41
-#### Day 5 Array
+#### Day 2 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
-| 0334 |[Increasing Triplet Subsequence](src/main/kotlin/g0301_0400/s0334_increasing_triplet_subsequence/Solution.kt)| Medium | Top_Interview_Questions, Array, Greedy | 672 | 60.61
-| 0238 |[Product of Array Except Self](src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Prefix_Sum | 669 | 48.96
-| 0560 |[Subarray Sum Equals K](src/main/kotlin/g0501_0600/s0560_subarray_sum_equals_k/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Hash_Table, Prefix_Sum | 692 | 53.27
+| 0695 |[Max Area of Island](src/main/kotlin/g0601_0700/s0695_max_area_of_island/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 181 | 93.83
+| 1254 |[Number of Closed Islands](src/main/kotlin/g1201_1300/s1254_number_of_closed_islands/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 177 | 89.47
-#### Day 6 String
+#### Day 3 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
-| 0415 |[Add Strings](src/main/kotlin/g0401_0500/s0415_add_strings/Solution.kt)| Easy | String, Math, Simulation | 296 | 76.00
-| 0409 |[Longest Palindrome](src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt)| Easy | String, Hash_Table, Greedy | 259 | 60.71
+| 1020 |[Number of Enclaves](src/main/kotlin/g1001_1100/s1020_number_of_enclaves/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 283 | 90.70
+| 1905 |[Count Sub Islands](src/main/kotlin/g1901_2000/s1905_count_sub_islands/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 866 | 100.00
-#### Day 7 String
+#### Day 4 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
-| 0290 |[Word Pattern](src/main/kotlin/g0201_0300/s0290_word_pattern/Solution.kt)| Easy | String, Hash_Table | 177 | 89.55
-| 0763 |[Partition Labels](src/main/kotlin/g0701_0800/s0763_partition_labels/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Greedy, Two_Pointers | 235 | 84.75
+| 1162 |[As Far from Land as Possible](src/main/kotlin/g1101_1200/s1162_as_far_from_land_as_possible/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search, Matrix | 362 | 81.25
+| 0417 |[Pacific Atlantic Water Flow](src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 319 | 100.00
-#### Day 8 String
+#### Day 5 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
-| 0049 |[Group Anagrams](src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, String, Hash_Table, Sorting | 506 | 86.55
-| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation | 390 | 56.25
+| 1091 |[Shortest Path in Binary Matrix](src/main/kotlin/g1001_1100/s1091_shortest_path_in_binary_matrix/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 305 | 98.28
+| 0542 |[01 Matrix](src/main/kotlin/g0501_0600/s0542_01_matrix/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search, Matrix | 441 | 94.06
-#### Day 9 String
+#### Day 6 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
-| 0187 |[Repeated DNA Sequences](src/main/kotlin/g0101_0200/s0187_repeated_dna_sequences/Solution.kt)| Medium | String, Hash_Table, Bit_Manipulation, Sliding_Window, Hash_Function, Rolling_Hash | 319 | 79.03
-| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming | 323 | 75.48
+| 0934 |[Shortest Bridge](src/main/kotlin/g0901_1000/s0934_shortest_bridge/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 301 | 80.95
+| 1926 |[Nearest Exit from Entrance in Maze](src/main/kotlin/g1901_2000/s1926_nearest_exit_from_entrance_in_maze/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix, LeetCode_75_Graphs/BFS | 351 | 94.44
-#### Day 10 Linked List
+#### Day 7 Standard Traversal
| | | | | |
|-|-|-|-|-|-
-| 0002 |[Add Two Numbers](src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Math, Linked_List, Recursion | 417 | 50.44
-| 0142 |[Linked List Cycle II](src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Hash_Table, Two_Pointers, Linked_List | 192 | 63.39
+| 0797 |[All Paths From Source to Target](src/main/kotlin/g0701_0800/s0797_all_paths_from_source_to_target/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Backtracking | 232 | 100.00
+| 0841 |[Keys and Rooms](src/main/kotlin/g0801_0900/s0841_keys_and_rooms/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, LeetCode_75_Graphs/DFS | 189 | 69.23
-#### Day 11 Linked List
+#### Day 8 Standard Traversal
| | | | | |
|-|-|-|-|-|-
-| 0160 |[Intersection of Two Linked Lists](src/main/kotlin/g0101_0200/s0160_intersection_of_two_linked_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List | 262 | 83.50
-| 0082 |[Remove Duplicates from Sorted List II](src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt)| Medium | Two_Pointers, Linked_List | 241 | 91.04
+| 0547 |[Number of Provinces](src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find, LeetCode_75_Graphs/DFS | 229 | 79.73
+| 1319 |[Number of Operations to Make Network Connected](src/main/kotlin/g1301_1400/s1319_number_of_operations_to_make_network_connected/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 379 | 83.33
-#### Day 12 Linked List
+#### Day 9 Standard Traversal
| | | | | |
|-|-|-|-|-|-
-| 0024 |[Swap Nodes in Pairs](src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt)| Medium | Top_100_Liked_Questions, Linked_List, Recursion | 149 | 99.39
-| 0707 |[Design Linked List](src/main/kotlin/g0701_0800/s0707_design_linked_list/MyLinkedList.kt)| Medium | Design, Linked_List | 243 | 100.00
+| 1376 |[Time Needed to Inform All Employees](src/main/kotlin/g1301_1400/s1376_time_needed_to_inform_all_employees/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree | 915 | 37.62
+| 0802 |[Find Eventual Safe States](src/main/kotlin/g0801_0900/s0802_find_eventual_safe_states/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Topological_Sort | 511 | 100.00
-#### Day 13 Linked List
+#### Day 10 Standard Traversal
| | | | | |
|-|-|-|-|-|-
-| 0025 |[Reverse Nodes in k-Group](src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt)| Hard | Top_100_Liked_Questions, Linked_List, Recursion | 194 | 87.72
-| 0143 |[Reorder List](src/main/kotlin/g0101_0200/s0143_reorder_list/Solution.kt)| Medium | Two_Pointers, Stack, Linked_List, Recursion | 395 | 82.26
+| 1129 |[Shortest Path with Alternating Colors](src/main/kotlin/g1101_1200/s1129_shortest_path_with_alternating_colors/Solution.kt)| Medium | Breadth_First_Search, Graph | 208 | 80.00
+| 1466 |[Reorder Routes to Make All Paths Lead to the City Zero](src/main/kotlin/g1401_1500/s1466_reorder_routes_to_make_all_paths_lead_to_the_city_zero/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, LeetCode_75_Graphs/DFS | 718 | 100.00
+| 0847 |[Shortest Path Visiting All Nodes](src/main/kotlin/g0801_0900/s0847_shortest_path_visiting_all_nodes/Solution.kt)| Hard | Dynamic_Programming, Breadth_First_Search, Bit_Manipulation, Graph, Bitmask | 164 | 100.00
-#### Day 14 Stack Queue
+#### Day 11 Breadth First Search
| | | | | |
|-|-|-|-|-|-
-| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design | 331 | 84.88
-| 1249 |[Minimum Remove to Make Valid Parentheses](src/main/kotlin/g1201_1300/s1249_minimum_remove_to_make_valid_parentheses/Solution.kt)| Medium | String, Stack | 218 | 100.00
-| 1823 |[Find the Winner of the Circular Game](src/main/kotlin/g1801_1900/s1823_find_the_winner_of_the_circular_game/Solution.kt)| Medium | Array, Math, Simulation, Recursion, Queue | 119 | 87.50
+| 1306 |[Jump Game III](src/main/kotlin/g1301_1400/s1306_jump_game_iii/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search | 291 | 100.00
+| 1654 |[Minimum Jumps to Reach Home](src/main/kotlin/g1601_1700/s1654_minimum_jumps_to_reach_home/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search | 192 | 100.00
+| 0365 |[Water and Jug Problem](src/main/kotlin/g0301_0400/s0365_water_and_jug_problem/Solution.kt)| Medium | Math, Depth_First_Search, Breadth_First_Search | 130 | 100.00
-#### Day 15 Tree
+#### Day 12 Breadth First Search
| | | | | |
|-|-|-|-|-|-
-| 0108 |[Convert Sorted Array to Binary Search Tree](src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt)| Easy | Top_Interview_Questions, Array, Tree, Binary_Tree, Binary_Search_Tree, Divide_and_Conquer | 334 | 35.39
-| 0105 |[Construct Binary Tree from Preorder and Inorder Traversal](src/main/kotlin/g0101_0200/s0105_construct_binary_tree_from_preorder_and_inorder_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Tree, Binary_Tree, Divide_and_Conquer | 370 | 58.31
-| 0103 |[Binary Tree Zigzag Level Order Traversal](src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt)| Medium | Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree | 316 | 34.25
+| 0433 |[Minimum Genetic Mutation](src/main/kotlin/g0401_0500/s0433_minimum_genetic_mutation/Solution.kt)| Medium | String, Hash_Table, Breadth_First_Search | 204 | 82.08
+| 0752 |[Open the Lock](src/main/kotlin/g0701_0800/s0752_open_the_lock/Solution.kt)| Medium | Array, String, Hash_Table, Breadth_First_Search | 310 | 100.00
+| 0127 |[Word Ladder](src/main/kotlin/g0101_0200/s0127_word_ladder/Solution.kt)| Hard | Top_Interview_Questions, String, Hash_Table, Breadth_First_Search | 396 | 98.68
-#### Day 16 Tree
+#### Day 13 Graph Theory
| | | | | |
|-|-|-|-|-|-
-| 0199 |[Binary Tree Right Side View](src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 194 | 92.89
-| 0113 |[Path Sum II](src/main/kotlin/g0101_0200/s0113_path_sum_ii/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, Backtracking | 364 | 78.67
-| 0450 |[Delete Node in a BST](src/main/kotlin/g0401_0500/s0450_delete_node_in_a_bst/Solution.kt)| Medium | Tree, Binary_Tree, Binary_Search_Tree | 257 | 84.62
+| 0997 |[Find the Town Judge](src/main/kotlin/g0901_1000/s0997_find_the_town_judge/Solution.kt)| Easy | Array, Hash_Table, Graph | 475 | 58.62
+| 1557 |[Minimum Number of Vertices to Reach All Nodes](src/main/kotlin/g1501_1600/s1557_minimum_number_of_vertices_to_reach_all_nodes/Solution.kt)| Medium | Graph | 792 | 99.29
-#### Day 17 Tree
+#### Day 14 Graph Theory
| | | | | |
|-|-|-|-|-|-
-| 0230 |[Kth Smallest Element in a BST](src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 393 | 33.33
-| 0173 |[Binary Search Tree Iterator](src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt)| Medium | Tree, Binary_Tree, Stack, Design, Binary_Search_Tree, Iterator | 563 | 46.91
+| 1615 |[Maximal Network Rank](src/main/kotlin/g1601_1700/s1615_maximal_network_rank/Solution.kt)| Medium | Graph | 282 | 100.00
+| 0886 |[Possible Bipartition](src/main/kotlin/g0801_0900/s0886_possible_bipartition/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 397 | 100.00
+| 0785 |[Is Graph Bipartite?](src/main/kotlin/g0701_0800/s0785_is_graph_bipartite/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 215 | 82.35
-#### Day 18 Tree
+### SQL I
+
+#### Day 1 Select
| | | | | |
|-|-|-|-|-|-
-| 0236 |[Lowest Common Ancestor of a Binary Tree](src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree | 386 | 45.21
-| 0297 |[Serialize and Deserialize Binary Tree](src/main/kotlin/g0201_0300/s0297_serialize_and_deserialize_binary_tree/Codec.kt)| Hard | Top_Interview_Questions, String, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Design | 475 | 78.85
+| 0595 |[Big Countries](src/main/kotlin/g0501_0600/s0595_big_countries/script.sql)| Easy | Database | 417 | 56.09
+| 1757 |[Recyclable and Low Fat Products](src/main/kotlin/g1701_1800/s1757_recyclable_and_low_fat_products/script.sql)| Easy | Database | 1237 | 34.20
+| 0584 |[Find Customer Referee](src/main/kotlin/g0501_0600/s0584_find_customer_referee/script.sql)| Easy | Database | 779 | 43.48
+| 0183 |[Customers Who Never Order](src/main/kotlin/g0101_0200/s0183_customers_who_never_order/script.sql)| Easy | Database | 712 | 33.67
-#### Day 19 Graph
+#### Day 2 Select and Order
| | | | | |
|-|-|-|-|-|-
-| 0997 |[Find the Town Judge](src/main/kotlin/g0901_1000/s0997_find_the_town_judge/Solution.kt)| Easy | Array, Hash_Table, Graph | 475 | 58.62
-| 1557 |[Minimum Number of Vertices to Reach All Nodes](src/main/kotlin/g1501_1600/s1557_minimum_number_of_vertices_to_reach_all_nodes/Solution.kt)| Medium | Graph | 792 | 99.29
-| 0841 |[Keys and Rooms](src/main/kotlin/g0801_0900/s0841_keys_and_rooms/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph | 189 | 69.23
+| 1873 |[Calculate Special Bonus](src/main/kotlin/g1801_1900/s1873_calculate_special_bonus/script.sql)| Easy | Database | 1321 | 33.12
+| 0627 |[Swap Salary](src/main/kotlin/g0601_0700/s0627_swap_salary/script.sql)| Easy | Database | 400 | 51.04
+| 0196 |[Delete Duplicate Emails](src/main/kotlin/g0101_0200/s0196_delete_duplicate_emails/script.sql)| Easy | Database | 593 | 94.17
-#### Day 20 Heap Priority Queue
+#### Day 3 String Processing Functions
| | | | | |
|-|-|-|-|-|-
-| 0215 |[Kth Largest Element in an Array](src/main/kotlin/g0201_0300/s0215_kth_largest_element_in_an_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Heap_Priority_Queue, Divide_and_Conquer, Quickselect | 839 | 34.43
-| 0347 |[Top K Frequent Elements](src/main/kotlin/g0301_0400/s0347_top_k_frequent_elements/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Sorting, Heap_Priority_Queue, Counting, Divide_and_Conquer, Quickselect, Bucket_Sort | 268 | 99.74
+| 1667 |[Fix Names in a Table](src/main/kotlin/g1601_1700/s1667_fix_names_in_a_table/script.sql)| Easy | Database | 1196 | 61.40
+| 1484 |[Group Sold Products By The Date](src/main/kotlin/g1401_1500/s1484_group_sold_products_by_the_date/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 899 | 40.76
+| 1527 |[Patients With a Condition](src/main/kotlin/g1501_1600/s1527_patients_with_a_condition/script.sql)| Easy | Database | 708 | 48.23
-#### Day 21 Heap Priority Queue
+#### Day 4 Union and Select
| | | | | |
|-|-|-|-|-|-
-| 0451 |[Sort Characters By Frequency](src/main/kotlin/g0401_0500/s0451_sort_characters_by_frequency/Solution.kt)| Medium | String, Hash_Table, Sorting, Heap_Priority_Queue, Counting, Bucket_Sort | 288 | 81.72
-| 0973 |[K Closest Points to Origin](src/main/kotlin/g0901_1000/s0973_k_closest_points_to_origin/Solution.kt)| Medium | Array, Math, Sorting, Heap_Priority_Queue, Divide_and_Conquer, Geometry, Quickselect | 800 | 37.89
-
-### Algorithm I
+| 1965 |[Employees With Missing Information](src/main/kotlin/g1901_2000/s1965_employees_with_missing_information/script.sql)| Easy | Database | 949 | 88.66
+| 1795 |[Rearrange Products Table](src/main/kotlin/g1701_1800/s1795_rearrange_products_table/script.sql)| Easy | Database | 1027 | 67.57
+| 0608 |[Tree Node](src/main/kotlin/g0601_0700/s0608_tree_node/script.sql)| Medium | LeetCode_Curated_SQL_70, Database | 794 | 48.38
+| 0176 |[Second Highest Salary](src/main/kotlin/g0101_0200/s0176_second_highest_salary/script.sql)| Medium | Database | 219 | 92.54
-#### Day 1 Binary Search
+#### Day 5 Union
| | | | | |
|-|-|-|-|-|-
-| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Array, Binary_Search | 261 | 77.91
-| 0278 |[First Bad Version](src/main/kotlin/g0201_0300/s0278_first_bad_version/Solution.kt)| Easy | Binary_Search, Interactive | 349 | 76.86
-| 0035 |[Search Insert Position](src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search | 267 | 50.32
+| 0175 |[Combine Two Tables](src/main/kotlin/g0101_0200/s0175_combine_two_tables/script.sql)| Easy | Database | 473 | 54.97
+| 1581 |[Customer Who Visited but Did Not Make Any Transactions](src/main/kotlin/g1501_1600/s1581_customer_who_visited_but_did_not_make_any_transactions/script.sql)| Easy | Database | 2771 | 54.68
+| 1148 |[Article Views I](src/main/kotlin/g1101_1200/s1148_article_views_i/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 806 | 54.41
-#### Day 2 Two Pointers
+#### Day 6 Union
| | | | | |
|-|-|-|-|-|-
-| 0977 |[Squares of a Sorted Array](src/main/kotlin/g0901_1000/s0977_squares_of_a_sorted_array/Solution.kt)| Easy | Array, Sorting, Two_Pointers | 375 | 18.43
-| 0189 |[Rotate Array](src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Two_Pointers | 483 | 86.95
+| 0197 |[Rising Temperature](src/main/kotlin/g0101_0200/s0197_rising_temperature/script.sql)| Easy | Database | 394 | 94.15
+| 0607 |[Sales Person](src/main/kotlin/g0601_0700/s0607_sales_person/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 2142 | 44.56
-#### Day 3 Two Pointers
+#### Day 7 Function
| | | | | |
|-|-|-|-|-|-
-| 0283 |[Move Zeroes](src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Two_Pointers | 516 | 79.07
-| 0167 |[Two Sum II - Input Array Is Sorted](src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers | 403 | 68.74
+| 1141 |[User Activity for the Past 30 Days I](src/main/kotlin/g1101_1200/s1141_user_activity_for_the_past_30_days_i/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 790 | 87.11
+| 1693 |[Daily Leads and Partners](src/main/kotlin/g1601_1700/s1693_daily_leads_and_partners/script.sql)| Easy | Database | 1115 | 52.84
+| 1729 |[Find Followers Count](src/main/kotlin/g1701_1800/s1729_find_followers_count/script.sql)| Easy | Database | 1228 | 38.04
-#### Day 4 Two Pointers
+#### Day 8 Function
| | | | | |
|-|-|-|-|-|-
-| 0344 |[Reverse String](src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers, Recursion | 445 | 69.75
-| 0557 |[Reverse Words in a String III](src/main/kotlin/g0501_0600/s0557_reverse_words_in_a_string_iii/Solution.kt)| Easy | String, Two_Pointers | 215 | 98.10
+| 0586 |[Customer Placing the Largest Number of Orders](src/main/kotlin/g0501_0600/s0586_customer_placing_the_largest_number_of_orders/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 768 | 44.85
+| 0511 |[Game Play Analysis I](src/main/kotlin/g0501_0600/s0511_game_play_analysis_i/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 790 | 45.04
+| 1890 |[The Latest Login in 2020](src/main/kotlin/g1801_1900/s1890_the_latest_login_in_2020/script.sql)| Easy | Database | 1280 | 43.62
+| 1741 |[Find Total Time Spent by Each Employee](src/main/kotlin/g1701_1800/s1741_find_total_time_spent_by_each_employee/script.sql)| Easy | Database | 1101 | 51.40
-#### Day 5 Two Pointers
+#### Day 9 Control of Flow
| | | | | |
|-|-|-|-|-|-
-| 0876 |[Middle of the Linked List](src/main/kotlin/g0801_0900/s0876_middle_of_the_linked_list/Solution.kt)| Easy | Two_Pointers, Linked_List | 136 | 76.52
-| 0019 |[Remove Nth Node From End of List](src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Two_Pointers, Linked_List | 180 | 91.58
+| 1393 |[Capital Gain/Loss](src/main/kotlin/g1301_1400/s1393_capital_gainloss/script.sql)| Medium | LeetCode_Curated_SQL_70, Database | 990 | 47.36
+| 1407 |[Top Travellers](src/main/kotlin/g1401_1500/s1407_top_travellers/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 1394 | 98.43
+| 1158 |[Market Analysis I](src/main/kotlin/g1101_1200/s1158_market_analysis_i/script.sql)| Medium | Database | 2470 | 44.76
-#### Day 6 Sliding Window
+#### Day 10 Where
| | | | | |
|-|-|-|-|-|-
-| 0003 |[Longest Substring Without Repeating Characters](src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window | 258 | 91.09
-| 0567 |[Permutation in String](src/main/kotlin/g0501_0600/s0567_permutation_in_string/Solution.kt)| Medium | String, Hash_Table, Two_Pointers, Sliding_Window | 169 | 100.00
+| 0182 |[Duplicate Emails](src/main/kotlin/g0101_0200/s0182_duplicate_emails/script.sql)| Easy | Database | 396 | 68.40
+| 1050 |[Actors and Directors Who Cooperated At Least Three Times](src/main/kotlin/g1001_1100/s1050_actors_and_directors_who_cooperated_at_least_three_times/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 629 | 81.02
+| 1587 |[Bank Account Summary II](src/main/kotlin/g1501_1600/s1587_bank_account_summary_ii/script.sql)| Easy | Database | 1582 | 52.96
+| 1084 |[Sales Analysis III](src/main/kotlin/g1001_1100/s1084_sales_analysis_iii/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 1881 | 79.36
-#### Day 7 Breadth First Search Depth First Search
+### Level 1
+
+#### Day 1 Prefix Sum
| | | | | |
|-|-|-|-|-|-
-| 0733 |[Flood Fill](src/main/kotlin/g0701_0800/s0733_flood_fill/Solution.kt)| Easy | Array, Depth_First_Search, Breadth_First_Search, Matrix | 230 | 97.76
-| 0695 |[Max Area of Island](src/main/kotlin/g0601_0700/s0695_max_area_of_island/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 324 | 24.06
+| 1480 |[Running Sum of 1d Array](src/main/kotlin/g1401_1500/s1480_running_sum_of_1d_array/Solution.kt)| Easy | Array, Prefix_Sum | 161 | 84.80
+| 0724 |[Find Pivot Index](src/main/kotlin/g0701_0800/s0724_find_pivot_index/Solution.kt)| Easy | Array, Prefix_Sum, LeetCode_75_Prefix_Sum | 255 | 88.92
-#### Day 8 Breadth First Search Depth First Search
+#### Day 2 String
| | | | | |
|-|-|-|-|-|-
-| 0617 |[Merge Two Binary Trees](src/main/kotlin/g0601_0700/s0617_merge_two_binary_trees/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 243 | 72.83
-| 0116 |[Populating Next Right Pointers in Each Node](src/main/kotlin/g0101_0200/s0116_populating_next_right_pointers_in_each_node/Solution.kt)| Medium | Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Linked_List | 355 | 69.02
+| 0205 |[Isomorphic Strings](src/main/kotlin/g0201_0300/s0205_isomorphic_strings/Solution.kt)| Easy | String, Hash_Table | 278 | 79.96
+| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers, LeetCode_75_Two_Pointers | 156 | 87.74
-#### Day 9 Breadth First Search Depth First Search
+#### Day 3 Linked List
| | | | | |
|-|-|-|-|-|-
-| 0542 |[01 Matrix](src/main/kotlin/g0501_0600/s0542_01_matrix/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search, Matrix | 441 | 94.06
-| 0994 |[Rotting Oranges](src/main/kotlin/g0901_1000/s0994_rotting_oranges/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 164 | 82.95
+| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, Big_O_Time_O(m+n)_Space_O(m+n) | 157 | 92.24
+| 0206 |[Reverse Linked List](src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, LeetCode_75_LinkedList, Big_O_Time_O(N)_Space_O(1) | 279 | 45.78
-#### Day 10 Recursion Backtracking
+#### Day 4 Linked List
| | | | | |
|-|-|-|-|-|-
-| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion | 176 | 96.25
-| 0206 |[Reverse Linked List](src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion | 279 | 45.78
+| 0876 |[Middle of the Linked List](src/main/kotlin/g0801_0900/s0876_middle_of_the_linked_list/Solution.kt)| Easy | Two_Pointers, Linked_List | 136 | 76.52
+| 0142 |[Linked List Cycle II](src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Hash_Table, Two_Pointers, Linked_List, Big_O_Time_O(N)_Space_O(1) | 192 | 63.39
-#### Day 11 Recursion Backtracking
+#### Day 5 Greedy
| | | | | |
|-|-|-|-|-|-
-| 0077 |[Combinations](src/main/kotlin/g0001_0100/s0077_combinations/Solution.kt)| Medium | Backtracking | 244 | 100.00
-| 0046 |[Permutations](src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Backtracking | 186 | 100.00
-| 0784 |[Letter Case Permutation](src/main/kotlin/g0701_0800/s0784_letter_case_permutation/Solution.kt)| Medium | String, Bit_Manipulation, Backtracking | 219 | 84.62
+| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Big_O_Time_O(N)_Space_O(1) | 609 | 94.06
+| 0409 |[Longest Palindrome](src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt)| Easy | String, Hash_Table, Greedy | 259 | 60.71
-#### Day 12 Dynamic Programming
+#### Day 6 Tree
| | | | | |
|-|-|-|-|-|-
-| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization | 127 | 97.06
-| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 156 | 92.24
-| 0120 |[Triangle](src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt)| Medium | Array, Dynamic_Programming | 194 | 97.87
+| 0589 |[N-ary Tree Preorder Traversal](src/main/kotlin/g0501_0600/s0589_n_ary_tree_preorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Stack | 233 | 84.02
+| 0102 |[Binary Tree Level Order Traversal](src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(N) | 198 | 95.14
-#### Day 13 Bit Manipulation
+#### Day 7 Binary Search
| | | | | |
|-|-|-|-|-|-
-| 0231 |[Power of Two](src/main/kotlin/g0201_0300/s0231_power_of_two/Solution.kt)| Easy | Math, Bit_Manipulation, Recursion | 161 | 86.81
-| 0191 |[Number of 1 Bits](src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation | 237 | 68.44
+| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search | 261 | 77.91
+| 0278 |[First Bad Version](src/main/kotlin/g0201_0300/s0278_first_bad_version/Solution.kt)| Easy | Binary_Search, Interactive | 349 | 76.86
-#### Day 14 Bit Manipulation
+#### Day 8 Binary Search Tree
| | | | | |
|-|-|-|-|-|-
-| 0190 |[Reverse Bits](src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation, Divide_and_Conquer | 198 | 81.82
-| 0136 |[Single Number](src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation | 344 | 83.63
-
-### Algorithm II
+| 0098 |[Validate Binary Search Tree](src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree, Big_O_Time_O(N)_Space_O(log(N)) | 190 | 61.62
+| 0235 |[Lowest Common Ancestor of a Binary Search Tree](src/main/kotlin/g0201_0300/s0235_lowest_common_ancestor_of_a_binary_search_tree/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 404 | 75.59
-#### Day 1 Binary Search
+#### Day 9 Graph/BFS/DFS
| | | | | |
|-|-|-|-|-|-
-| 0034 |[Find First and Last Position of Element in Sorted Array](src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search | 228 | 83.38
-| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search | 184 | 86.08
-| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix | 290 | 40.17
+| 0733 |[Flood Fill](src/main/kotlin/g0701_0800/s0733_flood_fill/Solution.kt)| Easy | Array, Depth_First_Search, Breadth_First_Search, Matrix | 230 | 97.76
+| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find, Big_O_Time_O(M\*N)_Space_O(M\*N) | 252 | 95.41
-#### Day 2 Binary Search
+#### Day 10 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 0153 |[Find Minimum in Rotated Sorted Array](src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search | 262 | 60.96
-| 0162 |[Find Peak Element](src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt)| Medium | Top_Interview_Questions, Array, Binary_Search | 297 | 53.85
+| 0509 |[Fibonacci Number](src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Recursion, Memoization | 139 | 82.72
+| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization, Big_O_Time_O(n)_Space_O(n) | 124 | 71.98
-#### Day 3 Two Pointers
+#### Day 11 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 0082 |[Remove Duplicates from Sorted List II](src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt)| Medium | Two_Pointers, Linked_List | 241 | 91.04
-| 0015 |[3Sum](src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers | 761 | 90.55
+| 0746 |[Min Cost Climbing Stairs](src/main/kotlin/g0701_0800/s0746_min_cost_climbing_stairs/Solution.kt)| Easy | Array, Dynamic_Programming, LeetCode_75_DP/1D | 171 | 96.76
+| 0062 |[Unique Paths](src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Combinatorics, LeetCode_75_DP/Multidimensional, Big_O_Time_O(m\*n)_Space_O(m\*n) | 118 | 94.65
-#### Day 4 Two Pointers
+#### Day 12 Sliding Window/Two Pointer
| | | | | |
|-|-|-|-|-|-
-| 0844 |[Backspace String Compare](src/main/kotlin/g0801_0900/s0844_backspace_string_compare/Solution.kt)| Easy | String, Two_Pointers, Stack, Simulation | 126 | 98.31
-| 0986 |[Interval List Intersections](src/main/kotlin/g0901_1000/s0986_interval_list_intersections/Solution.kt)| Medium | Array, Two_Pointers | 318 | 60.98
-| 0011 |[Container With Most Water](src/main/kotlin/g0001_0100/s0011_container_with_most_water/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Greedy, Two_Pointers | 474 | 89.18
+| 0438 |[Find All Anagrams in a String](src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(n+m)_Space_O(1) | 561 | 54.68
+| 0424 |[Longest Repeating Character Replacement](src/main/kotlin/g0401_0500/s0424_longest_repeating_character_replacement/Solution.kt)| Medium | String, Hash_Table, Sliding_Window | 288 | 84.38
-#### Day 5 Sliding Window
+#### Day 13 Hashmap
| | | | | |
|-|-|-|-|-|-
-| 0438 |[Find All Anagrams in a String](src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Sliding_Window | 561 | 54.68
-| 0713 |[Subarray Product Less Than K](src/main/kotlin/g0701_0800/s0713_subarray_product_less_than_k/Solution.kt)| Medium | Array, Sliding_Window | 336 | 92.11
-| 0209 |[Minimum Size Subarray Sum](src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt)| Medium | Array, Binary_Search, Prefix_Sum, Sliding_Window | 315 | 96.73
+| 0001 |[Two Sum](src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Big_O_Time_O(n)_Space_O(n), AI_can_be_used_to_solve_the_task | 202 | 91.18
+| 0299 |[Bulls and Cows](src/main/kotlin/g0201_0300/s0299_bulls_and_cows/Solution.kt)| Medium | String, Hash_Table, Counting | 254 | 84.82
-#### Day 6 Breadth First Search Depth First Search
+#### Day 14 Stack
| | | | | |
|-|-|-|-|-|-
-| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 252 | 95.41
-| 0547 |[Number of Provinces](src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 229 | 79.73
+| 0844 |[Backspace String Compare](src/main/kotlin/g0801_0900/s0844_backspace_string_compare/Solution.kt)| Easy | String, Two_Pointers, Stack, Simulation | 126 | 98.31
+| 0394 |[Decode String](src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Stack, Recursion, LeetCode_75_Stack, Big_O_Time_O(n)_Space_O(n) | 224 | 64.86
-#### Day 7 Breadth First Search Depth First Search
+#### Day 15 Heap
| | | | | |
|-|-|-|-|-|-
-| 0117 |[Populating Next Right Pointers in Each Node II](src/main/kotlin/g0101_0200/s0117_populating_next_right_pointers_in_each_node_ii/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Linked_List | 199 | 94.67
-| 0572 |[Subtree of Another Tree](src/main/kotlin/g0501_0600/s0572_subtree_of_another_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Hash_Function, String_Matching | 214 | 92.39
+| 1046 |[Last Stone Weight](src/main/kotlin/g1001_1100/s1046_last_stone_weight/Solution.kt)| Easy | Array, Heap_Priority_Queue | 123 | 100.00
+| 0692 |[Top K Frequent Words](src/main/kotlin/g0601_0700/s0692_top_k_frequent_words/Solution.kt)| Medium | String, Hash_Table, Sorting, Heap_Priority_Queue, Counting, Trie, Bucket_Sort | 239 | 81.10
-#### Day 8 Breadth First Search Depth First Search
+### Level 2
+
+#### Day 1 Implementation/Simulation
| | | | | |
|-|-|-|-|-|-
-| 1091 |[Shortest Path in Binary Matrix](src/main/kotlin/g1001_1100/s1091_shortest_path_in_binary_matrix/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 305 | 98.28
-| 0130 |[Surrounded Regions](src/main/kotlin/g0101_0200/s0130_surrounded_regions/Solution.kt)| Medium | Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 355 | 84.42
-| 0797 |[All Paths From Source to Target](src/main/kotlin/g0701_0800/s0797_all_paths_from_source_to_target/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Backtracking | 232 | 100.00
+| 0202 |[Happy Number](src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt)| Easy | Top_Interview_Questions, Hash_Table, Math, Two_Pointers | 261 | 45.08
+| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Matrix, Simulation | 132 | 95.12
+| 1706 |[Where Will the Ball Fall](src/main/kotlin/g1701_1800/s1706_where_will_the_ball_fall/Solution.kt)| Medium | Array, Dynamic_Programming, Depth_First_Search, Matrix, Simulation | 270 | 67.86
-#### Day 9 Recursion Backtracking
+#### Day 2 String
| | | | | |
|-|-|-|-|-|-
-| 0078 |[Subsets](src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, Backtracking | 191 | 97.44
-| 0090 |[Subsets II](src/main/kotlin/g0001_0100/s0090_subsets_ii/Solution.kt)| Medium | Array, Bit_Manipulation, Backtracking | 366 | 58.09
+| 0014 |[Longest Common Prefix](src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String | 154 | 89.70
+| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation | 165 | 96.72
-#### Day 10 Recursion Backtracking
+#### Day 3 Linked List
| | | | | |
|-|-|-|-|-|-
-| 0047 |[Permutations II](src/main/kotlin/g0001_0100/s0047_permutations_ii/Solution.kt)| Medium | Array, Backtracking | 406 | 76.36
-| 0039 |[Combination Sum](src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Backtracking | 317 | 86.85
-| 0040 |[Combination Sum II](src/main/kotlin/g0001_0100/s0040_combination_sum_ii/Solution.kt)| Medium | Array, Backtracking | 348 | 80.92
+| 0019 |[Remove Nth Node From End of List](src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Two_Pointers, Linked_List, Big_O_Time_O(L)_Space_O(L) | 144 | 96.28
+| 0234 |[Palindrome Linked List](src/main/kotlin/g0201_0300/s0234_palindrome_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Two_Pointers, Stack, Linked_List, Recursion, Big_O_Time_O(n)_Space_O(1) | 641 | 79.53
-#### Day 11 Recursion Backtracking
+#### Day 4 Linked List
| | | | | |
|-|-|-|-|-|-
-| 0017 |[Letter Combinations of a Phone Number](src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Backtracking | 262 | 73.59
-| 0022 |[Generate Parentheses](src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Backtracking | 210 | 78.51
-| 0079 |[Word Search](src/main/kotlin/g0001_0100/s0079_word_search/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Matrix, Backtracking | 463 | 68.49
+| 0328 |[Odd Even Linked List](src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt)| Medium | Linked_List, LeetCode_75_LinkedList | 216 | 86.96
+| 0148 |[Sort List](src/main/kotlin/g0101_0200/s0148_sort_list/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Sorting, Two_Pointers, Linked_List, Divide_and_Conquer, Merge_Sort, Big_O_Time_O(log(N))_Space_O(log(N)) | 820 | 61.70
-#### Day 12 Dynamic Programming
+#### Day 5 Greedy
| | | | | |
|-|-|-|-|-|-
-| 0213 |[House Robber II](src/main/kotlin/g0201_0300/s0213_house_robber_ii/Solution.kt)| Medium | Array, Dynamic_Programming | 257 | 59.62
-| 0055 |[Jump Game](src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Greedy | 670 | 66.67
+| 2131 |[Longest Palindrome by Concatenating Two Letter Words](src/main/kotlin/g2101_2200/s2131_longest_palindrome_by_concatenating_two_letter_words/Solution.kt)| Medium | Array, String, Hash_Table, Greedy, Counting | 607 | 90.00
+| 0621 |[Task Scheduler](src/main/kotlin/g0601_0700/s0621_task_scheduler/Solution.kt)| Medium | Array, Hash_Table, Sorting, Greedy, Heap_Priority_Queue, Counting | 266 | 98.36
-#### Day 13 Dynamic Programming
+#### Day 6 Tree
| | | | | |
|-|-|-|-|-|-
-| 0045 |[Jump Game II](src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Greedy | 227 | 98.14
-| 0062 |[Unique Paths](src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Combinatorics | 209 | 49.18
+| 0226 |[Invert Binary Tree](src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(n)_Space_O(n) | 233 | 54.90
+| 0110 |[Balanced Binary Tree](src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree | 182 | 71.30
-#### Day 14 Dynamic Programming
+#### Day 7 Tree
| | | | | |
|-|-|-|-|-|-
-| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming | 323 | 75.48
-| 0413 |[Arithmetic Slices](src/main/kotlin/g0401_0500/s0413_arithmetic_slices/Solution.kt)| Medium | Array, Dynamic_Programming | 156 | 100.00
+| 0543 |[Diameter of Binary Tree](src/main/kotlin/g0501_0600/s0543_diameter_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, Big_O_Time_O(n)_Space_O(n) | 307 | 43.93
+| 0437 |[Path Sum III](src/main/kotlin/g0401_0500/s0437_path_sum_iii/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(n)_Space_O(n) | 403 | 54.12
-#### Day 15 Dynamic Programming
+#### Day 8 Binary Search
| | | | | |
|-|-|-|-|-|-
-| 0091 |[Decode Ways](src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt)| Medium | Top_Interview_Questions, String, Dynamic_Programming | 237 | 76.88
-| 0139 |[Word Break](src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Dynamic_Programming, Trie, Memoization | 197 | 87.17
+| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix, Big_O_Time_O(endRow+endCol)_Space_O(1) | 159 | 74.46
+| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 151 | 93.77
-#### Day 16 Dynamic Programming
+#### Day 9 Binary Search Tree
| | | | | |
|-|-|-|-|-|-
-| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Binary_Search | 318 | 82.28
-| 0673 |[Number of Longest Increasing Subsequence](src/main/kotlin/g0601_0700/s0673_number_of_longest_increasing_subsequence/Solution.kt)| Medium | Array, Dynamic_Programming, Segment_Tree, Binary_Indexed_Tree | 226 | 91.67
+| 0108 |[Convert Sorted Array to Binary Search Tree](src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt)| Easy | Top_Interview_Questions, Array, Tree, Binary_Tree, Binary_Search_Tree, Divide_and_Conquer | 167 | 80.29
+| 0230 |[Kth Smallest Element in a BST](src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree, Big_O_Time_O(n)_Space_O(n) | 393 | 33.33
+| 0173 |[Binary Search Tree Iterator](src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt)| Medium | Tree, Binary_Tree, Stack, Design, Binary_Search_Tree, Iterator | 563 | 46.91
-#### Day 17 Dynamic Programming
+#### Day 10 Graph/BFS/DFS
| | | | | |
|-|-|-|-|-|-
-| 1143 |[Longest Common Subsequence](src/main/kotlin/g1101_1200/s1143_longest_common_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming | 307 | 38.36
-| 0583 |[Delete Operation for Two Strings](src/main/kotlin/g0501_0600/s0583_delete_operation_for_two_strings/Solution.kt)| Medium | String, Dynamic_Programming | 197 | 100.00
+| 0994 |[Rotting Oranges](src/main/kotlin/g0901_1000/s0994_rotting_oranges/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Breadth_First_Search, Matrix, LeetCode_75_Graphs/BFS | 164 | 82.95
+| 0417 |[Pacific Atlantic Water Flow](src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 319 | 100.00
-#### Day 18 Dynamic Programming
+#### Day 11 Graph/BFS/DFS
| | | | | |
|-|-|-|-|-|-
-| 0072 |[Edit Distance](src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt)| Hard | Top_100_Liked_Questions, String, Dynamic_Programming | 320 | 63.53
-| 0322 |[Coin Change](src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Breadth_First_Search | 332 | 50.68
-| 0343 |[Integer Break](src/main/kotlin/g0301_0400/s0343_integer_break/Solution.kt)| Medium | Dynamic_Programming, Math | 218 | 63.89
+| 0210 |[Course Schedule II](src/main/kotlin/g0201_0300/s0210_course_schedule_ii/Solution.kt)| Medium | Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Graph, Topological_Sort | 266 | 96.32
+| 0815 |[Bus Routes](src/main/kotlin/g0801_0900/s0815_bus_routes/Solution.kt)| Hard | Array, Hash_Table, Breadth_First_Search | 429 | 100.00
-#### Day 19 Bit Manipulation
+#### Day 12 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 0201 |[Bitwise AND of Numbers Range](src/main/kotlin/g0201_0300/s0201_bitwise_and_of_numbers_range/Solution.kt)| Medium | Bit_Manipulation | 368 | 80.00
+| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, LeetCode_75_DP/1D, Big_O_Time_O(n)_Space_O(n) | 156 | 92.24
+| 0322 |[Coin Change](src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Breadth_First_Search, Big_O_Time_O(m\*n)_Space_O(amount) | 332 | 50.68
-#### Day 20 Others
+#### Day 13 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 0384 |[Shuffle an Array](src/main/kotlin/g0301_0400/s0384_shuffle_an_array/Solution.kt)| Medium | Top_Interview_Questions, Array, Math, Randomized | 940 | 72.09
+| 0416 |[Partition Equal Subset Sum](src/main/kotlin/g0401_0500/s0416_partition_equal_subset_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Big_O_Time_O(n\*sums)_Space_O(n\*sums) | 204 | 98.82
+| 0152 |[Maximum Product Subarray](src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Big_O_Time_O(N)_Space_O(1) | 253 | 88.42
-#### Day 21 Others
+#### Day 14 Sliding Window/Two Pointer
| | | | | |
|-|-|-|-|-|-
-| 0202 |[Happy Number](src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt)| Easy | Top_Interview_Questions, Hash_Table, Math, Two_Pointers | 261 | 45.08
-| 0149 |[Max Points on a Line](src/main/kotlin/g0101_0200/s0149_max_points_on_a_line/Solution.kt)| Hard | Top_Interview_Questions, Array, Hash_Table, Math, Geometry | 307 | 83.33
+| 0003 |[Longest Substring Without Repeating Characters](src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(n)_Space_O(1), AI_can_be_used_to_solve_the_task | 201 | 87.28
+| 0016 |[3Sum Closest](src/main/kotlin/g0001_0100/s0016_3sum_closest/Solution.kt)| Medium | Array, Sorting, Two_Pointers | 163 | 100.00
+| 0076 |[Minimum Window Substring](src/main/kotlin/g0001_0100/s0076_minimum_window_substring/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(s.length())_Space_O(1) | 191 | 96.38
-### Binary Search I
-
-#### Day 1
+#### Day 15 Tree
| | | | | |
|-|-|-|-|-|-
-| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Array, Binary_Search | 261 | 77.91
-| 0374 |[Guess Number Higher or Lower](src/main/kotlin/g0301_0400/s0374_guess_number_higher_or_lower/Solution.kt)| Easy | Binary_Search, Interactive | 134 | 94.19
+| 0100 |[Same Tree](src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 134 | 86.63
+| 0101 |[Symmetric Tree](src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(log(N)) | 153 | 82.35
+| 0199 |[Binary Tree Right Side View](src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/BFS | 194 | 92.89
-#### Day 2
+#### Day 16 Design
| | | | | |
|-|-|-|-|-|-
-| 0035 |[Search Insert Position](src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search | 267 | 50.32
-| 0852 |[Peak Index in a Mountain Array](src/main/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/Solution.kt)| Easy | Array, Binary_Search | 433 | 94.29
+| 0232 |[Implement Queue using Stacks](src/main/kotlin/g0201_0300/s0232_implement_queue_using_stacks/MyQueue.kt)| Easy | Stack, Design, Queue | 258 | 70.86
+| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design, Big_O_Time_O(1)_Space_O(N) | 331 | 84.88
+| 0208 |[Implement Trie (Prefix Tree)](src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Design, Trie, LeetCode_75_Trie, Big_O_Time_O(word.length())_or_O(prefix.length())_Space_O(N) | 689 | 61.00
-#### Day 3
+#### Day 17 Interval
| | | | | |
|-|-|-|-|-|-
-| 0367 |[Valid Perfect Square](src/main/kotlin/g0301_0400/s0367_valid_perfect_square/Solution.kt)| Easy | Math, Binary_Search | 137 | 94.55
-| 1385 |[Find the Distance Value Between Two Arrays](src/main/kotlin/g1301_1400/s1385_find_the_distance_value_between_two_arrays/Solution.kt)| Easy | Array, Sorting, Binary_Search, Two_Pointers | 190 | 84.62
+| 0057 |[Insert Interval](src/main/kotlin/g0001_0100/s0057_insert_interval/Solution.kt)| Medium | Array | 249 | 75.63
+| 0056 |[Merge Intervals](src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Big_O_Time_O(n_log_n)_Space_O(n) | 334 | 80.67
-#### Day 4
+#### Day 18 Stack
| | | | | |
|-|-|-|-|-|-
-| 0069 |[Sqrt(x)](src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt)| Easy | Top_Interview_Questions, Math, Binary_Search | 153 | 95.75
-| 0744 |[Find Smallest Letter Greater Than Target](src/main/kotlin/g0701_0800/s0744_find_smallest_letter_greater_than_target/Solution.kt)| Easy | Array, Binary_Search | 162 | 100.00
+| 0735 |[Asteroid Collision](src/main/kotlin/g0701_0800/s0735_asteroid_collision/Solution.kt)| Medium | Array, Stack, LeetCode_75_Stack | 243 | 100.00
+| 0227 |[Basic Calculator II](src/main/kotlin/g0201_0300/s0227_basic_calculator_ii/Solution.kt)| Medium | String, Math, Stack | 383 | 62.50
-#### Day 5
+#### Day 19 Union Find
| | | | | |
|-|-|-|-|-|-
-| 0278 |[First Bad Version](src/main/kotlin/g0201_0300/s0278_first_bad_version/Solution.kt)| Easy | Binary_Search, Interactive | 349 | 76.86
-| 0034 |[Find First and Last Position of Element in Sorted Array](src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search | 228 | 83.38
+| 0547 |[Number of Provinces](src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find, LeetCode_75_Graphs/DFS | 229 | 79.73
+| 0947 |[Most Stones Removed with Same Row or Column](src/main/kotlin/g0901_1000/s0947_most_stones_removed_with_same_row_or_column/Solution.kt)| Medium | Depth_First_Search, Graph, Union_Find | 200 | 100.00
-#### Day 6
+#### Day 20 Brute Force/Backtracking
| | | | | |
|-|-|-|-|-|-
-| 0441 |[Arranging Coins](src/main/kotlin/g0401_0500/s0441_arranging_coins/Solution.kt)| Easy | Math, Binary_Search | 150 | 84.21
-| 1539 |[Kth Missing Positive Number](src/main/kotlin/g1501_1600/s1539_kth_missing_positive_number/Solution.kt)| Easy | Array, Binary_Search | 153 | 100.00
+| 0039 |[Combination Sum](src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Backtracking, Big_O_Time_O(2^n)_Space_O(n+2^n) | 226 | 88.89
+| 0046 |[Permutations](src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Backtracking, Big_O_Time_O(n\*n!)_Space_O(n+n!) | 188 | 99.00
-#### Day 7
+### Udemy
+
+#### Udemy Integers
| | | | | |
|-|-|-|-|-|-
-| 0167 |[Two Sum II - Input Array Is Sorted](src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers | 403 | 68.74
-| 1608 |[Special Array With X Elements Greater Than or Equal X](src/main/kotlin/g1601_1700/s1608_special_array_with_x_elements_greater_than_or_equal_x/Solution.kt)| Easy | Array, Sorting, Binary_Search | 147 | 81.82
+| 0412 |[Fizz Buzz](src/main/kotlin/g0401_0500/s0412_fizz_buzz/Solution.kt)| Easy | String, Math, Simulation | 307 | 71.81
+| 0136 |[Single Number](src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, LeetCode_75_Bit_Manipulation, Big_O_Time_O(N)_Space_O(1) | 344 | 83.63
+| 0007 |[Reverse Integer](src/main/kotlin/g0001_0100/s0007_reverse_integer/Solution.kt)| Medium | Top_Interview_Questions, Math | 149 | 77.89
+| 0009 |[Palindrome Number](src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt)| Easy | Math | 217 | 95.34
+| 0172 |[Factorial Trailing Zeroes](src/main/kotlin/g0101_0200/s0172_factorial_trailing_zeroes/Solution.kt)| Medium | Top_Interview_Questions, Math | 220 | 67.65
+| 0050 |[Pow(x, n)](src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt)| Medium | Top_Interview_Questions, Math, Recursion | 172 | 38.68
-#### Day 8
+#### Udemy Strings
| | | | | |
|-|-|-|-|-|-
-| 1351 |[Count Negative Numbers in a Sorted Matrix](src/main/kotlin/g1301_1400/s1351_count_negative_numbers_in_a_sorted_matrix/Solution.kt)| Easy | Array, Binary_Search, Matrix | 206 | 71.43
-| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix | 290 | 40.17
+| 0344 |[Reverse String](src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt)| Easy | String, Two_Pointers, Recursion | 445 | 69.75
+| 0014 |[Longest Common Prefix](src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String | 154 | 89.70
+| 0187 |[Repeated DNA Sequences](src/main/kotlin/g0101_0200/s0187_repeated_dna_sequences/Solution.kt)| Medium | String, Hash_Table, Bit_Manipulation, Sliding_Window, Hash_Function, Rolling_Hash | 319 | 79.03
+| 0003 |[Longest Substring Without Repeating Characters](src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(n)_Space_O(1), AI_can_be_used_to_solve_the_task | 201 | 87.28
+| 0020 |[Valid Parentheses](src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String, Stack, Big_O_Time_O(n)_Space_O(n) | 137 | 88.76
+| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Big_O_Time_O(n)_Space_O(n) | 162 | 99.00
+| 0394 |[Decode String](src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Stack, Recursion, LeetCode_75_Stack, Big_O_Time_O(n)_Space_O(n) | 224 | 64.86
+| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | String, Hash_Table, Sorting | 251 | 87.65
+| 0049 |[Group Anagrams](src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, String, Hash_Table, Sorting, Big_O_Time_O(n\*k_log_k)_Space_O(n) | 308 | 96.34
+| 0151 |[Reverse Words in a String](src/main/kotlin/g0101_0200/s0151_reverse_words_in_a_string/Solution.kt)| Medium | String, Two_Pointers, LeetCode_75_Array/String | 206 | 98.90
+| 0273 |[Integer to English Words](src/main/kotlin/g0201_0300/s0273_integer_to_english_words/Solution.kt)| Hard | String, Math, Recursion | 273 | 82.93
-#### Day 9
+#### Udemy Binary Search
| | | | | |
|-|-|-|-|-|-
-| 1337 |[The K Weakest Rows in a Matrix](src/main/kotlin/g1301_1400/s1337_the_k_weakest_rows_in_a_matrix/Solution.kt)| Easy | Array, Sorting, Binary_Search, Matrix, Heap_Priority_Queue | 216 | 77.59
-| 1346 |[Check If N and Its Double Exist](src/main/kotlin/g1301_1400/s1346_check_if_n_and_its_double_exist/Solution.kt)| Easy | Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 175 | 70.83
+| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search | 261 | 77.91
+| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 151 | 93.77
+| 0153 |[Find Minimum in Rotated Sorted Array](src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Big_O_Time_O(log_N)_Space_O(log_N) | 262 | 60.96
-#### Day 10
+#### Udemy Arrays
| | | | | |
|-|-|-|-|-|-
-| 0350 |[Intersection of Two Arrays II](src/main/kotlin/g0301_0400/s0350_intersection_of_two_arrays_ii/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 321 | 73.37
-| 0633 |[Sum of Square Numbers](src/main/kotlin/g0601_0700/s0633_sum_of_square_numbers/Solution.kt)| Medium | Math, Binary_Search, Two_Pointers | 126 | 100.00
+| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Big_O_Time_O(N)_Space_O(1) | 609 | 94.06
+| 0283 |[Move Zeroes](src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Two_Pointers, LeetCode_75_Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 516 | 79.07
+| 0001 |[Two Sum](src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Big_O_Time_O(n)_Space_O(n), AI_can_be_used_to_solve_the_task | 202 | 91.18
+| 0217 |[Contains Duplicate](src/main/kotlin/g0201_0300/s0217_contains_duplicate/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting | 719 | 73.49
+| 0058 |[Length of Last Word](src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt)| Easy | String | 135 | 93.67
+| 0605 |[Can Place Flowers](src/main/kotlin/g0601_0700/s0605_can_place_flowers/Solution.kt)| Easy | Array, Greedy, LeetCode_75_Array/String | 209 | 85.71
+| 0122 |[Best Time to Buy and Sell Stock II](src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt)| Medium | Top_Interview_Questions, Array, Dynamic_Programming, Greedy | 197 | 95.10
+| 0080 |[Remove Duplicates from Sorted Array II](src/main/kotlin/g0001_0100/s0080_remove_duplicates_from_sorted_array_ii/Solution.kt)| Medium | Array, Two_Pointers | 192 | 80.67
+| 0189 |[Rotate Array](src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 483 | 86.95
+| 0055 |[Jump Game](src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Greedy, Big_O_Time_O(n)_Space_O(1) | 332 | 89.35
+| 0075 |[Sort Colors](src/main/kotlin/g0001_0100/s0075_sort_colors/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 164 | 64.43
+| 0066 |[Plus One](src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt)| Easy | Top_Interview_Questions, Array, Math | 148 | 98.75
+| 0238 |[Product of Array Except Self](src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Prefix_Sum, LeetCode_75_Array/String, Big_O_Time_O(n^2)_Space_O(n) | 669 | 48.96
+| 1291 |[Sequential Digits](src/main/kotlin/g1201_1300/s1291_sequential_digits/Solution.kt)| Medium | Enumeration | 114 | 100.00
+| 0448 |[Find All Numbers Disappeared in an Array](src/main/kotlin/g0401_0500/s0448_find_all_numbers_disappeared_in_an_array/Solution.kt)| Easy | Array, Hash_Table | 394 | 100.00
+| 0442 |[Find All Duplicates in an Array](src/main/kotlin/g0401_0500/s0442_find_all_duplicates_in_an_array/Solution.kt)| Medium | Array, Hash_Table | 480 | 73.81
+| 0041 |[First Missing Positive](src/main/kotlin/g0001_0100/s0041_first_missing_positive/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Big_O_Time_O(n)_Space_O(n) | 357 | 97.17
+| 0697 |[Degree of an Array](src/main/kotlin/g0601_0700/s0697_degree_of_an_array/Solution.kt)| Easy | Array, Hash_Table | 289 | 84.62
+| 0532 |[K-diff Pairs in an Array](src/main/kotlin/g0501_0600/s0532_k_diff_pairs_in_an_array/Solution.kt)| Medium | Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 230 | 84.62
+| 0713 |[Subarray Product Less Than K](src/main/kotlin/g0701_0800/s0713_subarray_product_less_than_k/Solution.kt)| Medium | Array, Sliding_Window | 336 | 92.11
+| 1007 |[Minimum Domino Rotations For Equal Row](src/main/kotlin/g1001_1100/s1007_minimum_domino_rotations_for_equal_row/Solution.kt)| Medium | Array, Greedy | 421 | 50.00
+| 1306 |[Jump Game III](src/main/kotlin/g1301_1400/s1306_jump_game_iii/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search | 291 | 100.00
+| 0456 |[132 Pattern](src/main/kotlin/g0401_0500/s0456_132_pattern/Solution.kt)| Medium | Array, Binary_Search, Stack, Ordered_Set, Monotonic_Stack | 434 | 100.00
+| 0239 |[Sliding Window Maximum](src/main/kotlin/g0201_0300/s0239_sliding_window_maximum/Solution.kt)| Hard | Top_100_Liked_Questions, Array, Heap_Priority_Queue, Sliding_Window, Queue, Monotonic_Queue, Big_O_Time_O(n\*k)_Space_O(n+k) | 1059 | 86.14
-#### Day 11
+#### Udemy Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 1855 |[Maximum Distance Between a Pair of Values](src/main/kotlin/g1801_1900/s1855_maximum_distance_between_a_pair_of_values/Solution.kt)| Medium | Array, Greedy, Binary_Search, Two_Pointers | 541 | 14.29
-| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search | 184 | 86.08
+| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers, LeetCode_75_Two_Pointers | 156 | 87.74
+| 0125 |[Valid Palindrome](src/main/kotlin/g0101_0200/s0125_valid_palindrome/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers | 353 | 52.06
+| 0977 |[Squares of a Sorted Array](src/main/kotlin/g0901_1000/s0977_squares_of_a_sorted_array/Solution.kt)| Easy | Array, Sorting, Two_Pointers | 271 | 77.17
+| 0026 |[Remove Duplicates from Sorted Array](src/main/kotlin/g0001_0100/s0026_remove_duplicates_from_sorted_array/Solution.kt)| Easy | Top_Interview_Questions, Array, Two_Pointers | 249 | 67.38
+| 0042 |[Trapping Rain Water](src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Two_Pointers, Stack, Monotonic_Stack, Big_O_Time_O(n)_Space_O(1) | 189 | 99.37
+| 0015 |[3Sum](src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers, Big_O_Time_O(n\*log(n))_Space_O(n^2) | 493 | 93.45
-#### Day 12
+#### Udemy Famous Algorithm
| | | | | |
|-|-|-|-|-|-
-| 0153 |[Find Minimum in Rotated Sorted Array](src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search | 262 | 60.96
-
-### Binary Search II
+| 0053 |[Maximum Subarray](src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Divide_and_Conquer, Big_O_Time_O(n)_Space_O(1) | 510 | 78.81
+| 0169 |[Majority Element](src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Sorting, Counting, Divide_and_Conquer, Big_O_Time_O(n)_Space_O(1) | 460 | 51.25
-#### Day 1
+#### Udemy Sorting Algorithms
| | | | | |
|-|-|-|-|-|-
-| 0209 |[Minimum Size Subarray Sum](src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt)| Medium | Array, Binary_Search, Prefix_Sum, Sliding_Window | 315 | 96.73
-| 0611 |[Valid Triangle Number](src/main/kotlin/g0601_0700/s0611_valid_triangle_number/Solution.kt)| Medium | Array, Sorting, Greedy, Binary_Search, Two_Pointers | 203 | 100.00
+| 0912 |[Sort an Array](src/main/kotlin/g0901_1000/s0912_sort_an_array/Solution.kt)| Medium | Array, Sorting, Heap_Priority_Queue, Divide_and_Conquer, Merge_Sort, Bucket_Sort, Counting_Sort, Radix_Sort | 606 | 98.48
-#### Day 2
+#### Udemy 2D Arrays/Matrix
| | | | | |
|-|-|-|-|-|-
-| 0658 |[Find K Closest Elements](src/main/kotlin/g0601_0700/s0658_find_k_closest_elements/Solution.kt)| Medium | Array, Sorting, Binary_Search, Two_Pointers, Heap_Priority_Queue | 375 | 95.16
-| 1894 |[Find the Student that Will Replace the Chalk](src/main/kotlin/g1801_1900/s1894_find_the_student_that_will_replace_the_chalk/Solution.kt)| Medium | Array, Binary_Search, Simulation, Prefix_Sum | 520 | 50.00
+| 0304 |[Range Sum Query 2D - Immutable](src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt)| Medium | Array, Matrix, Design, Prefix_Sum | 1373 | 85.71
+| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix, Big_O_Time_O(endRow+endCol)_Space_O(1) | 159 | 74.46
+| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Matrix, Simulation | 132 | 95.12
+| 0048 |[Rotate Image](src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Matrix, Big_O_Time_O(n^2)_Space_O(1) | 160 | 90.11
+| 1572 |[Matrix Diagonal Sum](src/main/kotlin/g1501_1600/s1572_matrix_diagonal_sum/Solution.kt)| Easy | Array, Matrix | 221 | 67.61
+| 0073 |[Set Matrix Zeroes](src/main/kotlin/g0001_0100/s0073_set_matrix_zeroes/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Matrix, Big_O_Time_O(m\*n)_Space_O(1) | 248 | 97.33
+| 0056 |[Merge Intervals](src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Big_O_Time_O(n_log_n)_Space_O(n) | 334 | 80.67
-#### Day 3
+#### Udemy Linked List
| | | | | |
|-|-|-|-|-|-
-| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Binary_Search | 318 | 82.28
-| 1760 |[Minimum Limit of Balls in a Bag](src/main/kotlin/g1701_1800/s1760_minimum_limit_of_balls_in_a_bag/Solution.kt)| Medium | Array, Binary_Search | 460 | 100.00
+| 0114 |[Flatten Binary Tree to Linked List](src/main/kotlin/g0101_0200/s0114_flatten_binary_tree_to_linked_list/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, Stack, Linked_List, Big_O_Time_O(N)_Space_O(N) | 191 | 93.10
+| 0445 |[Add Two Numbers II](src/main/kotlin/g0401_0500/s0445_add_two_numbers_ii/Solution.kt)| Medium | Math, Stack, Linked_List | 240 | 82.61
+| 0328 |[Odd Even Linked List](src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt)| Medium | Linked_List, LeetCode_75_LinkedList | 216 | 86.96
+| 0061 |[Rotate List](src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt)| Medium | Two_Pointers, Linked_List | 160 | 92.22
+| 0024 |[Swap Nodes in Pairs](src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt)| Medium | Top_100_Liked_Questions, Linked_List, Recursion, Big_O_Time_O(n)_Space_O(1) | 149 | 44.20
+| 0876 |[Middle of the Linked List](src/main/kotlin/g0801_0900/s0876_middle_of_the_linked_list/Solution.kt)| Easy | Two_Pointers, Linked_List | 136 | 76.52
+| 0142 |[Linked List Cycle II](src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Hash_Table, Two_Pointers, Linked_List, Big_O_Time_O(N)_Space_O(1) | 192 | 63.39
+| 0141 |[Linked List Cycle](src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List, Big_O_Time_O(N)_Space_O(1) | 223 | 91.85
+| 0206 |[Reverse Linked List](src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, LeetCode_75_LinkedList, Big_O_Time_O(N)_Space_O(1) | 279 | 45.78
+| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, Big_O_Time_O(m+n)_Space_O(m+n) | 157 | 92.24
+| 0160 |[Intersection of Two Linked Lists](src/main/kotlin/g0101_0200/s0160_intersection_of_two_linked_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List, Big_O_Time_O(M+N)_Space_O(1) | 262 | 83.50
+| 0234 |[Palindrome Linked List](src/main/kotlin/g0201_0300/s0234_palindrome_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Two_Pointers, Stack, Linked_List, Recursion, Big_O_Time_O(n)_Space_O(1) | 641 | 79.53
+| 0138 |[Copy List with Random Pointer](src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Linked_List, Big_O_Time_O(N)_Space_O(N) | 274 | 80.58
+| 0025 |[Reverse Nodes in k-Group](src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt)| Hard | Top_100_Liked_Questions, Linked_List, Recursion, Big_O_Time_O(n)_Space_O(k) | 189 | 67.03
+| 0146 |[LRU Cache](src/main/kotlin/g0101_0200/s0146_lru_cache/LRUCache.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Design, Linked_List, Doubly_Linked_List, Big_O_Time_O(1)_Space_O(capacity) | 1116 | 97.93
+| 0707 |[Design Linked List](src/main/kotlin/g0701_0800/s0707_design_linked_list/MyLinkedList.kt)| Medium | Design, Linked_List | 243 | 100.00
-#### Day 4
+#### Udemy Tree Stack Queue
| | | | | |
|-|-|-|-|-|-
-| 0875 |[Koko Eating Bananas](src/main/kotlin/g0801_0900/s0875_koko_eating_bananas/Solution.kt)| Medium | Array, Binary_Search | 267 | 93.85
-| 1552 |[Magnetic Force Between Two Balls](src/main/kotlin/g1501_1600/s1552_magnetic_force_between_two_balls/Solution.kt)| Medium | Array, Sorting, Binary_Search | 636 | 100.00
+| 0144 |[Binary Tree Preorder Traversal](src/main/kotlin/g0101_0200/s0144_binary_tree_preorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Stack | 277 | 37.90
+| 0094 |[Binary Tree Inorder Traversal](src/main/kotlin/g0001_0100/s0094_binary_tree_inorder_traversal/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Stack, Big_O_Time_O(n)_Space_O(n) | 152 | 66.67
+| 0145 |[Binary Tree Postorder Traversal](src/main/kotlin/g0101_0200/s0145_binary_tree_postorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Stack | 211 | 80.00
+| 0102 |[Binary Tree Level Order Traversal](src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(N) | 198 | 95.14
+| 0103 |[Binary Tree Zigzag Level Order Traversal](src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt)| Medium | Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree | 176 | 71.62
+| 0108 |[Convert Sorted Array to Binary Search Tree](src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt)| Easy | Top_Interview_Questions, Array, Tree, Binary_Tree, Binary_Search_Tree, Divide_and_Conquer | 167 | 80.29
+| 1008 |[Construct Binary Search Tree from Preorder Traversal](src/main/kotlin/g1001_1100/s1008_construct_binary_search_tree_from_preorder_traversal/Solution.kt)| Medium | Array, Tree, Binary_Tree, Stack, Monotonic_Stack, Binary_Search_Tree | 145 | 100.00
+| 0543 |[Diameter of Binary Tree](src/main/kotlin/g0501_0600/s0543_diameter_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, Big_O_Time_O(n)_Space_O(n) | 307 | 43.93
+| 0938 |[Range Sum of BST](src/main/kotlin/g0901_1000/s0938_range_sum_of_bst/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 356 | 55.36
+| 0100 |[Same Tree](src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 134 | 86.63
+| 0226 |[Invert Binary Tree](src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(n)_Space_O(n) | 233 | 54.90
+| 0111 |[Minimum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0111_minimum_depth_of_binary_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 525 | 90.51
+| 0104 |[Maximum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(N)_Space_O(H) | 166 | 83.53
+| 0110 |[Balanced Binary Tree](src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree | 182 | 71.30
+| 0701 |[Insert into a Binary Search Tree](src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt)| Medium | Tree, Binary_Tree, Binary_Search_Tree | 311 | 79.03
+| 0297 |[Serialize and Deserialize Binary Tree](src/main/kotlin/g0201_0300/s0297_serialize_and_deserialize_binary_tree/Codec.kt)| Hard | String, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Design | 475 | 78.85
+| 0124 |[Binary Tree Maximum Path Sum](src/main/kotlin/g0101_0200/s0124_binary_tree_maximum_path_sum/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Depth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(N) | 331 | 74.42
+| 0098 |[Validate Binary Search Tree](src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree, Big_O_Time_O(N)_Space_O(log(N)) | 190 | 61.62
+| 0337 |[House Robber III](src/main/kotlin/g0301_0400/s0337_house_robber_iii/Solution.kt)| Medium | Dynamic_Programming, Depth_First_Search, Tree, Binary_Tree | 282 | 84.62
+| 0236 |[Lowest Common Ancestor of a Binary Tree](src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(n)_Space_O(n) | 386 | 45.21
+| 0968 |[Binary Tree Cameras](src/main/kotlin/g0901_1000/s0968_binary_tree_cameras/Solution.kt)| Hard | Dynamic_Programming, Depth_First_Search, Tree, Binary_Tree | 176 | 100.00
-#### Day 5
+#### Udemy Trie and Heap
| | | | | |
|-|-|-|-|-|-
-| 0287 |[Find the Duplicate Number](src/main/kotlin/g0201_0300/s0287_find_the_duplicate_number/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Two_Pointers, Bit_Manipulation | 656 | 66.21
-| 1283 |[Find the Smallest Divisor Given a Threshold](src/main/kotlin/g1201_1300/s1283_find_the_smallest_divisor_given_a_threshold/Solution.kt)| Medium | Array, Binary_Search | 255 | 100.00
+| 0208 |[Implement Trie (Prefix Tree)](src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Design, Trie, LeetCode_75_Trie, Big_O_Time_O(word.length())_or_O(prefix.length())_Space_O(N) | 689 | 61.00
+| 0745 |[Prefix and Suffix Search](src/main/kotlin/g0701_0800/s0745_prefix_and_suffix_search/WordFilter.kt)| Hard | String, Design, Trie | 1638 | 100.00
-#### Day 6
+#### Udemy Graph
| | | | | |
|-|-|-|-|-|-
-| 1898 |[Maximum Number of Removable Characters](src/main/kotlin/g1801_1900/s1898_maximum_number_of_removable_characters/Solution.kt)| Medium | Array, String, Binary_Search | 636 | 100.00
-| 1870 |[Minimum Speed to Arrive on Time](src/main/kotlin/g1801_1900/s1870_minimum_speed_to_arrive_on_time/Solution.kt)| Medium | Array, Binary_Search | 628 | 50.00
+| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find, Big_O_Time_O(M\*N)_Space_O(M\*N) | 252 | 95.41
+| 0133 |[Clone Graph](src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt)| Medium | Hash_Table, Depth_First_Search, Breadth_First_Search, Graph | 351 | 60.91
+| 0417 |[Pacific Atlantic Water Flow](src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 319 | 100.00
-#### Day 7
+#### Udemy Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 1482 |[Minimum Number of Days to Make m Bouquets](src/main/kotlin/g1401_1500/s1482_minimum_number_of_days_to_make_m_bouquets/Solution.kt)| Medium | Array, Binary_Search | 538 | 50.00
-| 1818 |[Minimum Absolute Sum Difference](src/main/kotlin/g1801_1900/s1818_minimum_absolute_sum_difference/Solution.kt)| Medium | Array, Sorting, Binary_Search, Ordered_Set | 447 | 100.00
+| 0120 |[Triangle](src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt)| Medium | Array, Dynamic_Programming | 194 | 97.87
+| 0118 |[Pascal's Triangle](src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 277 | 33.22
+| 0119 |[Pascal's Triangle II](src/main/kotlin/g0101_0200/s0119_pascals_triangle_ii/Solution.kt)| Easy | Array, Dynamic_Programming | 157 | 97.27
+| 0139 |[Word Break](src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Dynamic_Programming, Trie, Memoization, Big_O_Time_O(M+max\*N)_Space_O(M+N+max) | 197 | 87.17
+| 0152 |[Maximum Product Subarray](src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Big_O_Time_O(N)_Space_O(1) | 253 | 88.42
+| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, LeetCode_75_DP/1D, Big_O_Time_O(n)_Space_O(n) | 156 | 92.24
+| 0213 |[House Robber II](src/main/kotlin/g0201_0300/s0213_house_robber_ii/Solution.kt)| Medium | Array, Dynamic_Programming | 257 | 59.62
+| 0509 |[Fibonacci Number](src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Recursion, Memoization | 139 | 82.72
+| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization, Big_O_Time_O(n)_Space_O(n) | 124 | 71.98
+| 0064 |[Minimum Path Sum](src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Matrix, Big_O_Time_O(m\*n)_Space_O(m\*n) | 164 | 100.00
+| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Binary_Search, Big_O_Time_O(n\*log_n)_Space_O(n) | 318 | 82.28
+| 1143 |[Longest Common Subsequence](src/main/kotlin/g1101_1200/s1143_longest_common_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming, LeetCode_75_DP/Multidimensional, Big_O_Time_O(n\*m)_Space_O(n\*m) | 307 | 38.36
+| 0072 |[Edit Distance](src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming, LeetCode_75_DP/Multidimensional, Big_O_Time_O(n^2)_Space_O(n2) | 182 | 92.16
+| 0044 |[Wildcard Matching](src/main/kotlin/g0001_0100/s0044_wildcard_matching/Solution.kt)| Hard | Top_Interview_Questions, String, Dynamic_Programming, Greedy, Recursion | 220 | 84.85
+| 0010 |[Regular Expression Matching](src/main/kotlin/g0001_0100/s0010_regular_expression_matching/Solution.kt)| Hard | Top_Interview_Questions, String, Dynamic_Programming, Recursion, Big_O_Time_O(m\*n)_Space_O(m\*n) | 171 | 85.26
-#### Day 8
+#### Udemy Backtracking/Recursion
| | | | | |
|-|-|-|-|-|-
-| 0240 |[Search a 2D Matrix II](src/main/kotlin/g0201_0300/s0240_search_a_2d_matrix_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Matrix, Divide_and_Conquer | 460 | 66.08
-| 0275 |[H-Index II](src/main/kotlin/g0201_0300/s0275_h_index_ii/Solution.kt)| Medium | Array, Binary_Search | 398 | 81.82
+| 0022 |[Generate Parentheses](src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Backtracking, Big_O_Time_O(2^n)_Space_O(n) | 161 | 85.45
+| 0039 |[Combination Sum](src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Backtracking, Big_O_Time_O(2^n)_Space_O(n+2^n) | 226 | 88.89
+| 0216 |[Combination Sum III](src/main/kotlin/g0201_0300/s0216_combination_sum_iii/Solution.kt)| Medium | Array, Backtracking, LeetCode_75_Backtracking | 175 | 90.91
+| 0078 |[Subsets](src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, Backtracking, Big_O_Time_O(2^n)_Space_O(n\*2^n) | 171 | 94.92
+| 0017 |[Letter Combinations of a Phone Number](src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Backtracking, LeetCode_75_Backtracking, Big_O_Time_O(4^n)_Space_O(n) | 155 | 95.24
+| 0046 |[Permutations](src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Backtracking, Big_O_Time_O(n\*n!)_Space_O(n+n!) | 188 | 99.00
-#### Day 9
+#### Udemy Bit Manipulation
| | | | | |
|-|-|-|-|-|-
-| 1838 |[Frequency of the Most Frequent Element](src/main/kotlin/g1801_1900/s1838_frequency_of_the_most_frequent_element/Solution.kt)| Medium | Array, Sorting, Greedy, Binary_Search, Prefix_Sum, Sliding_Window | 564 | 88.89
-| 0540 |[Single Element in a Sorted Array](src/main/kotlin/g0501_0600/s0540_single_element_in_a_sorted_array/Solution.kt)| Medium | Array, Binary_Search | 274 | 86.67
+| 0191 |[Number of 1 Bits](src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation | 237 | 68.44
+| 0389 |[Find the Difference](src/main/kotlin/g0301_0400/s0389_find_the_difference/Solution.kt)| Easy | String, Hash_Table, Sorting, Bit_Manipulation | 256 | 64.81
+| 0190 |[Reverse Bits](src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation, Divide_and_Conquer | 198 | 81.82
+| 0461 |[Hamming Distance](src/main/kotlin/g0401_0500/s0461_hamming_distance/Solution.kt)| Easy | Bit_Manipulation | 150 | 96.15
+| 1009 |[Complement of Base 10 Integer](src/main/kotlin/g1001_1100/s1009_complement_of_base_10_integer/Solution.kt)| Easy | Bit_Manipulation | 126 | 72.73
+| 0338 |[Counting Bits](src/main/kotlin/g0301_0400/s0338_counting_bits/Solution.kt)| Easy | Dynamic_Programming, Bit_Manipulation, LeetCode_75_Bit_Manipulation, Big_O_Time_O(num)_Space_O(num) | 186 | 99.26
+| 0371 |[Sum of Two Integers](src/main/kotlin/g0301_0400/s0371_sum_of_two_integers/Solution.kt)| Medium | Math, Bit_Manipulation | 129 | 95.45
+| 0029 |[Divide Two Integers](src/main/kotlin/g0001_0100/s0029_divide_two_integers/Solution.kt)| Medium | Top_Interview_Questions, Math, Bit_Manipulation | 144 | 82.50
-#### Day 10
+#### Udemy Design
| | | | | |
|-|-|-|-|-|-
-| 0222 |[Count Complete Tree Nodes](src/main/kotlin/g0201_0300/s0222_count_complete_tree_nodes/Solution.kt)| |||
-| 1712 |[Ways to Split Array Into Three Subarrays](src/main/kotlin/g1701_1800/s1712_ways_to_split_array_into_three_subarrays/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers, Prefix_Sum | 486 | 100.00
+| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design, Big_O_Time_O(1)_Space_O(N) | 331 | 84.88
-#### Day 11
+### Top Interview 150
+
+#### Top Interview 150 Array/String
| | | | | |
|-|-|-|-|-|-
-| 0826 |[Most Profit Assigning Work](src/main/kotlin/g0801_0900/s0826_most_profit_assigning_work/Solution.kt)| Medium | Array, Sorting, Greedy, Binary_Search, Two_Pointers | 366 | 100.00
-| 0436 |[Find Right Interval](src/main/kotlin/g0401_0500/s0436_find_right_interval/Solution.kt)| Medium | Array, Sorting, Binary_Search | 333 | 100.00
-
-#### Day 12
+| 0088 |[Merge Sorted Array](src/main/kotlin/g0001_0100/s0088_merge_sorted_array/Solution.kt)| Easy | Top_Interview_Questions, Array, Sorting, Two_Pointers | 170 | 69.74
+| 0027 |[Remove Element](src/main/kotlin/g0001_0100/s0027_remove_element/Solution.kt)| Easy | Array, Two_Pointers | 162 | 76.44
+| 0026 |[Remove Duplicates from Sorted Array](src/main/kotlin/g0001_0100/s0026_remove_duplicates_from_sorted_array/Solution.kt)| Easy | Top_Interview_Questions, Array, Two_Pointers | 249 | 67.38
+| 0080 |[Remove Duplicates from Sorted Array II](src/main/kotlin/g0001_0100/s0080_remove_duplicates_from_sorted_array_ii/Solution.kt)| Medium | Array, Two_Pointers | 192 | 80.67
+| 0169 |[Majority Element](src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Sorting, Counting, Divide_and_Conquer, Big_O_Time_O(n)_Space_O(1) | 460 | 51.25
+| 0189 |[Rotate Array](src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 483 | 86.95
+| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Big_O_Time_O(N)_Space_O(1) | 609 | 94.06
+| 0122 |[Best Time to Buy and Sell Stock II](src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt)| Medium | Top_Interview_Questions, Array, Dynamic_Programming, Greedy | 197 | 95.10
+| 0055 |[Jump Game](src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Greedy, Big_O_Time_O(n)_Space_O(1) | 332 | 89.35
+| 0045 |[Jump Game II](src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Greedy, Big_O_Time_O(n)_Space_O(1) | 208 | 93.37
+| 0274 |[H-Index](src/main/kotlin/g0201_0300/s0274_h_index/Solution.kt)| Medium | Array, Sorting, Counting_Sort | 291 | 45.45
+| 0380 |[Insert Delete GetRandom O(1)](src/main/kotlin/g0301_0400/s0380_insert_delete_getrandom_o1/RandomizedSet.kt)| Medium | Array, Hash_Table, Math, Design, Randomized | 1326 | 68.23
+| 0238 |[Product of Array Except Self](src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Prefix_Sum, LeetCode_75_Array/String, Big_O_Time_O(n^2)_Space_O(n) | 669 | 48.96
+| 0134 |[Gas Station](src/main/kotlin/g0101_0200/s0134_gas_station/Solution.kt)| Medium | Top_Interview_Questions, Array, Greedy | 545 | 70.18
+| 0135 |[Candy](src/main/kotlin/g0101_0200/s0135_candy/Solution.kt)| Hard | Array, Greedy | 466 | 58.33
+| 0042 |[Trapping Rain Water](src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Two_Pointers, Stack, Monotonic_Stack, Big_O_Time_O(n)_Space_O(1) | 189 | 99.37
+| 0013 |[Roman to Integer](src/main/kotlin/g0001_0100/s0013_roman_to_integer/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Math | 211 | 83.47
+| 0012 |[Integer to Roman](src/main/kotlin/g0001_0100/s0012_integer_to_roman/Solution.kt)| Medium | String, Hash_Table, Math | 180 | 98.25
+| 0058 |[Length of Last Word](src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt)| Easy | String | 135 | 93.67
+| 0014 |[Longest Common Prefix](src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String | 154 | 89.70
+| 0151 |[Reverse Words in a String](src/main/kotlin/g0101_0200/s0151_reverse_words_in_a_string/Solution.kt)| Medium | String, Two_Pointers, LeetCode_75_Array/String | 206 | 98.90
+| 0006 |[Zigzag Conversion](src/main/kotlin/g0001_0100/s0006_zigzag_conversion/Solution.kt)| Medium | String | 200 | 97.79
+| 0028 |[Find the Index of the First Occurrence in a String](src/main/kotlin/g0001_0100/s0028_find_the_index_of_the_first_occurrence_in_a_string/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers, String_Matching | 126 | 97.58
+| 0068 |[Text Justification](src/main/kotlin/g0001_0100/s0068_text_justification/Solution.kt)| Hard | Array, String, Simulation | 153 | 92.96
+
+#### Top Interview 150 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 0081 |[Search in Rotated Sorted Array II](src/main/kotlin/g0001_0100/s0081_search_in_rotated_sorted_array_ii/Solution.kt)| Medium | Array, Binary_Search | 352 | 42.31
-| 0162 |[Find Peak Element](src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt)| Medium | Top_Interview_Questions, Array, Binary_Search | 297 | 53.85
+| 0125 |[Valid Palindrome](src/main/kotlin/g0101_0200/s0125_valid_palindrome/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers | 353 | 52.06
+| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers, LeetCode_75_Two_Pointers | 156 | 87.74
+| 0167 |[Two Sum II - Input Array Is Sorted](src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers | 403 | 68.74
+| 0011 |[Container With Most Water](src/main/kotlin/g0001_0100/s0011_container_with_most_water/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Greedy, Two_Pointers, LeetCode_75_Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 402 | 78.57
+| 0015 |[3Sum](src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers, Big_O_Time_O(n\*log(n))_Space_O(n^2) | 493 | 93.45
-#### Day 13
+#### Top Interview 150 Sliding Window
| | | | | |
|-|-|-|-|-|-
-| 0154 |[Find Minimum in Rotated Sorted Array II](src/main/kotlin/g0101_0200/s0154_find_minimum_in_rotated_sorted_array_ii/Solution.kt)| Hard | Array, Binary_Search | 275 | 84.00
-| 0528 |[Random Pick with Weight](src/main/kotlin/g0501_0600/s0528_random_pick_with_weight/Solution.kt)| Medium | Math, Binary_Search, Prefix_Sum, Randomized | 393 | 91.38
+| 0209 |[Minimum Size Subarray Sum](src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt)| Medium | Array, Binary_Search, Prefix_Sum, Sliding_Window | 315 | 96.73
+| 0003 |[Longest Substring Without Repeating Characters](src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(n)_Space_O(1), AI_can_be_used_to_solve_the_task | 201 | 87.28
+| 0030 |[Substring with Concatenation of All Words](src/main/kotlin/g0001_0100/s0030_substring_with_concatenation_of_all_words/Solution.kt)| Hard | String, Hash_Table, Sliding_Window | 14 | 98.62
+| 0076 |[Minimum Window Substring](src/main/kotlin/g0001_0100/s0076_minimum_window_substring/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(s.length())_Space_O(1) | 191 | 96.38
-#### Day 14
+#### Top Interview 150 Matrix
| | | | | |
|-|-|-|-|-|-
-| 1508 |[Range Sum of Sorted Subarray Sums](src/main/kotlin/g1501_1600/s1508_range_sum_of_sorted_subarray_sums/Solution.kt)| Medium | Array, Sorting, Binary_Search, Two_Pointers | 378 | 66.67
-| 1574 |[Shortest Subarray to be Removed to Make Array Sorted](src/main/kotlin/g1501_1600/s1574_shortest_subarray_to_be_removed_to_make_array_sorted/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers, Stack, Monotonic_Stack | 477 | 50.00
+| 0036 |[Valid Sudoku](src/main/kotlin/g0001_0100/s0036_valid_sudoku/Solution.kt)| Medium | Top_Interview_Questions, Array, Hash_Table, Matrix | 181 | 95.15
+| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Matrix, Simulation | 132 | 95.12
+| 0048 |[Rotate Image](src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Matrix, Big_O_Time_O(n^2)_Space_O(1) | 160 | 90.11
+| 0073 |[Set Matrix Zeroes](src/main/kotlin/g0001_0100/s0073_set_matrix_zeroes/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Matrix, Big_O_Time_O(m\*n)_Space_O(1) | 248 | 97.33
+| 0289 |[Game of Life](src/main/kotlin/g0201_0300/s0289_game_of_life/Solution.kt)| Medium | Array, Matrix, Simulation | 174 | 96.97
-#### Day 15
+#### Top Interview 150 Hashmap
| | | | | |
|-|-|-|-|-|-
-| 1292 |[Maximum Side Length of a Square with Sum Less than or Equal to Threshold](src/main/kotlin/g1201_1300/s1292_maximum_side_length_of_a_square_with_sum_less_than_or_equal_to_threshold/Solution.kt)| Medium | Array, Binary_Search, Matrix, Prefix_Sum | 376 | 100.00
-| 1498 |[Number of Subsequences That Satisfy the Given Sum Condition](src/main/kotlin/g1401_1500/s1498_number_of_subsequences_that_satisfy_the_given_sum_condition/Solution.kt)| Medium | Array, Sorting, Binary_Search, Two_Pointers | 487 | 97.89
+| 0383 |[Ransom Note](src/main/kotlin/g0301_0400/s0383_ransom_note/Solution.kt)| Easy | String, Hash_Table, Counting | 333 | 79.58
+| 0205 |[Isomorphic Strings](src/main/kotlin/g0201_0300/s0205_isomorphic_strings/Solution.kt)| Easy | String, Hash_Table | 278 | 79.96
+| 0290 |[Word Pattern](src/main/kotlin/g0201_0300/s0290_word_pattern/Solution.kt)| Easy | String, Hash_Table | 177 | 89.55
+| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | String, Hash_Table, Sorting | 251 | 87.65
+| 0049 |[Group Anagrams](src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, String, Hash_Table, Sorting, Big_O_Time_O(n\*k_log_k)_Space_O(n) | 308 | 96.34
+| 0001 |[Two Sum](src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Big_O_Time_O(n)_Space_O(n), AI_can_be_used_to_solve_the_task | 202 | 91.18
+| 0202 |[Happy Number](src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt)| Easy | Top_Interview_Questions, Hash_Table, Math, Two_Pointers | 261 | 45.08
+| 0219 |[Contains Duplicate II](src/main/kotlin/g0201_0300/s0219_contains_duplicate_ii/Solution.kt)| Easy | Array, Hash_Table, Sliding_Window | 813 | 80.46
+| 0128 |[Longest Consecutive Sequence](src/main/kotlin/g0101_0200/s0128_longest_consecutive_sequence/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Union_Find, Big_O_Time_O(N_log_N)_Space_O(1) | 460 | 97.77
-#### Day 16
+#### Top Interview 150 Intervals
| | | | | |
|-|-|-|-|-|-
-| 0981 |[Time Based Key-Value Store](src/main/kotlin/g0901_1000/s0981_time_based_key_value_store/TimeMap.kt)| Medium | String, Hash_Table, Binary_Search, Design | 1555 | 10.00
-| 1300 |[Sum of Mutated Array Closest to Target](src/main/kotlin/g1201_1300/s1300_sum_of_mutated_array_closest_to_target/Solution.kt)| Medium | Array, Sorting, Binary_Search | 217 | 100.00
+| 0228 |[Summary Ranges](src/main/kotlin/g0201_0300/s0228_summary_ranges/Solution.kt)| Easy | Array | 169 | 91.89
+| 0056 |[Merge Intervals](src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Big_O_Time_O(n_log_n)_Space_O(n) | 334 | 80.67
+| 0057 |[Insert Interval](src/main/kotlin/g0001_0100/s0057_insert_interval/Solution.kt)| Medium | Array | 249 | 75.63
+| 0452 |[Minimum Number of Arrows to Burst Balloons](src/main/kotlin/g0401_0500/s0452_minimum_number_of_arrows_to_burst_balloons/Solution.kt)| Medium | Array, Sorting, Greedy, LeetCode_75_Intervals | 934 | 100.00
-#### Day 17
+#### Top Interview 150 Stack
| | | | | |
|-|-|-|-|-|-
-| 1802 |[Maximum Value at a Given Index in a Bounded Array](src/main/kotlin/g1801_1900/s1802_maximum_value_at_a_given_index_in_a_bounded_array/Solution.kt)| Medium | Greedy, Binary_Search | 118 | 100.00
-| 1901 |[Find a Peak Element II](src/main/kotlin/g1901_2000/s1901_find_a_peak_element_ii/Solution.kt)| Medium | Array, Binary_Search, Matrix, Divide_and_Conquer | 726 | 100.00
+| 0020 |[Valid Parentheses](src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String, Stack, Big_O_Time_O(n)_Space_O(n) | 137 | 88.76
+| 0071 |[Simplify Path](src/main/kotlin/g0001_0100/s0071_simplify_path/Solution.kt)| Medium | String, Stack | 185 | 92.86
+| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design, Big_O_Time_O(1)_Space_O(N) | 331 | 84.88
+| 0150 |[Evaluate Reverse Polish Notation](src/main/kotlin/g0101_0200/s0150_evaluate_reverse_polish_notation/Solution.kt)| Medium | Top_Interview_Questions, Array, Math, Stack | 233 | 88.82
+| 0224 |[Basic Calculator](src/main/kotlin/g0201_0300/s0224_basic_calculator/Solution.kt)| Hard | String, Math, Stack, Recursion | 294 | 93.33
-#### Day 18
+#### Top Interview 150 Linked List
| | | | | |
|-|-|-|-|-|-
-| 1146 |[Snapshot Array](src/main/kotlin/g1101_1200/s1146_snapshot_array/SnapshotArray.kt)| Medium | Array, Hash_Table, Binary_Search, Design | 1064 | 57.14
-| 1488 |[Avoid Flood in The City](src/main/kotlin/g1401_1500/s1488_avoid_flood_in_the_city/Solution.kt)| Medium | Array, Hash_Table, Greedy, Binary_Search, Heap_Priority_Queue | 823 | 66.67
+| 0141 |[Linked List Cycle](src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List, Big_O_Time_O(N)_Space_O(1) | 223 | 91.85
+| 0002 |[Add Two Numbers](src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Math, Linked_List, Recursion, Big_O_Time_O(max(N,M))_Space_O(max(N,M)), AI_can_be_used_to_solve_the_task | 203 | 96.13
+| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, Big_O_Time_O(m+n)_Space_O(m+n) | 157 | 92.24
+| 0138 |[Copy List with Random Pointer](src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Linked_List, Big_O_Time_O(N)_Space_O(N) | 274 | 80.58
+| 0092 |[Reverse Linked List II](src/main/kotlin/g0001_0100/s0092_reverse_linked_list_ii/Solution.kt)| Medium | Linked_List | 144 | 75.00
+| 0025 |[Reverse Nodes in k-Group](src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt)| Hard | Top_100_Liked_Questions, Linked_List, Recursion, Big_O_Time_O(n)_Space_O(k) | 189 | 67.03
+| 0019 |[Remove Nth Node From End of List](src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Two_Pointers, Linked_List, Big_O_Time_O(L)_Space_O(L) | 144 | 96.28
+| 0082 |[Remove Duplicates from Sorted List II](src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt)| Medium | Two_Pointers, Linked_List | 166 | 89.47
+| 0061 |[Rotate List](src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt)| Medium | Two_Pointers, Linked_List | 160 | 92.22
+| 0086 |[Partition List](src/main/kotlin/g0001_0100/s0086_partition_list/Solution.kt)| Medium | Two_Pointers, Linked_List | 160 | 70.73
+| 0146 |[LRU Cache](src/main/kotlin/g0101_0200/s0146_lru_cache/LRUCache.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Design, Linked_List, Doubly_Linked_List, Big_O_Time_O(1)_Space_O(capacity) | 1116 | 97.93
-#### Day 19
+#### Top Interview 150 Binary Tree General
| | | | | |
|-|-|-|-|-|-
-| 1562 |[Find Latest Group of Size M](src/main/kotlin/g1501_1600/s1562_find_latest_group_of_size_m/Solution.kt)| Medium | Array, Binary_Search, Simulation | 534 | 100.00
-| 1648 |[Sell Diminishing-Valued Colored Balls](src/main/kotlin/g1601_1700/s1648_sell_diminishing_valued_colored_balls/Solution.kt)| Medium | Array, Math, Sorting, Greedy, Binary_Search, Heap_Priority_Queue | 509 | 100.00
+| 0104 |[Maximum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(N)_Space_O(H) | 166 | 83.53
+| 0100 |[Same Tree](src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 134 | 86.63
+| 0226 |[Invert Binary Tree](src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(n)_Space_O(n) | 233 | 54.90
+| 0101 |[Symmetric Tree](src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(log(N)) | 153 | 82.35
+| 0105 |[Construct Binary Tree from Preorder and Inorder Traversal](src/main/kotlin/g0101_0200/s0105_construct_binary_tree_from_preorder_and_inorder_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Tree, Binary_Tree, Divide_and_Conquer, Big_O_Time_O(N)_Space_O(N) | 183 | 95.45
+| 0106 |[Construct Binary Tree from Inorder and Postorder Traversal](src/main/kotlin/g0101_0200/s0106_construct_binary_tree_from_inorder_and_postorder_traversal/Solution.kt)| Medium | Array, Hash_Table, Tree, Binary_Tree, Divide_and_Conquer | 167 | 100.00
+| 0117 |[Populating Next Right Pointers in Each Node II](src/main/kotlin/g0101_0200/s0117_populating_next_right_pointers_in_each_node_ii/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Linked_List | 199 | 94.67
+| 0114 |[Flatten Binary Tree to Linked List](src/main/kotlin/g0101_0200/s0114_flatten_binary_tree_to_linked_list/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, Stack, Linked_List, Big_O_Time_O(N)_Space_O(N) | 191 | 93.10
+| 0112 |[Path Sum](src/main/kotlin/g0101_0200/s0112_path_sum/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 322 | 36.41
+| 0129 |[Sum Root to Leaf Numbers](src/main/kotlin/g0101_0200/s0129_sum_root_to_leaf_numbers/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree | 237 | 52.50
+| 0124 |[Binary Tree Maximum Path Sum](src/main/kotlin/g0101_0200/s0124_binary_tree_maximum_path_sum/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Depth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(N) | 331 | 74.42
+| 0173 |[Binary Search Tree Iterator](src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt)| Medium | Tree, Binary_Tree, Stack, Design, Binary_Search_Tree, Iterator | 563 | 46.91
+| 0222 |[Count Complete Tree Nodes](src/main/kotlin/g0201_0300/s0222_count_complete_tree_nodes/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Search, Binary_Tree | 0 | 100.00
+| 0236 |[Lowest Common Ancestor of a Binary Tree](src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(n)_Space_O(n) | 386 | 45.21
-#### Day 20
+#### Top Interview 150 Binary Tree BFS
| | | | | |
|-|-|-|-|-|-
-| 1201 |[Ugly Number III](src/main/kotlin/g1201_1300/s1201_ugly_number_iii/Solution.kt)| Medium | Math, Binary_Search, Number_Theory | 136 | 100.00
-| 0911 |[Online Election](src/main/kotlin/g0901_1000/s0911_online_election/TopVotedCandidate.kt)| Medium | Array, Hash_Table, Binary_Search, Design | 766 | 83.33
-
-### Dynamic Programming I
+| 0199 |[Binary Tree Right Side View](src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/BFS | 194 | 92.89
+| 0637 |[Average of Levels in Binary Tree](src/main/kotlin/g0601_0700/s0637_average_of_levels_in_binary_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 249 | 100.00
+| 0102 |[Binary Tree Level Order Traversal](src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(N) | 198 | 95.14
+| 0103 |[Binary Tree Zigzag Level Order Traversal](src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt)| Medium | Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree | 176 | 71.62
-#### Day 1
+#### Top Interview 150 Binary Search Tree
| | | | | |
|-|-|-|-|-|-
-| 0509 |[Fibonacci Number](src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Recursion, Memoization | 139 | 82.72
-| 1137 |[N-th Tribonacci Number](src/main/kotlin/g1101_1200/s1137_n_th_tribonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Memoization | 122 | 69.35
+| 0530 |[Minimum Absolute Difference in BST](src/main/kotlin/g0501_0600/s0530_minimum_absolute_difference_in_bst/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 209 | 86.96
+| 0230 |[Kth Smallest Element in a BST](src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree, Big_O_Time_O(n)_Space_O(n) | 393 | 33.33
+| 0098 |[Validate Binary Search Tree](src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree, Big_O_Time_O(N)_Space_O(log(N)) | 190 | 61.62
-#### Day 2
+#### Top Interview 150 Graph General
| | | | | |
|-|-|-|-|-|-
-| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization | 127 | 97.06
-| 0746 |[Min Cost Climbing Stairs](src/main/kotlin/g0701_0800/s0746_min_cost_climbing_stairs/Solution.kt)| Easy | Array, Dynamic_Programming | 171 | 96.76
+| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find, Big_O_Time_O(M\*N)_Space_O(M\*N) | 252 | 95.41
+| 0130 |[Surrounded Regions](src/main/kotlin/g0101_0200/s0130_surrounded_regions/Solution.kt)| Medium | Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 355 | 84.42
+| 0133 |[Clone Graph](src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt)| Medium | Hash_Table, Depth_First_Search, Breadth_First_Search, Graph | 351 | 60.91
+| 0399 |[Evaluate Division](src/main/kotlin/g0301_0400/s0399_evaluate_division/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Graph, Union_Find, Shortest_Path, LeetCode_75_Graphs/DFS | 183 | 91.49
+| 0207 |[Course Schedule](src/main/kotlin/g0201_0300/s0207_course_schedule/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Graph, Topological_Sort, Big_O_Time_O(N)_Space_O(N) | 183 | 92.07
+| 0210 |[Course Schedule II](src/main/kotlin/g0201_0300/s0210_course_schedule_ii/Solution.kt)| Medium | Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Graph, Topological_Sort | 266 | 96.32
-#### Day 3
+#### Top Interview 150 Graph BFS
| | | | | |
|-|-|-|-|-|-
-| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 156 | 92.24
-| 0213 |[House Robber II](src/main/kotlin/g0201_0300/s0213_house_robber_ii/Solution.kt)| Medium | Array, Dynamic_Programming | 257 | 59.62
-| 0740 |[Delete and Earn](src/main/kotlin/g0701_0800/s0740_delete_and_earn/Solution.kt)| Medium | Array, Hash_Table, Dynamic_Programming | 192 | 100.00
+| 0909 |[Snakes and Ladders](src/main/kotlin/g0901_1000/s0909_snakes_and_ladders/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 203 | 100.00
+| 0433 |[Minimum Genetic Mutation](src/main/kotlin/g0401_0500/s0433_minimum_genetic_mutation/Solution.kt)| Medium | String, Hash_Table, Breadth_First_Search | 204 | 82.08
+| 0127 |[Word Ladder](src/main/kotlin/g0101_0200/s0127_word_ladder/Solution.kt)| Hard | Top_Interview_Questions, String, Hash_Table, Breadth_First_Search | 396 | 98.68
-#### Day 4
+#### Top Interview 150 Trie
| | | | | |
|-|-|-|-|-|-
-| 0055 |[Jump Game](src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Greedy | 670 | 66.67
-| 0045 |[Jump Game II](src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Greedy | 227 | 98.14
+| 0208 |[Implement Trie (Prefix Tree)](src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Design, Trie, LeetCode_75_Trie, Big_O_Time_O(word.length())_or_O(prefix.length())_Space_O(N) | 689 | 61.00
+| 0211 |[Design Add and Search Words Data Structure](src/main/kotlin/g0201_0300/s0211_design_add_and_search_words_data_structure/WordDictionary.kt)| Medium | String, Depth_First_Search, Design, Trie | 2256 | 87.04
+| 0212 |[Word Search II](src/main/kotlin/g0201_0300/s0212_word_search_ii/Solution.kt)| Hard | Top_Interview_Questions, Array, String, Matrix, Backtracking, Trie | 268 | 100.00
-#### Day 5
+#### Top Interview 150 Backtracking
| | | | | |
|-|-|-|-|-|-
-| 0053 |[Maximum Subarray](src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Divide_and_Conquer | 662 | 82.48
-| 0918 |[Maximum Sum Circular Subarray](src/main/kotlin/g0901_1000/s0918_maximum_sum_circular_subarray/Solution.kt)| Medium | Array, Dynamic_Programming, Divide_and_Conquer, Queue, Monotonic_Queue | 339 | 86.96
+| 0017 |[Letter Combinations of a Phone Number](src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Backtracking, LeetCode_75_Backtracking, Big_O_Time_O(4^n)_Space_O(n) | 155 | 95.24
+| 0077 |[Combinations](src/main/kotlin/g0001_0100/s0077_combinations/Solution.kt)| Medium | Backtracking | 232 | 100.00
+| 0046 |[Permutations](src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Backtracking, Big_O_Time_O(n\*n!)_Space_O(n+n!) | 188 | 99.00
+| 0039 |[Combination Sum](src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Backtracking, Big_O_Time_O(2^n)_Space_O(n+2^n) | 226 | 88.89
+| 0052 |[N-Queens II](src/main/kotlin/g0001_0100/s0052_n_queens_ii/Solution.kt)| Hard | Backtracking | 128 | 97.56
+| 0022 |[Generate Parentheses](src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Backtracking, Big_O_Time_O(2^n)_Space_O(n) | 161 | 85.45
+| 0079 |[Word Search](src/main/kotlin/g0001_0100/s0079_word_search/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Matrix, Backtracking, Big_O_Time_O(4^(m\*n))_Space_O(m\*n) | 392 | 72.92
-#### Day 6
+#### Top Interview 150 Divide and Conquer
| | | | | |
|-|-|-|-|-|-
-| 0152 |[Maximum Product Subarray](src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 253 | 88.42
-| 1567 |[Maximum Length of Subarray With Positive Product](src/main/kotlin/g1501_1600/s1567_maximum_length_of_subarray_with_positive_product/Solution.kt)| Medium | Array, Dynamic_Programming, Greedy | 468 | 33.33
+| 0108 |[Convert Sorted Array to Binary Search Tree](src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt)| Easy | Top_Interview_Questions, Array, Tree, Binary_Tree, Binary_Search_Tree, Divide_and_Conquer | 167 | 80.29
+| 0148 |[Sort List](src/main/kotlin/g0101_0200/s0148_sort_list/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Sorting, Two_Pointers, Linked_List, Divide_and_Conquer, Merge_Sort, Big_O_Time_O(log(N))_Space_O(log(N)) | 820 | 61.70
+| 0427 |[Construct Quad Tree](src/main/kotlin/g0401_0500/s0427_construct_quad_tree/Solution.kt)| Medium | Array, Tree, Matrix, Divide_and_Conquer | 221 | 94.74
+| 0023 |[Merge k Sorted Lists](src/main/kotlin/g0001_0100/s0023_merge_k_sorted_lists/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Heap_Priority_Queue, Linked_List, Divide_and_Conquer, Merge_Sort, Big_O_Time_O(k\*n\*log(k))_Space_O(log(k)) | 198 | 93.77
-#### Day 7
+#### Top Interview 150 Kadane's Algorithm
| | | | | |
|-|-|-|-|-|-
-| 1014 |[Best Sightseeing Pair](src/main/kotlin/g1001_1100/s1014_best_sightseeing_pair/Solution.kt)| Medium | Array, Dynamic_Programming | 336 | 66.67
-| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 609 | 94.06
-| 0122 |[Best Time to Buy and Sell Stock II](src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt)| Medium | Top_Interview_Questions, Array, Dynamic_Programming, Greedy | 197 | 95.10
+| 0053 |[Maximum Subarray](src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Divide_and_Conquer, Big_O_Time_O(n)_Space_O(1) | 510 | 78.81
+| 0918 |[Maximum Sum Circular Subarray](src/main/kotlin/g0901_1000/s0918_maximum_sum_circular_subarray/Solution.kt)| Medium | Array, Dynamic_Programming, Divide_and_Conquer, Queue, Monotonic_Queue | 339 | 86.96
-#### Day 8
+#### Top Interview 150 Binary Search
| | | | | |
|-|-|-|-|-|-
-| 0309 |[Best Time to Buy and Sell Stock with Cooldown](src/main/kotlin/g0301_0400/s0309_best_time_to_buy_and_sell_stock_with_cooldown/Solution.kt)| Medium | Array, Dynamic_Programming | 272 | 73.33
-| 0714 |[Best Time to Buy and Sell Stock with Transaction Fee](src/main/kotlin/g0701_0800/s0714_best_time_to_buy_and_sell_stock_with_transaction_fee/Solution.kt)| Medium | Array, Dynamic_Programming, Greedy | 417 | 90.91
+| 0035 |[Search Insert Position](src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 159 | 93.03
+| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix, Big_O_Time_O(endRow+endCol)_Space_O(1) | 159 | 74.46
+| 0162 |[Find Peak Element](src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt)| Medium | Top_Interview_Questions, Array, Binary_Search, LeetCode_75_Binary_Search | 297 | 53.85
+| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 151 | 93.77
+| 0034 |[Find First and Last Position of Element in Sorted Array](src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 174 | 100.00
+| 0153 |[Find Minimum in Rotated Sorted Array](src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Big_O_Time_O(log_N)_Space_O(log_N) | 262 | 60.96
+| 0004 |[Median of Two Sorted Arrays](src/main/kotlin/g0001_0100/s0004_median_of_two_sorted_arrays/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Divide_and_Conquer, Big_O_Time_O(log(min(N,M)))_Space_O(1), AI_can_be_used_to_solve_the_task | 293 | 75.96
-#### Day 9
+#### Top Interview 150 Heap
| | | | | |
|-|-|-|-|-|-
-| 0139 |[Word Break](src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Dynamic_Programming, Trie, Memoization | 197 | 87.17
-| 0042 |[Trapping Rain Water](src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Two_Pointers, Stack, Monotonic_Stack | 196 | 100.00
+| 0215 |[Kth Largest Element in an Array](src/main/kotlin/g0201_0300/s0215_kth_largest_element_in_an_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Heap_Priority_Queue, Divide_and_Conquer, Quickselect, LeetCode_75_Heap/Priority_Queue, Big_O_Time_O(n\*log(n))_Space_O(log(n)) | 839 | 34.43
+| 0502 |[IPO](src/main/kotlin/g0501_0600/s0502_ipo/Solution.kt)| Hard | Array, Sorting, Greedy, Heap_Priority_Queue | 799 | 54.55
+| 0373 |[Find K Pairs with Smallest Sums](src/main/kotlin/g0301_0400/s0373_find_k_pairs_with_smallest_sums/Solution.kt)| Medium | Array, Heap_Priority_Queue | 1809 | 80.95
+| 0295 |[Find Median from Data Stream](src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/MedianFinder.kt)| Hard | Top_100_Liked_Questions, Sorting, Two_Pointers, Design, Heap_Priority_Queue, Data_Stream, Big_O_Time_O(n\*log_n)_Space_O(n) | 2289 | 33.60
-#### Day 10
+#### Top Interview 150 Bit Manipulation
| | | | | |
|-|-|-|-|-|-
-| 0413 |[Arithmetic Slices](src/main/kotlin/g0401_0500/s0413_arithmetic_slices/Solution.kt)| Medium | Array, Dynamic_Programming | 156 | 100.00
-| 0091 |[Decode Ways](src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt)| Medium | Top_Interview_Questions, String, Dynamic_Programming | 237 | 76.88
+| 0067 |[Add Binary](src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt)| Easy | String, Math, Bit_Manipulation, Simulation | 164 | 90.60
+| 0190 |[Reverse Bits](src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation, Divide_and_Conquer | 198 | 81.82
+| 0191 |[Number of 1 Bits](src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation | 237 | 68.44
+| 0136 |[Single Number](src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, LeetCode_75_Bit_Manipulation, Big_O_Time_O(N)_Space_O(1) | 344 | 83.63
+| 0137 |[Single Number II](src/main/kotlin/g0101_0200/s0137_single_number_ii/Solution.kt)| Medium | Array, Bit_Manipulation | 344 | 64.29
+| 0201 |[Bitwise AND of Numbers Range](src/main/kotlin/g0201_0300/s0201_bitwise_and_of_numbers_range/Solution.kt)| Medium | Bit_Manipulation | 368 | 80.00
-#### Day 11
+#### Top Interview 150 Math
| | | | | |
|-|-|-|-|-|-
-| 0264 |[Ugly Number II](src/main/kotlin/g0201_0300/s0264_ugly_number_ii/Solution.kt)| Medium | Hash_Table, Dynamic_Programming, Math, Heap_Priority_Queue | 182 | 95.45
-| 0096 |[Unique Binary Search Trees](src/main/kotlin/g0001_0100/s0096_unique_binary_search_trees/Solution.kt)| Medium | Top_100_Liked_Questions, Dynamic_Programming, Math, Tree, Binary_Tree, Binary_Search_Tree | 147 | 88.52
+| 0009 |[Palindrome Number](src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt)| Easy | Math | 217 | 95.34
+| 0066 |[Plus One](src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt)| Easy | Top_Interview_Questions, Array, Math | 148 | 98.75
+| 0172 |[Factorial Trailing Zeroes](src/main/kotlin/g0101_0200/s0172_factorial_trailing_zeroes/Solution.kt)| Medium | Top_Interview_Questions, Math | 220 | 67.65
+| 0069 |[Sqrt(x)](src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt)| Easy | Top_Interview_Questions, Math, Binary_Search | 140 | 94.72
+| 0050 |[Pow(x, n)](src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt)| Medium | Top_Interview_Questions, Math, Recursion | 172 | 38.68
+| 0149 |[Max Points on a Line](src/main/kotlin/g0101_0200/s0149_max_points_on_a_line/Solution.kt)| Hard | Top_Interview_Questions, Array, Hash_Table, Math, Geometry | 307 | 83.33
-#### Day 12
+#### Top Interview 150 1D DP
| | | | | |
|-|-|-|-|-|-
-| 0118 |[Pascal's Triangle](src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt)| Easy | Top_Interview_Questions, Array, Dynamic_Programming | 277 | 33.22
-| 0119 |[Pascal's Triangle II](src/main/kotlin/g0101_0200/s0119_pascals_triangle_ii/Solution.kt)| Easy | Array, Dynamic_Programming | 157 | 97.27
+| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization, Big_O_Time_O(n)_Space_O(n) | 124 | 71.98
+| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, LeetCode_75_DP/1D, Big_O_Time_O(n)_Space_O(n) | 156 | 92.24
+| 0139 |[Word Break](src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Dynamic_Programming, Trie, Memoization, Big_O_Time_O(M+max\*N)_Space_O(M+N+max) | 197 | 87.17
+| 0322 |[Coin Change](src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Breadth_First_Search, Big_O_Time_O(m\*n)_Space_O(amount) | 332 | 50.68
+| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Binary_Search, Big_O_Time_O(n\*log_n)_Space_O(n) | 318 | 82.28
-#### Day 13
+#### Top Interview 150 Multidimensional DP
| | | | | |
|-|-|-|-|-|-
-| 0931 |[Minimum Falling Path Sum](src/main/kotlin/g0901_1000/s0931_minimum_falling_path_sum/Solution.kt)| Medium | Array, Dynamic_Programming, Matrix | 201 | 84.21
| 0120 |[Triangle](src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt)| Medium | Array, Dynamic_Programming | 194 | 97.87
+| 0064 |[Minimum Path Sum](src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Matrix, Big_O_Time_O(m\*n)_Space_O(m\*n) | 164 | 100.00
+| 0063 |[Unique Paths II](src/main/kotlin/g0001_0100/s0063_unique_paths_ii/Solution.kt)| Medium | Array, Dynamic_Programming, Matrix | 151 | 81.94
+| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Big_O_Time_O(n)_Space_O(n) | 162 | 99.00
+| 0097 |[Interleaving String](src/main/kotlin/g0001_0100/s0097_interleaving_string/Solution.kt)| Medium | String, Dynamic_Programming | 149 | 81.58
+| 0072 |[Edit Distance](src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming, LeetCode_75_DP/Multidimensional, Big_O_Time_O(n^2)_Space_O(n2) | 182 | 92.16
+| 0123 |[Best Time to Buy and Sell Stock III](src/main/kotlin/g0101_0200/s0123_best_time_to_buy_and_sell_stock_iii/Solution.kt)| Hard | Array, Dynamic_Programming | 585 | 95.24
+| 0188 |[Best Time to Buy and Sell Stock IV](src/main/kotlin/g0101_0200/s0188_best_time_to_buy_and_sell_stock_iv/Solution.kt)| Hard | Array, Dynamic_Programming | 293 | 68.31
+| 0221 |[Maximal Square](src/main/kotlin/g0201_0300/s0221_maximal_square/Solution.kt)| Medium | Array, Dynamic_Programming, Matrix, Big_O_Time_O(m\*n)_Space_O(m\*n) | 614 | 44.00
-#### Day 14
+### Data Structure I
+
+#### Day 1 Array
| | | | | |
|-|-|-|-|-|-
-| 1314 |[Matrix Block Sum](src/main/kotlin/g1301_1400/s1314_matrix_block_sum/Solution.kt)| Medium | Array, Matrix, Prefix_Sum | 235 | 100.00
-| 0304 |[Range Sum Query 2D - Immutable](src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt)| Medium | Array, Matrix, Design, Prefix_Sum | 1373 | 85.71
+| 0217 |[Contains Duplicate](src/main/kotlin/g0201_0300/s0217_contains_duplicate/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting | 719 | 73.49
+| 0053 |[Maximum Subarray](src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Divide_and_Conquer, Big_O_Time_O(n)_Space_O(1) | 510 | 78.81
-#### Day 15
+#### Day 2 Array
| | | | | |
|-|-|-|-|-|-
-| 0062 |[Unique Paths](src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Combinatorics | 209 | 49.18
-| 0063 |[Unique Paths II](src/main/kotlin/g0001_0100/s0063_unique_paths_ii/Solution.kt)| Medium | Array, Dynamic_Programming, Matrix | 187 | 84.62
+| 0001 |[Two Sum](src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Big_O_Time_O(n)_Space_O(n), AI_can_be_used_to_solve_the_task | 202 | 91.18
+| 0088 |[Merge Sorted Array](src/main/kotlin/g0001_0100/s0088_merge_sorted_array/Solution.kt)| Easy | Top_Interview_Questions, Array, Sorting, Two_Pointers | 170 | 69.74
-#### Day 16
+#### Day 3 Array
| | | | | |
|-|-|-|-|-|-
-| 0064 |[Minimum Path Sum](src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Matrix | 222 | 95.70
-| 0221 |[Maximal Square](src/main/kotlin/g0201_0300/s0221_maximal_square/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Matrix | 614 | 44.00
+| 0350 |[Intersection of Two Arrays II](src/main/kotlin/g0301_0400/s0350_intersection_of_two_arrays_ii/Solution.kt)| Easy | Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 321 | 73.37
+| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Big_O_Time_O(N)_Space_O(1) | 609 | 94.06
-#### Day 17
+#### Day 4 Array
| | | | | |
|-|-|-|-|-|-
-| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming | 323 | 75.48
-| 0516 |[Longest Palindromic Subsequence](src/main/kotlin/g0501_0600/s0516_longest_palindromic_subsequence/Solution.kt)| Medium | String, Dynamic_Programming | 243 | 87.50
+| 0566 |[Reshape the Matrix](src/main/kotlin/g0501_0600/s0566_reshape_the_matrix/Solution.kt)| Easy | Array, Matrix, Simulation | 239 | 99.05
+| 0118 |[Pascal's Triangle](src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 277 | 33.22
-#### Day 18
+#### Day 5 Array
| | | | | |
|-|-|-|-|-|-
-| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Binary_Search | 318 | 82.28
-| 0376 |[Wiggle Subsequence](src/main/kotlin/g0301_0400/s0376_wiggle_subsequence/Solution.kt)| Medium | Array, Dynamic_Programming, Greedy | 162 | 88.89
+| 0036 |[Valid Sudoku](src/main/kotlin/g0001_0100/s0036_valid_sudoku/Solution.kt)| Medium | Top_Interview_Questions, Array, Hash_Table, Matrix | 181 | 95.15
+| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix, Big_O_Time_O(endRow+endCol)_Space_O(1) | 159 | 74.46
-#### Day 19
+#### Day 6 String
| | | | | |
|-|-|-|-|-|-
-| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers | 156 | 87.74
-| 1143 |[Longest Common Subsequence](src/main/kotlin/g1101_1200/s1143_longest_common_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming | 307 | 38.36
-| 0072 |[Edit Distance](src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt)| Hard | Top_100_Liked_Questions, String, Dynamic_Programming | 320 | 63.53
+| 0387 |[First Unique Character in a String](src/main/kotlin/g0301_0400/s0387_first_unique_character_in_a_string/Solution.kt)| Easy | String, Hash_Table, Counting, Queue | 369 | 82.68
+| 0383 |[Ransom Note](src/main/kotlin/g0301_0400/s0383_ransom_note/Solution.kt)| Easy | String, Hash_Table, Counting | 333 | 79.58
+| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | String, Hash_Table, Sorting | 251 | 87.65
-#### Day 20
+#### Day 7 Linked List
| | | | | |
|-|-|-|-|-|-
-| 0322 |[Coin Change](src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Breadth_First_Search | 332 | 50.68
-| 0518 |[Coin Change II](src/main/kotlin/g0501_0600/s0518_coin_change_2/Solution.kt)| Medium | Array, Dynamic_Programming | 139 | 100.00
+| 0141 |[Linked List Cycle](src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List, Big_O_Time_O(N)_Space_O(1) | 223 | 91.85
+| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, Big_O_Time_O(m+n)_Space_O(m+n) | 157 | 92.24
+| 0203 |[Remove Linked List Elements](src/main/kotlin/g0201_0300/s0203_remove_linked_list_elements/Solution.kt)| Easy | Linked_List, Recursion | 233 | 91.22
-#### Day 21
+#### Day 8 Linked List
| | | | | |
|-|-|-|-|-|-
-| 0377 |[Combination Sum IV](src/main/kotlin/g0301_0400/s0377_combination_sum_iv/Solution.kt)| Medium | Array, Dynamic_Programming | 217 | 72.41
-| 0343 |[Integer Break](src/main/kotlin/g0301_0400/s0343_integer_break/Solution.kt)| Medium | Dynamic_Programming, Math | 218 | 63.89
-| 0279 |[Perfect Squares](src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt)| Medium | Top_Interview_Questions, Dynamic_Programming, Math, Breadth_First_Search | 176 | 98.80
+| 0206 |[Reverse Linked List](src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, LeetCode_75_LinkedList, Big_O_Time_O(N)_Space_O(1) | 279 | 45.78
+| 0083 |[Remove Duplicates from Sorted List](src/main/kotlin/g0001_0100/s0083_remove_duplicates_from_sorted_list/Solution.kt)| Easy | Linked_List | 173 | 82.42
-### Programming Skills I
-
-#### Day 1 Basic Data Type
+#### Day 9 Stack Queue
| | | | | |
|-|-|-|-|-|-
-| 1523 |[Count Odd Numbers in an Interval Range](src/main/kotlin/g1501_1600/s1523_count_odd_numbers_in_an_interval_range/Solution.kt)| Easy | Math | 114 | 97.22
-| 1491 |[Average Salary Excluding the Minimum and Maximum Salary](src/main/kotlin/g1401_1500/s1491_average_salary_excluding_the_minimum_and_maximum_salary/Solution.kt)| Easy | Array, Sorting | 165 | 27.87
+| 0020 |[Valid Parentheses](src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String, Stack, Big_O_Time_O(n)_Space_O(n) | 137 | 88.76
+| 0232 |[Implement Queue using Stacks](src/main/kotlin/g0201_0300/s0232_implement_queue_using_stacks/MyQueue.kt)| Easy | Stack, Design, Queue | 258 | 70.86
-#### Day 2 Operator
+#### Day 10 Tree
| | | | | |
|-|-|-|-|-|-
-| 0191 |[Number of 1 Bits](src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation | 237 | 68.44
-| 1281 |[Subtract the Product and Sum of Digits of an Integer](src/main/kotlin/g1201_1300/s1281_subtract_the_product_and_sum_of_digits_of_an_integer/Solution.kt)| Easy | Math | 128 | 61.82
+| 0144 |[Binary Tree Preorder Traversal](src/main/kotlin/g0101_0200/s0144_binary_tree_preorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Stack | 277 | 37.90
+| 0094 |[Binary Tree Inorder Traversal](src/main/kotlin/g0001_0100/s0094_binary_tree_inorder_traversal/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Stack, Big_O_Time_O(n)_Space_O(n) | 152 | 66.67
+| 0145 |[Binary Tree Postorder Traversal](src/main/kotlin/g0101_0200/s0145_binary_tree_postorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Stack | 211 | 80.00
-#### Day 3 Conditional Statements
+#### Day 11 Tree
| | | | | |
|-|-|-|-|-|-
-| 0976 |[Largest Perimeter Triangle](src/main/kotlin/g0901_1000/s0976_largest_perimeter_triangle/Solution.kt)| Easy | Array, Math, Sorting, Greedy | 304 | 33.33
-| 1779 |[Find Nearest Point That Has the Same X or Y Coordinate](src/main/kotlin/g1701_1800/s1779_find_nearest_point_that_has_the_same_x_or_y_coordinate/Solution.kt)| Easy | Array | 364 | 100.00
+| 0102 |[Binary Tree Level Order Traversal](src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(N) | 198 | 95.14
+| 0104 |[Maximum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(N)_Space_O(H) | 166 | 83.53
+| 0101 |[Symmetric Tree](src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(N)_Space_O(log(N)) | 153 | 82.35
-#### Day 4 Loop
+#### Day 12 Tree
| | | | | |
|-|-|-|-|-|-
-| 1822 |[Sign of the Product of an Array](src/main/kotlin/g1801_1900/s1822_sign_of_the_product_of_an_array/Solution.kt)| Easy | Array, Math | 170 | 92.51
-| 1502 |[Can Make Arithmetic Progression From Sequence](src/main/kotlin/g1501_1600/s1502_can_make_arithmetic_progression_from_sequence/Solution.kt)| Easy | Array, Sorting | 156 | 94.82
-| 0202 |[Happy Number](src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt)| Easy | Top_Interview_Questions, Hash_Table, Math, Two_Pointers | 261 | 45.08
-| 1790 |[Check if One String Swap Can Make Strings Equal](src/main/kotlin/g1701_1800/s1790_check_if_one_string_swap_can_make_strings_equal/Solution.kt)| Easy | String, Hash_Table, Counting | 138 | 100.00
+| 0226 |[Invert Binary Tree](src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Big_O_Time_O(n)_Space_O(n) | 233 | 54.90
+| 0112 |[Path Sum](src/main/kotlin/g0101_0200/s0112_path_sum/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 322 | 36.41
-#### Day 5 Function
+#### Day 13 Tree
| | | | | |
|-|-|-|-|-|-
-| 0589 |[N-ary Tree Preorder Traversal](src/main/kotlin/g0501_0600/s0589_n_ary_tree_preorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Stack | 233 | 84.02
-| 0496 |[Next Greater Element I](src/main/kotlin/g0401_0500/s0496_next_greater_element_i/Solution.kt)| Easy | Array, Hash_Table, Stack, Monotonic_Stack | 171 | 100.00
-| 1232 |[Check If It Is a Straight Line](src/main/kotlin/g1201_1300/s1232_check_if_it_is_a_straight_line/Solution.kt)| Easy | Array, Math, Geometry | 152 | 95.38
+| 0700 |[Search in a Binary Search Tree](src/main/kotlin/g0601_0700/s0700_search_in_a_binary_search_tree/Solution.kt)| Easy | Tree, Binary_Tree, Binary_Search_Tree, LeetCode_75_Binary_Search_Tree | 251 | 88.31
+| 0701 |[Insert into a Binary Search Tree](src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt)| Medium | Tree, Binary_Tree, Binary_Search_Tree | 311 | 79.03
-#### Day 6 Array
+#### Day 14 Tree
| | | | | |
|-|-|-|-|-|-
-| 1588 |[Sum of All Odd Length Subarrays](src/main/kotlin/g1501_1600/s1588_sum_of_all_odd_length_subarrays/Solution.kt)| Easy | Array, Math, Prefix_Sum | 157 | 64.00
-| 0283 |[Move Zeroes](src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Two_Pointers | 516 | 79.07
-| 1672 |[Richest Customer Wealth](src/main/kotlin/g1601_1700/s1672_richest_customer_wealth/Solution.kt)| Easy | Array, Matrix | 155 | 94.54
+| 0098 |[Validate Binary Search Tree](src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree, Big_O_Time_O(N)_Space_O(log(N)) | 190 | 61.62
+| 0653 |[Two Sum IV - Input is a BST](src/main/kotlin/g0601_0700/s0653_two_sum_iv_input_is_a_bst/Solution.kt)| Easy | Hash_Table, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Two_Pointers, Binary_Search_Tree | 231 | 96.08
+| 0235 |[Lowest Common Ancestor of a Binary Search Tree](src/main/kotlin/g0201_0300/s0235_lowest_common_ancestor_of_a_binary_search_tree/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 404 | 75.59
-#### Day 7 Array
+### Data Structure II
+
+#### Day 1 Array
| | | | | |
|-|-|-|-|-|-
-| 1572 |[Matrix Diagonal Sum](src/main/kotlin/g1501_1600/s1572_matrix_diagonal_sum/Solution.kt)| Easy | Array, Matrix | 221 | 67.61
-| 0566 |[Reshape the Matrix](src/main/kotlin/g0501_0600/s0566_reshape_the_matrix/Solution.kt)| Easy | Array, Matrix, Simulation | 239 | 99.05
+| 0136 |[Single Number](src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, LeetCode_75_Bit_Manipulation, Big_O_Time_O(N)_Space_O(1) | 344 | 83.63
+| 0169 |[Majority Element](src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Sorting, Counting, Divide_and_Conquer, Big_O_Time_O(n)_Space_O(1) | 460 | 51.25
+| 0015 |[3Sum](src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers, Big_O_Time_O(n\*log(n))_Space_O(n^2) | 493 | 93.45
+
+#### Day 2 Array
+
+| | | | | |
+|-|-|-|-|-|-
+| 0075 |[Sort Colors](src/main/kotlin/g0001_0100/s0075_sort_colors/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 164 | 64.43
+| 0056 |[Merge Intervals](src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Big_O_Time_O(n_log_n)_Space_O(n) | 334 | 80.67
+| 0706 |[Design HashMap](src/main/kotlin/g0701_0800/s0706_design_hashmap/MyHashMap.kt)| Easy | Array, Hash_Table, Design, Linked_List, Hash_Function | 405 | 92.11
+
+#### Day 3 Array
+
+| | | | | |
+|-|-|-|-|-|-
+| 0119 |[Pascal's Triangle II](src/main/kotlin/g0101_0200/s0119_pascals_triangle_ii/Solution.kt)| Easy | Array, Dynamic_Programming | 157 | 97.27
+| 0048 |[Rotate Image](src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Matrix, Big_O_Time_O(n^2)_Space_O(1) | 160 | 90.11
+| 0059 |[Spiral Matrix II](src/main/kotlin/g0001_0100/s0059_spiral_matrix_ii/Solution.kt)| Medium | Array, Matrix, Simulation | 153 | 41.70
+
+#### Day 4 Array
+
+| | | | | |
+|-|-|-|-|-|-
+| 0240 |[Search a 2D Matrix II](src/main/kotlin/g0201_0300/s0240_search_a_2d_matrix_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix, Divide_and_Conquer, Big_O_Time_O(n+m)_Space_O(1) | 460 | 66.08
+| 0435 |[Non-overlapping Intervals](src/main/kotlin/g0401_0500/s0435_non_overlapping_intervals/Solution.kt)| Medium | Array, Dynamic_Programming, Sorting, Greedy, LeetCode_75_Intervals | 1040 | 85.07
+
+#### Day 5 Array
+
+| | | | | |
+|-|-|-|-|-|-
+| 0334 |[Increasing Triplet Subsequence](src/main/kotlin/g0301_0400/s0334_increasing_triplet_subsequence/Solution.kt)| Medium | Array, Greedy, LeetCode_75_Array/String | 672 | 60.61
+| 0238 |[Product of Array Except Self](src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Prefix_Sum, LeetCode_75_Array/String, Big_O_Time_O(n^2)_Space_O(n) | 669 | 48.96
+| 0560 |[Subarray Sum Equals K](src/main/kotlin/g0501_0600/s0560_subarray_sum_equals_k/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Hash_Table, Prefix_Sum, Big_O_Time_O(n)_Space_O(n) | 692 | 53.27
+
+#### Day 6 String
+
+| | | | | |
+|-|-|-|-|-|-
+| 0415 |[Add Strings](src/main/kotlin/g0401_0500/s0415_add_strings/Solution.kt)| Easy | String, Math, Simulation | 296 | 76.00
+| 0409 |[Longest Palindrome](src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt)| Easy | String, Hash_Table, Greedy | 259 | 60.71
+
+#### Day 7 String
+
+| | | | | |
+|-|-|-|-|-|-
+| 0290 |[Word Pattern](src/main/kotlin/g0201_0300/s0290_word_pattern/Solution.kt)| Easy | String, Hash_Table | 177 | 89.55
+| 0763 |[Partition Labels](src/main/kotlin/g0701_0800/s0763_partition_labels/Solution.kt)| Medium | String, Hash_Table, Greedy, Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 235 | 84.75
#### Day 8 String
| | | | | |
|-|-|-|-|-|-
-| 1768 |[Merge Strings Alternately](src/main/kotlin/g1701_1800/s1768_merge_strings_alternately/Solution.kt)| Easy | String, Two_Pointers | 138 | 93.81
-| 1678 |[Goal Parser Interpretation](src/main/kotlin/g1601_1700/s1678_goal_parser_interpretation/Solution.kt)| Easy | String | 136 | 88.24
-| 0389 |[Find the Difference](src/main/kotlin/g0301_0400/s0389_find_the_difference/Solution.kt)| Easy | String, Hash_Table, Sorting, Bit_Manipulation | 256 | 64.81
+| 0049 |[Group Anagrams](src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, String, Hash_Table, Sorting, Big_O_Time_O(n\*k_log_k)_Space_O(n) | 308 | 96.34
+| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation | 165 | 96.72
#### Day 9 String
| | | | | |
|-|-|-|-|-|-
-| 0709 |[To Lower Case](src/main/kotlin/g0701_0800/s0709_to_lower_case/Solution.kt)| Easy | String | 142 | 98.68
-| 1309 |[Decrypt String from Alphabet to Integer Mapping](src/main/kotlin/g1301_1400/s1309_decrypt_string_from_alphabet_to_integer_mapping/Solution.kt)| Easy | String | 129 | 95.45
-| 0953 |[Verifying an Alien Dictionary](src/main/kotlin/g0901_1000/s0953_verifying_an_alien_dictionary/Solution.kt)| Easy | Array, String, Hash_Table | 137 | 100.00
+| 0187 |[Repeated DNA Sequences](src/main/kotlin/g0101_0200/s0187_repeated_dna_sequences/Solution.kt)| Medium | String, Hash_Table, Bit_Manipulation, Sliding_Window, Hash_Function, Rolling_Hash | 319 | 79.03
+| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Big_O_Time_O(n)_Space_O(n) | 162 | 99.00
-#### Day 10 Linked List and Tree
+#### Day 10 Linked List
| | | | | |
|-|-|-|-|-|-
-| 1290 |[Convert Binary Number in a Linked List to Integer](src/main/kotlin/g1201_1300/s1290_convert_binary_number_in_a_linked_list_to_integer/Solution.kt)| Easy | Math, Linked_List | 145 | 25.93
-| 0876 |[Middle of the Linked List](src/main/kotlin/g0801_0900/s0876_middle_of_the_linked_list/Solution.kt)| Easy | Two_Pointers, Linked_List | 136 | 76.52
-| 0104 |[Maximum Depth of Binary Tree](src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 236 | 83.39
-| 0404 |[Sum of Left Leaves](src/main/kotlin/g0401_0500/s0404_sum_of_left_leaves/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 173 | 86.05
+| 0002 |[Add Two Numbers](src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Math, Linked_List, Recursion, Big_O_Time_O(max(N,M))_Space_O(max(N,M)), AI_can_be_used_to_solve_the_task | 203 | 96.13
+| 0142 |[Linked List Cycle II](src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Hash_Table, Two_Pointers, Linked_List, Big_O_Time_O(N)_Space_O(1) | 192 | 63.39
-#### Day 11 Containers and Libraries
+#### Day 11 Linked List
| | | | | |
|-|-|-|-|-|-
-| 1356 |[Sort Integers by The Number of 1 Bits](src/main/kotlin/g1301_1400/s1356_sort_integers_by_the_number_of_1_bits/Solution.kt)| Easy | Array, Sorting, Bit_Manipulation, Counting | 236 | 92.31
-| 0232 |[Implement Queue using Stacks](src/main/kotlin/g0201_0300/s0232_implement_queue_using_stacks/MyQueue.kt)| Easy | Stack, Design, Queue | 258 | 70.86
-| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | Top_Interview_Questions, String, Hash_Table, Sorting | 251 | 87.65
-| 0217 |[Contains Duplicate](src/main/kotlin/g0201_0300/s0217_contains_duplicate/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting | 719 | 73.49
+| 0160 |[Intersection of Two Linked Lists](src/main/kotlin/g0101_0200/s0160_intersection_of_two_linked_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Two_Pointers, Linked_List, Big_O_Time_O(M+N)_Space_O(1) | 262 | 83.50
+| 0082 |[Remove Duplicates from Sorted List II](src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt)| Medium | Two_Pointers, Linked_List | 166 | 89.47
-#### Day 12 Class and Object
+#### Day 12 Linked List
| | | | | |
|-|-|-|-|-|-
-| 1603 |[Design Parking System](src/main/kotlin/g1601_1700/s1603_design_parking_system/ParkingSystem.kt)| Easy | Design, Simulation, Counting | 376 | 31.83
-| 0303 |[Range Sum Query - Immutable](src/main/kotlin/g0301_0400/s0303_range_sum_query_immutable/NumArray.kt)| Easy | Array, Design, Prefix_Sum | 472 | 63.64
+| 0024 |[Swap Nodes in Pairs](src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt)| Medium | Top_100_Liked_Questions, Linked_List, Recursion, Big_O_Time_O(n)_Space_O(1) | 149 | 44.20
+| 0707 |[Design Linked List](src/main/kotlin/g0701_0800/s0707_design_linked_list/MyLinkedList.kt)| Medium | Design, Linked_List | 243 | 100.00
-### Programming Skills II
+#### Day 13 Linked List
-#### Day 1
+| | | | | |
+|-|-|-|-|-|-
+| 0025 |[Reverse Nodes in k-Group](src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt)| Hard | Top_100_Liked_Questions, Linked_List, Recursion, Big_O_Time_O(n)_Space_O(k) | 189 | 67.03
+| 0143 |[Reorder List](src/main/kotlin/g0101_0200/s0143_reorder_list/Solution.kt)| Medium | Two_Pointers, Stack, Linked_List, Recursion | 395 | 82.26
+
+#### Day 14 Stack Queue
| | | | | |
|-|-|-|-|-|-
-| 0896 |[Monotonic Array](src/main/kotlin/g0801_0900/s0896_monotonic_array/Solution.kt)| Easy | Array | 576 | 90.91
-| 0028 |[Find the Index of the First Occurrence in a String](src/main/kotlin/g0001_0100/s0028_implement_strstr/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers, String_Matching | 257 | 32.35
+| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design, Big_O_Time_O(1)_Space_O(N) | 331 | 84.88
+| 1249 |[Minimum Remove to Make Valid Parentheses](src/main/kotlin/g1201_1300/s1249_minimum_remove_to_make_valid_parentheses/Solution.kt)| Medium | String, Stack | 218 | 100.00
+| 1823 |[Find the Winner of the Circular Game](src/main/kotlin/g1801_1900/s1823_find_the_winner_of_the_circular_game/Solution.kt)| Medium | Array, Math, Simulation, Recursion, Queue | 119 | 87.50
-#### Day 2
+#### Day 15 Tree
| | | | | |
|-|-|-|-|-|-
-| 0110 |[Balanced Binary Tree](src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree | 310 | 63.63
-| 0459 |[Repeated Substring Pattern](src/main/kotlin/g0401_0500/s0459_repeated_substring_pattern/Solution.kt)| Easy | String, String_Matching | 201 | 100.00
+| 0108 |[Convert Sorted Array to Binary Search Tree](src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt)| Easy | Top_Interview_Questions, Array, Tree, Binary_Tree, Binary_Search_Tree, Divide_and_Conquer | 167 | 80.29
+| 0105 |[Construct Binary Tree from Preorder and Inorder Traversal](src/main/kotlin/g0101_0200/s0105_construct_binary_tree_from_preorder_and_inorder_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Tree, Binary_Tree, Divide_and_Conquer, Big_O_Time_O(N)_Space_O(N) | 183 | 95.45
+| 0103 |[Binary Tree Zigzag Level Order Traversal](src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt)| Medium | Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree | 176 | 71.62
-#### Day 3
+#### Day 16 Tree
| | | | | |
|-|-|-|-|-|-
-| 0150 |[Evaluate Reverse Polish Notation](src/main/kotlin/g0101_0200/s0150_evaluate_reverse_polish_notation/Solution.kt)| Medium | Top_Interview_Questions, Array, Math, Stack | 233 | 88.82
-| 0066 |[Plus One](src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt)| Easy | Top_Interview_Questions, Array, Math | 303 | 35.18
+| 0199 |[Binary Tree Right Side View](src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/BFS | 194 | 92.89
+| 0113 |[Path Sum II](src/main/kotlin/g0101_0200/s0113_path_sum_ii/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, Backtracking | 364 | 78.67
+| 0450 |[Delete Node in a BST](src/main/kotlin/g0401_0500/s0450_delete_node_in_a_bst/Solution.kt)| Medium | Tree, Binary_Tree, Binary_Search_Tree, LeetCode_75_Binary_Search_Tree | 257 | 84.62
-#### Day 4
+#### Day 17 Tree
| | | | | |
|-|-|-|-|-|-
-| 1367 |[Linked List in Binary Tree](src/main/kotlin/g1301_1400/s1367_linked_list_in_binary_tree/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Linked_List | 237 | 92.86
-| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation | 390 | 56.25
+| 0230 |[Kth Smallest Element in a BST](src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree, Big_O_Time_O(n)_Space_O(n) | 393 | 33.33
+| 0173 |[Binary Search Tree Iterator](src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt)| Medium | Tree, Binary_Tree, Stack, Design, Binary_Search_Tree, Iterator | 563 | 46.91
-#### Day 5
+#### Day 18 Tree
| | | | | |
|-|-|-|-|-|-
-| 0067 |[Add Binary](src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt)| Easy | String, Math, Bit_Manipulation, Simulation | 327 | 32.67
-| 0989 |[Add to Array-Form of Integer](src/main/kotlin/g0901_1000/s0989_add_to_array_form_of_integer/Solution.kt)| Easy | Array, Math | 350 | 70.00
+| 0236 |[Lowest Common Ancestor of a Binary Tree](src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(n)_Space_O(n) | 386 | 45.21
+| 0297 |[Serialize and Deserialize Binary Tree](src/main/kotlin/g0201_0300/s0297_serialize_and_deserialize_binary_tree/Codec.kt)| Hard | String, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Design | 475 | 78.85
-#### Day 6
+#### Day 19 Graph
| | | | | |
|-|-|-|-|-|-
-| 0739 |[Daily Temperatures](src/main/kotlin/g0701_0800/s0739_daily_temperatures/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Stack, Monotonic_Stack | 936 | 80.54
-| 0058 |[Length of Last Word](src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt)| Easy | String | 243 | 63.33
+| 0997 |[Find the Town Judge](src/main/kotlin/g0901_1000/s0997_find_the_town_judge/Solution.kt)| Easy | Array, Hash_Table, Graph | 475 | 58.62
+| 1557 |[Minimum Number of Vertices to Reach All Nodes](src/main/kotlin/g1501_1600/s1557_minimum_number_of_vertices_to_reach_all_nodes/Solution.kt)| Medium | Graph | 792 | 99.29
+| 0841 |[Keys and Rooms](src/main/kotlin/g0801_0900/s0841_keys_and_rooms/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, LeetCode_75_Graphs/DFS | 189 | 69.23
-#### Day 7
+#### Day 20 Heap Priority Queue
| | | | | |
|-|-|-|-|-|-
-| 0048 |[Rotate Image](src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Matrix | 287 | 46.50
-| 1886 |[Determine Whether Matrix Can Be Obtained By Rotation](src/main/kotlin/g1801_1900/s1886_determine_whether_matrix_can_be_obtained_by_rotation/Solution.kt)| Easy | Array, Matrix | 147 | 85.71
+| 0215 |[Kth Largest Element in an Array](src/main/kotlin/g0201_0300/s0215_kth_largest_element_in_an_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Heap_Priority_Queue, Divide_and_Conquer, Quickselect, LeetCode_75_Heap/Priority_Queue, Big_O_Time_O(n\*log(n))_Space_O(log(n)) | 839 | 34.43
+| 0347 |[Top K Frequent Elements](src/main/kotlin/g0301_0400/s0347_top_k_frequent_elements/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Hash_Table, Sorting, Heap_Priority_Queue, Counting, Divide_and_Conquer, Quickselect, Bucket_Sort, Big_O_Time_O(n\*log(n))_Space_O(k) | 268 | 99.74
-#### Day 8
+#### Day 21 Heap Priority Queue
| | | | | |
|-|-|-|-|-|-
-| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_Interview_Questions, Array, Matrix, Simulation | 224 | 62.50
+| 0451 |[Sort Characters By Frequency](src/main/kotlin/g0401_0500/s0451_sort_characters_by_frequency/Solution.kt)| Medium | String, Hash_Table, Sorting, Heap_Priority_Queue, Counting, Bucket_Sort | 288 | 81.72
| 0973 |[K Closest Points to Origin](src/main/kotlin/g0901_1000/s0973_k_closest_points_to_origin/Solution.kt)| Medium | Array, Math, Sorting, Heap_Priority_Queue, Divide_and_Conquer, Geometry, Quickselect | 800 | 37.89
-#### Day 9
+### Algorithm I
+
+#### Day 1 Binary Search
| | | | | |
|-|-|-|-|-|-
-| 1630 |[Arithmetic Subarrays](src/main/kotlin/g1601_1700/s1630_arithmetic_subarrays/Solution.kt)| Medium | Array, Sorting | 264 | 100.00
-| 0429 |[N-ary Tree Level Order Traversal](src/main/kotlin/g0401_0500/s0429_n_ary_tree_level_order_traversal/Solution.kt)| Medium | Breadth_First_Search, Tree | 248 | 75.86
+| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search | 261 | 77.91
+| 0278 |[First Bad Version](src/main/kotlin/g0201_0300/s0278_first_bad_version/Solution.kt)| Easy | Binary_Search, Interactive | 349 | 76.86
+| 0035 |[Search Insert Position](src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 159 | 93.03
-#### Day 10
+#### Day 2 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 0503 |[Next Greater Element II](src/main/kotlin/g0501_0600/s0503_next_greater_element_ii/Solution.kt)| Medium | Array, Stack, Monotonic_Stack | 331 | 92.68
-| 0556 |[Next Greater Element III](src/main/kotlin/g0501_0600/s0556_next_greater_element_iii/Solution.kt)| Medium | String, Math, Two_Pointers | 137 | 80.00
+| 0977 |[Squares of a Sorted Array](src/main/kotlin/g0901_1000/s0977_squares_of_a_sorted_array/Solution.kt)| Easy | Array, Sorting, Two_Pointers | 271 | 77.17
+| 0189 |[Rotate Array](src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Math, Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 483 | 86.95
-#### Day 11
+#### Day 3 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 1376 |[Time Needed to Inform All Employees](src/main/kotlin/g1301_1400/s1376_time_needed_to_inform_all_employees/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree | 915 | 37.62
-| 0049 |[Group Anagrams](src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, String, Hash_Table, Sorting | 506 | 86.55
+| 0283 |[Move Zeroes](src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Two_Pointers, LeetCode_75_Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 516 | 79.07
+| 0167 |[Two Sum II - Input Array Is Sorted](src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers | 403 | 68.74
-#### Day 12
+#### Day 4 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 0438 |[Find All Anagrams in a String](src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Sliding_Window | 561 | 54.68
-| 0713 |[Subarray Product Less Than K](src/main/kotlin/g0701_0800/s0713_subarray_product_less_than_k/Solution.kt)| Medium | Array, Sliding_Window | 336 | 92.11
+| 0344 |[Reverse String](src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt)| Easy | String, Two_Pointers, Recursion | 445 | 69.75
+| 0557 |[Reverse Words in a String III](src/main/kotlin/g0501_0600/s0557_reverse_words_in_a_string_iii/Solution.kt)| Easy | String, Two_Pointers | 215 | 98.10
-#### Day 13
+#### Day 5 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 0304 |[Range Sum Query 2D - Immutable](src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt)| Medium | Array, Matrix, Design, Prefix_Sum | 1373 | 85.71
-| 0910 |[Smallest Range II](src/main/kotlin/g0901_1000/s0910_smallest_range_ii/Solution.kt)| Medium | Array, Math, Sorting, Greedy | 234 | 100.00
+| 0876 |[Middle of the Linked List](src/main/kotlin/g0801_0900/s0876_middle_of_the_linked_list/Solution.kt)| Easy | Two_Pointers, Linked_List | 136 | 76.52
+| 0019 |[Remove Nth Node From End of List](src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Two_Pointers, Linked_List, Big_O_Time_O(L)_Space_O(L) | 144 | 96.28
-#### Day 14
+#### Day 6 Sliding Window
| | | | | |
|-|-|-|-|-|-
-| 0143 |[Reorder List](src/main/kotlin/g0101_0200/s0143_reorder_list/Solution.kt)| Medium | Two_Pointers, Stack, Linked_List, Recursion | 395 | 82.26
-| 0138 |[Copy List with Random Pointer](src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Linked_List | 274 | 80.58
+| 0003 |[Longest Substring Without Repeating Characters](src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(n)_Space_O(1), AI_can_be_used_to_solve_the_task | 201 | 87.28
+| 0567 |[Permutation in String](src/main/kotlin/g0501_0600/s0567_permutation_in_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Two_Pointers, Sliding_Window | 169 | 100.00
-#### Day 15
+#### Day 7 Breadth First Search Depth First Search
| | | | | |
|-|-|-|-|-|-
-| 0002 |[Add Two Numbers](src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Math, Linked_List, Recursion | 417 | 50.44
-| 0445 |[Add Two Numbers II](src/main/kotlin/g0401_0500/s0445_add_two_numbers_ii/Solution.kt)| Medium | Math, Stack, Linked_List | 240 | 82.61
+| 0733 |[Flood Fill](src/main/kotlin/g0701_0800/s0733_flood_fill/Solution.kt)| Easy | Array, Depth_First_Search, Breadth_First_Search, Matrix | 230 | 97.76
+| 0695 |[Max Area of Island](src/main/kotlin/g0601_0700/s0695_max_area_of_island/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 181 | 93.83
-#### Day 16
+#### Day 8 Breadth First Search Depth First Search
| | | | | |
|-|-|-|-|-|-
-| 0061 |[Rotate List](src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt)| Medium | Two_Pointers, Linked_List | 193 | 92.16
-| 0173 |[Binary Search Tree Iterator](src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt)| Medium | Tree, Binary_Tree, Stack, Design, Binary_Search_Tree, Iterator | 563 | 46.91
+| 0617 |[Merge Two Binary Trees](src/main/kotlin/g0601_0700/s0617_merge_two_binary_trees/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 243 | 72.83
+| 0116 |[Populating Next Right Pointers in Each Node](src/main/kotlin/g0101_0200/s0116_populating_next_right_pointers_in_each_node/Solution.kt)| Medium | Top_Interview_Questions, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Linked_List | 355 | 69.02
-#### Day 17
+#### Day 9 Breadth First Search Depth First Search
| | | | | |
|-|-|-|-|-|-
-| 1845 |[Seat Reservation Manager](src/main/kotlin/g1801_1900/s1845_seat_reservation_manager/SeatManager.kt)| Medium | Design, Heap_Priority_Queue | 834 | 100.00
-| 0860 |[Lemonade Change](src/main/kotlin/g0801_0900/s0860_lemonade_change/Solution.kt)| Easy | Array, Greedy | 413 | 86.96
+| 0542 |[01 Matrix](src/main/kotlin/g0501_0600/s0542_01_matrix/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search, Matrix | 441 | 94.06
+| 0994 |[Rotting Oranges](src/main/kotlin/g0901_1000/s0994_rotting_oranges/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Breadth_First_Search, Matrix, LeetCode_75_Graphs/BFS | 164 | 82.95
-#### Day 18
+#### Day 10 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Stack, Design | 331 | 84.88
-| 0341 |[Flatten Nested List Iterator](src/main/kotlin/g0301_0400/s0341_flatten_nested_list_iterator/NestedIterator.kt)| Medium | Top_Interview_Questions, Depth_First_Search, Tree, Stack, Design, Queue, Iterator | 210 | 100.00
+| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, Big_O_Time_O(m+n)_Space_O(m+n) | 157 | 92.24
+| 0206 |[Reverse Linked List](src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion, LeetCode_75_LinkedList, Big_O_Time_O(N)_Space_O(1) | 279 | 45.78
-#### Day 19
+#### Day 11 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 1797 |[Design Authentication Manager](src/main/kotlin/g1701_1800/s1797_design_authentication_manager/AuthenticationManager.kt)| Medium | Hash_Table, Design | 334 | 100.00
-| 0707 |[Design Linked List](src/main/kotlin/g0701_0800/s0707_design_linked_list/MyLinkedList.kt)| Medium | Design, Linked_List | 243 | 100.00
+| 0077 |[Combinations](src/main/kotlin/g0001_0100/s0077_combinations/Solution.kt)| Medium | Backtracking | 232 | 100.00
+| 0046 |[Permutations](src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Backtracking, Big_O_Time_O(n\*n!)_Space_O(n+n!) | 188 | 99.00
+| 0784 |[Letter Case Permutation](src/main/kotlin/g0701_0800/s0784_letter_case_permutation/Solution.kt)| Medium | String, Bit_Manipulation, Backtracking | 219 | 84.62
-#### Day 20
+#### Day 12 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 0380 |[Insert Delete GetRandom O(1)](src/main/kotlin/g0301_0400/s0380_insert_delete_getrandom_o1/RandomizedSet.kt)| Medium | Top_Interview_Questions, Array, Hash_Table, Math, Design, Randomized | 1326 | 68.23
-| 0622 |[Design Circular Queue](src/main/kotlin/g0601_0700/s0622_design_circular_queue/MyCircularQueue.kt)| Medium | Array, Design, Linked_List, Queue | 234 | 92.68
-| 0729 |[My Calendar I](src/main/kotlin/g0701_0800/s0729_my_calendar_i/MyCalendar.kt)| Medium | Binary_Search, Design, Ordered_Set, Segment_Tree | 378 | 69.70
+| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization, Big_O_Time_O(n)_Space_O(n) | 124 | 71.98
+| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, LeetCode_75_DP/1D, Big_O_Time_O(n)_Space_O(n) | 156 | 92.24
+| 0120 |[Triangle](src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt)| Medium | Array, Dynamic_Programming | 194 | 97.87
-### Graph Theory I
+#### Day 13 Bit Manipulation
-#### Day 1 Matrix Related Problems
+| | | | | |
+|-|-|-|-|-|-
+| 0231 |[Power of Two](src/main/kotlin/g0201_0300/s0231_power_of_two/Solution.kt)| Easy | Math, Bit_Manipulation, Recursion | 161 | 86.81
+| 0191 |[Number of 1 Bits](src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation | 237 | 68.44
+
+#### Day 14 Bit Manipulation
| | | | | |
|-|-|-|-|-|-
-| 0733 |[Flood Fill](src/main/kotlin/g0701_0800/s0733_flood_fill/Solution.kt)| Easy | Array, Depth_First_Search, Breadth_First_Search, Matrix | 230 | 97.76
-| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 252 | 95.41
+| 0190 |[Reverse Bits](src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation, Divide_and_Conquer | 198 | 81.82
+| 0136 |[Single Number](src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, LeetCode_75_Bit_Manipulation, Big_O_Time_O(N)_Space_O(1) | 344 | 83.63
-#### Day 2 Matrix Related Problems
+### Algorithm II
+
+#### Day 1 Binary Search
| | | | | |
|-|-|-|-|-|-
-| 0695 |[Max Area of Island](src/main/kotlin/g0601_0700/s0695_max_area_of_island/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 324 | 24.06
-| 1254 |[Number of Closed Islands](src/main/kotlin/g1201_1300/s1254_number_of_closed_islands/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 177 | 89.47
+| 0034 |[Find First and Last Position of Element in Sorted Array](src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 174 | 100.00
+| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 151 | 93.77
+| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix, Big_O_Time_O(endRow+endCol)_Space_O(1) | 159 | 74.46
-#### Day 3 Matrix Related Problems
+#### Day 2 Binary Search
| | | | | |
|-|-|-|-|-|-
-| 1020 |[Number of Enclaves](src/main/kotlin/g1001_1100/s1020_number_of_enclaves/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 369 | 76.26
-| 1905 |[Count Sub Islands](src/main/kotlin/g1901_2000/s1905_count_sub_islands/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 866 | 100.00
+| 0153 |[Find Minimum in Rotated Sorted Array](src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Big_O_Time_O(log_N)_Space_O(log_N) | 262 | 60.96
+| 0162 |[Find Peak Element](src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt)| Medium | Top_Interview_Questions, Array, Binary_Search, LeetCode_75_Binary_Search | 297 | 53.85
-#### Day 4 Matrix Related Problems
+#### Day 3 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 1162 |[As Far from Land as Possible](src/main/kotlin/g1101_1200/s1162_as_far_from_land_as_possible/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search, Matrix | 362 | 81.25
-| 0417 |[Pacific Atlantic Water Flow](src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 319 | 100.00
+| 0082 |[Remove Duplicates from Sorted List II](src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt)| Medium | Two_Pointers, Linked_List | 166 | 89.47
+| 0015 |[3Sum](src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Sorting, Two_Pointers, Big_O_Time_O(n\*log(n))_Space_O(n^2) | 493 | 93.45
-#### Day 5 Matrix Related Problems
+#### Day 4 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 1091 |[Shortest Path in Binary Matrix](src/main/kotlin/g1001_1100/s1091_shortest_path_in_binary_matrix/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 305 | 98.28
-| 0542 |[01 Matrix](src/main/kotlin/g0501_0600/s0542_01_matrix/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search, Matrix | 441 | 94.06
+| 0844 |[Backspace String Compare](src/main/kotlin/g0801_0900/s0844_backspace_string_compare/Solution.kt)| Easy | String, Two_Pointers, Stack, Simulation | 126 | 98.31
+| 0986 |[Interval List Intersections](src/main/kotlin/g0901_1000/s0986_interval_list_intersections/Solution.kt)| Medium | Array, Two_Pointers | 318 | 60.98
+| 0011 |[Container With Most Water](src/main/kotlin/g0001_0100/s0011_container_with_most_water/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Greedy, Two_Pointers, LeetCode_75_Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 402 | 78.57
-#### Day 6 Matrix Related Problems
+#### Day 5 Sliding Window
| | | | | |
|-|-|-|-|-|-
-| 0934 |[Shortest Bridge](src/main/kotlin/g0901_1000/s0934_shortest_bridge/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 301 | 80.95
-| 1926 |[Nearest Exit from Entrance in Maze](src/main/kotlin/g1901_2000/s1926_nearest_exit_from_entrance_in_maze/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 351 | 94.44
+| 0438 |[Find All Anagrams in a String](src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Sliding_Window, Big_O_Time_O(n+m)_Space_O(1) | 561 | 54.68
+| 0713 |[Subarray Product Less Than K](src/main/kotlin/g0701_0800/s0713_subarray_product_less_than_k/Solution.kt)| Medium | Array, Sliding_Window | 336 | 92.11
+| 0209 |[Minimum Size Subarray Sum](src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt)| Medium | Array, Binary_Search, Prefix_Sum, Sliding_Window | 315 | 96.73
-#### Day 7 Standard Traversal
+#### Day 6 Breadth First Search Depth First Search
+
+| | | | | |
+|-|-|-|-|-|-
+| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find, Big_O_Time_O(M\*N)_Space_O(M\*N) | 252 | 95.41
+| 0547 |[Number of Provinces](src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find, LeetCode_75_Graphs/DFS | 229 | 79.73
+
+#### Day 7 Breadth First Search Depth First Search
+
+| | | | | |
+|-|-|-|-|-|-
+| 0117 |[Populating Next Right Pointers in Each Node II](src/main/kotlin/g0101_0200/s0117_populating_next_right_pointers_in_each_node_ii/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Linked_List | 199 | 94.67
+| 0572 |[Subtree of Another Tree](src/main/kotlin/g0501_0600/s0572_subtree_of_another_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Hash_Function, String_Matching | 214 | 92.39
+
+#### Day 8 Breadth First Search Depth First Search
| | | | | |
|-|-|-|-|-|-
+| 1091 |[Shortest Path in Binary Matrix](src/main/kotlin/g1001_1100/s1091_shortest_path_in_binary_matrix/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 305 | 98.28
+| 0130 |[Surrounded Regions](src/main/kotlin/g0101_0200/s0130_surrounded_regions/Solution.kt)| Medium | Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 355 | 84.42
| 0797 |[All Paths From Source to Target](src/main/kotlin/g0701_0800/s0797_all_paths_from_source_to_target/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Backtracking | 232 | 100.00
-| 0841 |[Keys and Rooms](src/main/kotlin/g0801_0900/s0841_keys_and_rooms/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph | 189 | 69.23
-#### Day 8 Standard Traversal
+#### Day 9 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 0547 |[Number of Provinces](src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 229 | 79.73
-| 1319 |[Number of Operations to Make Network Connected](src/main/kotlin/g1301_1400/s1319_number_of_operations_to_make_network_connected/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 379 | 83.33
+| 0078 |[Subsets](src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, Backtracking, Big_O_Time_O(2^n)_Space_O(n\*2^n) | 171 | 94.92
+| 0090 |[Subsets II](src/main/kotlin/g0001_0100/s0090_subsets_ii/Solution.kt)| Medium | Array, Bit_Manipulation, Backtracking | 200 | 88.33
-#### Day 9 Standard Traversal
+#### Day 10 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 1376 |[Time Needed to Inform All Employees](src/main/kotlin/g1301_1400/s1376_time_needed_to_inform_all_employees/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree | 915 | 37.62
-| 0802 |[Find Eventual Safe States](src/main/kotlin/g0801_0900/s0802_find_eventual_safe_states/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Topological_Sort | 511 | 100.00
+| 0047 |[Permutations II](src/main/kotlin/g0001_0100/s0047_permutations_ii/Solution.kt)| Medium | Array, Backtracking | 199 | 100.00
+| 0039 |[Combination Sum](src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Backtracking, Big_O_Time_O(2^n)_Space_O(n+2^n) | 226 | 88.89
+| 0040 |[Combination Sum II](src/main/kotlin/g0001_0100/s0040_combination_sum_ii/Solution.kt)| Medium | Array, Backtracking | 217 | 93.75
-#### Day 10 Standard Traversal
+#### Day 11 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 1129 |[Shortest Path with Alternating Colors](src/main/kotlin/g1101_1200/s1129_shortest_path_with_alternating_colors/Solution.kt)| Medium | Breadth_First_Search, Graph | 241 | 16.67
-| 1466 |[Reorder Routes to Make All Paths Lead to the City Zero](src/main/kotlin/g1401_1500/s1466_reorder_routes_to_make_all_paths_lead_to_the_city_zero/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph | 718 | 100.00
-| 0847 |[Shortest Path Visiting All Nodes](src/main/kotlin/g0801_0900/s0847_shortest_path_visiting_all_nodes/Solution.kt)| Hard | Dynamic_Programming, Breadth_First_Search, Bit_Manipulation, Graph, Bitmask | 164 | 100.00
+| 0017 |[Letter Combinations of a Phone Number](src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Backtracking, LeetCode_75_Backtracking, Big_O_Time_O(4^n)_Space_O(n) | 155 | 95.24
+| 0022 |[Generate Parentheses](src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Backtracking, Big_O_Time_O(2^n)_Space_O(n) | 161 | 85.45
+| 0079 |[Word Search](src/main/kotlin/g0001_0100/s0079_word_search/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Matrix, Backtracking, Big_O_Time_O(4^(m\*n))_Space_O(m\*n) | 392 | 72.92
-#### Day 11 Breadth First Search
+#### Day 12 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 1306 |[Jump Game III](src/main/kotlin/g1301_1400/s1306_jump_game_iii/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search | 291 | 100.00
-| 1654 |[Minimum Jumps to Reach Home](src/main/kotlin/g1601_1700/s1654_minimum_jumps_to_reach_home/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search | 192 | 100.00
-| 0365 |[Water and Jug Problem](src/main/kotlin/g0301_0400/s0365_water_and_jug_problem/Solution.kt)| Medium | Math, Depth_First_Search, Breadth_First_Search | 130 | 100.00
+| 0213 |[House Robber II](src/main/kotlin/g0201_0300/s0213_house_robber_ii/Solution.kt)| Medium | Array, Dynamic_Programming | 257 | 59.62
+| 0055 |[Jump Game](src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming, Greedy, Big_O_Time_O(n)_Space_O(1) | 332 | 89.35
-#### Day 12 Breadth First Search
+#### Day 13 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 0433 |[Minimum Genetic Mutation](src/main/kotlin/g0401_0500/s0433_minimum_genetic_mutation/Solution.kt)| Medium | String, Hash_Table, Breadth_First_Search | 204 | 82.08
-| 0752 |[Open the Lock](src/main/kotlin/g0701_0800/s0752_open_the_lock/Solution.kt)| Medium | Array, String, Hash_Table, Breadth_First_Search | 310 | 100.00
-| 0127 |[Word Ladder](src/main/kotlin/g0101_0200/s0127_word_ladder/Solution.kt)| Hard | Top_Interview_Questions, String, Hash_Table, Breadth_First_Search | 396 | 98.68
+| 0045 |[Jump Game II](src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Greedy, Big_O_Time_O(n)_Space_O(1) | 208 | 93.37
+| 0062 |[Unique Paths](src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Combinatorics, LeetCode_75_DP/Multidimensional, Big_O_Time_O(m\*n)_Space_O(m\*n) | 118 | 94.65
-#### Day 13 Graph Theory
+#### Day 14 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 0997 |[Find the Town Judge](src/main/kotlin/g0901_1000/s0997_find_the_town_judge/Solution.kt)| Easy | Array, Hash_Table, Graph | 475 | 58.62
-| 1557 |[Minimum Number of Vertices to Reach All Nodes](src/main/kotlin/g1501_1600/s1557_minimum_number_of_vertices_to_reach_all_nodes/Solution.kt)| Medium | Graph | 792 | 99.29
+| 0005 |[Longest Palindromic Substring](src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Big_O_Time_O(n)_Space_O(n) | 162 | 99.00
+| 0413 |[Arithmetic Slices](src/main/kotlin/g0401_0500/s0413_arithmetic_slices/Solution.kt)| Medium | Array, Dynamic_Programming | 156 | 100.00
-#### Day 14 Graph Theory
+#### Day 15 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 1615 |[Maximal Network Rank](src/main/kotlin/g1601_1700/s1615_maximal_network_rank/Solution.kt)| Medium | Graph | 282 | 100.00
-| 0886 |[Possible Bipartition](src/main/kotlin/g0801_0900/s0886_possible_bipartition/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 397 | 100.00
-| 0785 |[Is Graph Bipartite?](src/main/kotlin/g0701_0800/s0785_is_graph_bipartite/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 215 | 82.35
+| 0091 |[Decode Ways](src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt)| Medium | Top_Interview_Questions, String, Dynamic_Programming | 148 | 79.07
+| 0139 |[Word Break](src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Hash_Table, Dynamic_Programming, Trie, Memoization, Big_O_Time_O(M+max\*N)_Space_O(M+N+max) | 197 | 87.17
-### SQL I
+#### Day 16 Dynamic Programming
-#### Day 1 Select
+| | | | | |
+|-|-|-|-|-|-
+| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Binary_Search, Big_O_Time_O(n\*log_n)_Space_O(n) | 318 | 82.28
+| 0673 |[Number of Longest Increasing Subsequence](src/main/kotlin/g0601_0700/s0673_number_of_longest_increasing_subsequence/Solution.kt)| Medium | Array, Dynamic_Programming, Segment_Tree, Binary_Indexed_Tree | 226 | 91.67
+
+#### Day 17 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 0595 |[Big Countries](src/main/kotlin/g0501_0600/s0595_big_countries/script.sql)| Easy | Database | 417 | 56.09
-| 1757 |[Recyclable and Low Fat Products](src/main/kotlin/g1701_1800/s1757_recyclable_and_low_fat_products/script.sql)| Easy | Database | 1237 | 34.20
-| 0584 |[Find Customer Referee](src/main/kotlin/g0501_0600/s0584_find_customer_referee/script.sql)| Easy | Database | 779 | 43.48
-| 0183 |[Customers Who Never Order](src/main/kotlin/g0101_0200/s0183_customers_who_never_order/script.sql)| Easy | Database | 712 | 33.67
+| 1143 |[Longest Common Subsequence](src/main/kotlin/g1101_1200/s1143_longest_common_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming, LeetCode_75_DP/Multidimensional, Big_O_Time_O(n\*m)_Space_O(n\*m) | 307 | 38.36
+| 0583 |[Delete Operation for Two Strings](src/main/kotlin/g0501_0600/s0583_delete_operation_for_two_strings/Solution.kt)| Medium | String, Dynamic_Programming | 197 | 100.00
-#### Day 2 Select and Order
+#### Day 18 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 1873 |[Calculate Special Bonus](src/main/kotlin/g1801_1900/s1873_calculate_special_bonus/script.sql)| Easy | Database | 1321 | 33.12
-| 0627 |[Swap Salary](src/main/kotlin/g0601_0700/s0627_swap_salary/script.sql)| Easy | Database | 400 | 51.04
-| 0196 |[Delete Duplicate Emails](src/main/kotlin/g0101_0200/s0196_delete_duplicate_emails/script.sql)| Easy | Database | 593 | 94.17
+| 0072 |[Edit Distance](src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming, LeetCode_75_DP/Multidimensional, Big_O_Time_O(n^2)_Space_O(n2) | 182 | 92.16
+| 0322 |[Coin Change](src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Breadth_First_Search, Big_O_Time_O(m\*n)_Space_O(amount) | 332 | 50.68
+| 0343 |[Integer Break](src/main/kotlin/g0301_0400/s0343_integer_break/Solution.kt)| Medium | Dynamic_Programming, Math | 218 | 63.89
-#### Day 3 String Processing Functions
+#### Day 19 Bit Manipulation
| | | | | |
|-|-|-|-|-|-
-| 1667 |[Fix Names in a Table](src/main/kotlin/g1601_1700/s1667_fix_names_in_a_table/script.sql)| Easy | Database | 1196 | 61.40
-| 1484 |[Group Sold Products By The Date](src/main/kotlin/g1401_1500/s1484_group_sold_products_by_the_date/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 899 | 40.76
-| 1527 |[Patients With a Condition](src/main/kotlin/g1501_1600/s1527_patients_with_a_condition/script.sql)| Easy | Database | 708 | 48.23
+| 0201 |[Bitwise AND of Numbers Range](src/main/kotlin/g0201_0300/s0201_bitwise_and_of_numbers_range/Solution.kt)| Medium | Bit_Manipulation | 368 | 80.00
-#### Day 4 Union and Select
+#### Day 20 Others
| | | | | |
|-|-|-|-|-|-
-| 1965 |[Employees With Missing Information](src/main/kotlin/g1901_2000/s1965_employees_with_missing_information/script.sql)| Easy | Database | 1355 | 23.96
-| 1795 |[Rearrange Products Table](src/main/kotlin/g1701_1800/s1795_rearrange_products_table/script.sql)| Easy | Database | 1027 | 67.57
-| 0608 |[Tree Node](src/main/kotlin/g0601_0700/s0608_tree_node/script.sql)| Medium | LeetCode_Curated_SQL_70, Database | 794 | 48.38
-| 0176 |[Second Highest Salary](src/main/kotlin/g0101_0200/s0176_second_highest_salary/script.sql)| Medium | Database | 219 | 92.54
+| 0384 |[Shuffle an Array](src/main/kotlin/g0301_0400/s0384_shuffle_an_array/Solution.kt)| Medium | Array, Math, Randomized | 940 | 72.09
-#### Day 5 Union
+#### Day 21 Others
| | | | | |
|-|-|-|-|-|-
-| 0175 |[Combine Two Tables](src/main/kotlin/g0101_0200/s0175_combine_two_tables/script.sql)| Easy | Database | 473 | 54.97
-| 1581 |[Customer Who Visited but Did Not Make Any Transactions](src/main/kotlin/g1501_1600/s1581_customer_who_visited_but_did_not_make_any_transactions/script.sql)| Easy | Database | 2771 | 54.68
-| 1148 |[Article Views I](src/main/kotlin/g1101_1200/s1148_article_views_i/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 806 | 54.41
+| 0202 |[Happy Number](src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt)| Easy | Top_Interview_Questions, Hash_Table, Math, Two_Pointers | 261 | 45.08
+| 0149 |[Max Points on a Line](src/main/kotlin/g0101_0200/s0149_max_points_on_a_line/Solution.kt)| Hard | Top_Interview_Questions, Array, Hash_Table, Math, Geometry | 307 | 83.33
-#### Day 6 Union
+### Binary Search I
+
+#### Day 1
| | | | | |
|-|-|-|-|-|-
-| 0197 |[Rising Temperature](src/main/kotlin/g0101_0200/s0197_rising_temperature/script.sql)| Easy | Database | 394 | 94.15
-| 0607 |[Sales Person](src/main/kotlin/g0601_0700/s0607_sales_person/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 2142 | 44.56
+| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search | 261 | 77.91
+| 0374 |[Guess Number Higher or Lower](src/main/kotlin/g0301_0400/s0374_guess_number_higher_or_lower/Solution.kt)| Easy | Binary_Search, Interactive, LeetCode_75_Binary_Search | 134 | 94.19
-#### Day 7 Function
+#### Day 2
| | | | | |
|-|-|-|-|-|-
-| 1141 |[User Activity for the Past 30 Days I](src/main/kotlin/g1101_1200/s1141_user_activity_for_the_past_30_days_i/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 790 | 87.11
-| 1693 |[Daily Leads and Partners](src/main/kotlin/g1601_1700/s1693_daily_leads_and_partners/script.sql)| Easy | Database | 1115 | 52.84
-| 1729 |[Find Followers Count](src/main/kotlin/g1701_1800/s1729_find_followers_count/script.sql)| Easy | Database | 1228 | 38.04
+| 0035 |[Search Insert Position](src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 159 | 93.03
+| 0852 |[Peak Index in a Mountain Array](src/main/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/Solution.kt)| Medium | Array, Binary_Search | 433 | 94.29
-#### Day 8 Function
+#### Day 3
| | | | | |
|-|-|-|-|-|-
-| 0586 |[Customer Placing the Largest Number of Orders](src/main/kotlin/g0501_0600/s0586_customer_placing_the_largest_number_of_orders/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 768 | 44.85
-| 0511 |[Game Play Analysis I](src/main/kotlin/g0501_0600/s0511_game_play_analysis_i/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 790 | 45.04
-| 1890 |[The Latest Login in 2020](src/main/kotlin/g1801_1900/s1890_the_latest_login_in_2020/script.sql)| Easy | Database | 1486 | 22.18
-| 1741 |[Find Total Time Spent by Each Employee](src/main/kotlin/g1701_1800/s1741_find_total_time_spent_by_each_employee/script.sql)| Easy | Database | 1101 | 51.40
+| 0367 |[Valid Perfect Square](src/main/kotlin/g0301_0400/s0367_valid_perfect_square/Solution.kt)| Easy | Math, Binary_Search | 137 | 94.55
+| 1385 |[Find the Distance Value Between Two Arrays](src/main/kotlin/g1301_1400/s1385_find_the_distance_value_between_two_arrays/Solution.kt)| Easy | Array, Sorting, Binary_Search, Two_Pointers | 190 | 84.62
-#### Day 9 Control of Flow
+#### Day 4
| | | | | |
|-|-|-|-|-|-
-| 1393 |[Capital Gain/Loss](src/main/kotlin/g1301_1400/s1393_capital_gainloss/script.sql)| Medium | LeetCode_Curated_SQL_70, Database | 990 | 47.36
-| 1407 |[Top Travellers](src/main/kotlin/g1401_1500/s1407_top_travellers/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 2035 | 14.53
-| 1158 |[Market Analysis I](src/main/kotlin/g1101_1200/s1158_market_analysis_i/script.sql)| Medium | Database | 2470 | 44.76
+| 0069 |[Sqrt(x)](src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt)| Easy | Top_Interview_Questions, Math, Binary_Search | 140 | 94.72
+| 0744 |[Find Smallest Letter Greater Than Target](src/main/kotlin/g0701_0800/s0744_find_smallest_letter_greater_than_target/Solution.kt)| Easy | Array, Binary_Search | 162 | 100.00
-#### Day 10 Where
+#### Day 5
| | | | | |
|-|-|-|-|-|-
-| 0182 |[Duplicate Emails](src/main/kotlin/g0101_0200/s0182_duplicate_emails/script.sql)| Easy | Database | 396 | 68.40
-| 1050 |[Actors and Directors Who Cooperated At Least Three Times](src/main/kotlin/g1001_1100/s1050_actors_and_directors_who_cooperated_at_least_three_times/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 629 | 81.02
-| 1587 |[Bank Account Summary II](src/main/kotlin/g1501_1600/s1587_bank_account_summary_ii/script.sql)| Easy | Database | 1582 | 52.96
-| 1084 |[Sales Analysis III](src/main/kotlin/g1001_1100/s1084_sales_analysis_iii/script.sql)| Easy | LeetCode_Curated_SQL_70, Database | 1881 | 79.36
+| 0278 |[First Bad Version](src/main/kotlin/g0201_0300/s0278_first_bad_version/Solution.kt)| Easy | Binary_Search, Interactive | 349 | 76.86
+| 0034 |[Find First and Last Position of Element in Sorted Array](src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 174 | 100.00
-### Level 1
+#### Day 6
-#### Day 1 Prefix Sum
+| | | | | |
+|-|-|-|-|-|-
+| 0441 |[Arranging Coins](src/main/kotlin/g0401_0500/s0441_arranging_coins/Solution.kt)| Easy | Math, Binary_Search | 150 | 84.21
+| 1539 |[Kth Missing Positive Number](src/main/kotlin/g1501_1600/s1539_kth_missing_positive_number/Solution.kt)| Easy | Array, Binary_Search | 153 | 100.00
+
+#### Day 7
| | | | | |
|-|-|-|-|-|-
-| 1480 |[Running Sum of 1d Array](src/main/kotlin/g1401_1500/s1480_running_sum_of_1d_array/Solution.kt)| Easy | Array, Prefix_Sum | 195 | 21.52
-| 0724 |[Find Pivot Index](src/main/kotlin/g0701_0800/s0724_find_pivot_index/Solution.kt)| Easy | Array, Prefix_Sum | 255 | 88.92
+| 0167 |[Two Sum II - Input Array Is Sorted](src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers | 403 | 68.74
+| 1608 |[Special Array With X Elements Greater Than or Equal X](src/main/kotlin/g1601_1700/s1608_special_array_with_x_elements_greater_than_or_equal_x/Solution.kt)| Easy | Array, Sorting, Binary_Search | 147 | 81.82
-#### Day 2 String
+#### Day 8
| | | | | |
|-|-|-|-|-|-
-| 0205 |[Isomorphic Strings](src/main/kotlin/g0201_0300/s0205_isomorphic_strings/Solution.kt)| Easy | String, Hash_Table | 278 | 79.96
-| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers | 156 | 87.74
+| 1351 |[Count Negative Numbers in a Sorted Matrix](src/main/kotlin/g1301_1400/s1351_count_negative_numbers_in_a_sorted_matrix/Solution.kt)| Easy | Array, Binary_Search, Matrix | 206 | 71.43
+| 0074 |[Search a 2D Matrix](src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix, Big_O_Time_O(endRow+endCol)_Space_O(1) | 159 | 74.46
-#### Day 3 Linked List
+#### Day 9
| | | | | |
|-|-|-|-|-|-
-| 0021 |[Merge Two Sorted Lists](src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion | 176 | 96.25
-| 0206 |[Reverse Linked List](src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Linked_List, Recursion | 279 | 45.78
+| 1337 |[The K Weakest Rows in a Matrix](src/main/kotlin/g1301_1400/s1337_the_k_weakest_rows_in_a_matrix/Solution.kt)| Easy | Array, Sorting, Binary_Search, Matrix, Heap_Priority_Queue | 216 | 77.59
+| 1346 |[Check If N and Its Double Exist](src/main/kotlin/g1301_1400/s1346_check_if_n_and_its_double_exist/Solution.kt)| Easy | Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 175 | 70.83
-#### Day 4 Linked List
+#### Day 10
| | | | | |
|-|-|-|-|-|-
-| 0876 |[Middle of the Linked List](src/main/kotlin/g0801_0900/s0876_middle_of_the_linked_list/Solution.kt)| Easy | Two_Pointers, Linked_List | 136 | 76.52
-| 0142 |[Linked List Cycle II](src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Hash_Table, Two_Pointers, Linked_List | 192 | 63.39
+| 0350 |[Intersection of Two Arrays II](src/main/kotlin/g0301_0400/s0350_intersection_of_two_arrays_ii/Solution.kt)| Easy | Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 321 | 73.37
+| 0633 |[Sum of Square Numbers](src/main/kotlin/g0601_0700/s0633_sum_of_square_numbers/Solution.kt)| Medium | Math, Binary_Search, Two_Pointers | 126 | 100.00
-#### Day 5 Greedy
+#### Day 11
| | | | | |
|-|-|-|-|-|-
-| 0121 |[Best Time to Buy and Sell Stock](src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Dynamic_Programming | 609 | 94.06
-| 0409 |[Longest Palindrome](src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt)| Easy | String, Hash_Table, Greedy | 259 | 60.71
+| 1855 |[Maximum Distance Between a Pair of Values](src/main/kotlin/g1801_1900/s1855_maximum_distance_between_a_pair_of_values/Solution.kt)| Medium | Array, Greedy, Binary_Search, Two_Pointers | 458 | 100.00
+| 0033 |[Search in Rotated Sorted Array](src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 151 | 93.77
-#### Day 6 Tree
+#### Day 12
| | | | | |
|-|-|-|-|-|-
-| 0589 |[N-ary Tree Preorder Traversal](src/main/kotlin/g0501_0600/s0589_n_ary_tree_preorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Stack | 233 | 84.02
-| 0102 |[Binary Tree Level Order Traversal](src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Breadth_First_Search, Tree, Binary_Tree | 332 | 67.53
+| 0153 |[Find Minimum in Rotated Sorted Array](src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Big_O_Time_O(log_N)_Space_O(log_N) | 262 | 60.96
-#### Day 7 Binary Search
+### Binary Search II
+
+#### Day 1
| | | | | |
|-|-|-|-|-|-
-| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Array, Binary_Search | 261 | 77.91
-| 0278 |[First Bad Version](src/main/kotlin/g0201_0300/s0278_first_bad_version/Solution.kt)| Easy | Binary_Search, Interactive | 349 | 76.86
+| 0209 |[Minimum Size Subarray Sum](src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt)| Medium | Array, Binary_Search, Prefix_Sum, Sliding_Window | 315 | 96.73
+| 0611 |[Valid Triangle Number](src/main/kotlin/g0601_0700/s0611_valid_triangle_number/Solution.kt)| Medium | Array, Sorting, Greedy, Binary_Search, Two_Pointers | 203 | 100.00
-#### Day 8 Binary Search Tree
+#### Day 2
| | | | | |
|-|-|-|-|-|-
-| 0098 |[Validate Binary Search Tree](src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 330 | 41.38
-| 0235 |[Lowest Common Ancestor of a Binary Search Tree](src/main/kotlin/g0201_0300/s0235_lowest_common_ancestor_of_a_binary_search_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 404 | 75.59
+| 0658 |[Find K Closest Elements](src/main/kotlin/g0601_0700/s0658_find_k_closest_elements/Solution.kt)| Medium | Array, Sorting, Binary_Search, Two_Pointers, Heap_Priority_Queue | 375 | 95.16
+| 1894 |[Find the Student that Will Replace the Chalk](src/main/kotlin/g1801_1900/s1894_find_the_student_that_will_replace_the_chalk/Solution.kt)| Medium | Array, Binary_Search, Simulation, Prefix_Sum | 520 | 50.00
-#### Day 9 Graph/BFS/DFS
+#### Day 3
| | | | | |
|-|-|-|-|-|-
-| 0733 |[Flood Fill](src/main/kotlin/g0701_0800/s0733_flood_fill/Solution.kt)| Easy | Array, Depth_First_Search, Breadth_First_Search, Matrix | 230 | 97.76
-| 0200 |[Number of Islands](src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Depth_First_Search, Breadth_First_Search, Matrix, Union_Find | 252 | 95.41
+| 0300 |[Longest Increasing Subsequence](src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Binary_Search, Big_O_Time_O(n\*log_n)_Space_O(n) | 318 | 82.28
+| 1760 |[Minimum Limit of Balls in a Bag](src/main/kotlin/g1701_1800/s1760_minimum_limit_of_balls_in_a_bag/Solution.kt)| Medium | Array, Binary_Search | 460 | 100.00
-#### Day 10 Dynamic Programming
+#### Day 4
| | | | | |
|-|-|-|-|-|-
-| 0509 |[Fibonacci Number](src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Recursion, Memoization | 139 | 82.72
-| 0070 |[Climbing Stairs](src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Memoization | 127 | 97.06
+| 0875 |[Koko Eating Bananas](src/main/kotlin/g0801_0900/s0875_koko_eating_bananas/Solution.kt)| Medium | Array, Binary_Search, LeetCode_75_Binary_Search | 267 | 93.85
+| 1552 |[Magnetic Force Between Two Balls](src/main/kotlin/g1501_1600/s1552_magnetic_force_between_two_balls/Solution.kt)| Medium | Array, Sorting, Binary_Search | 636 | 100.00
-#### Day 11 Dynamic Programming
+#### Day 5
| | | | | |
|-|-|-|-|-|-
-| 0746 |[Min Cost Climbing Stairs](src/main/kotlin/g0701_0800/s0746_min_cost_climbing_stairs/Solution.kt)| Easy | Array, Dynamic_Programming | 171 | 96.76
-| 0062 |[Unique Paths](src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Dynamic_Programming, Math, Combinatorics | 209 | 49.18
+| 0287 |[Find the Duplicate Number](src/main/kotlin/g0201_0300/s0287_find_the_duplicate_number/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Two_Pointers, Bit_Manipulation, Big_O_Time_O(n)_Space_O(n) | 656 | 66.21
+| 1283 |[Find the Smallest Divisor Given a Threshold](src/main/kotlin/g1201_1300/s1283_find_the_smallest_divisor_given_a_threshold/Solution.kt)| Medium | Array, Binary_Search | 255 | 100.00
-#### Day 12 Sliding Window/Two Pointer
+#### Day 6
| | | | | |
|-|-|-|-|-|-
-| 0438 |[Find All Anagrams in a String](src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Sliding_Window | 561 | 54.68
-| 0424 |[Longest Repeating Character Replacement](src/main/kotlin/g0401_0500/s0424_longest_repeating_character_replacement/Solution.kt)| Medium | String, Hash_Table, Sliding_Window | 288 | 84.38
+| 1898 |[Maximum Number of Removable Characters](src/main/kotlin/g1801_1900/s1898_maximum_number_of_removable_characters/Solution.kt)| Medium | Array, String, Binary_Search | 636 | 100.00
+| 1870 |[Minimum Speed to Arrive on Time](src/main/kotlin/g1801_1900/s1870_minimum_speed_to_arrive_on_time/Solution.kt)| Medium | Array, Binary_Search | 628 | 50.00
-#### Day 13 Hashmap
+#### Day 7
| | | | | |
|-|-|-|-|-|-
-| 0001 |[Two Sum](src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table | 234 | 92.75
-| 0299 |[Bulls and Cows](src/main/kotlin/g0201_0300/s0299_bulls_and_cows/Solution.kt)| Medium | String, Hash_Table, Counting | 254 | 84.82
+| 1482 |[Minimum Number of Days to Make m Bouquets](src/main/kotlin/g1401_1500/s1482_minimum_number_of_days_to_make_m_bouquets/Solution.kt)| Medium | Array, Binary_Search | 538 | 50.00
+| 1818 |[Minimum Absolute Sum Difference](src/main/kotlin/g1801_1900/s1818_minimum_absolute_sum_difference/Solution.kt)| Medium | Array, Sorting, Binary_Search, Ordered_Set | 447 | 100.00
-#### Day 14 Stack
+#### Day 8
| | | | | |
|-|-|-|-|-|-
-| 0844 |[Backspace String Compare](src/main/kotlin/g0801_0900/s0844_backspace_string_compare/Solution.kt)| Easy | String, Two_Pointers, Stack, Simulation | 126 | 98.31
-| 0394 |[Decode String](src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Stack, Recursion | 224 | 64.86
+| 0240 |[Search a 2D Matrix II](src/main/kotlin/g0201_0300/s0240_search_a_2d_matrix_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Binary_Search, Matrix, Divide_and_Conquer, Big_O_Time_O(n+m)_Space_O(1) | 460 | 66.08
+| 0275 |[H-Index II](src/main/kotlin/g0201_0300/s0275_h_index_ii/Solution.kt)| Medium | Array, Binary_Search | 398 | 81.82
-#### Day 15 Heap
+#### Day 9
| | | | | |
|-|-|-|-|-|-
-| 1046 |[Last Stone Weight](src/main/kotlin/g1001_1100/s1046_last_stone_weight/Solution.kt)| Easy | Array, Heap_Priority_Queue | 123 | 100.00
-| 0692 |[Top K Frequent Words](src/main/kotlin/g0601_0700/s0692_top_k_frequent_words/Solution.kt)| Medium | String, Hash_Table, Sorting, Heap_Priority_Queue, Counting, Trie, Bucket_Sort | 239 | 81.10
+| 1838 |[Frequency of the Most Frequent Element](src/main/kotlin/g1801_1900/s1838_frequency_of_the_most_frequent_element/Solution.kt)| Medium | Array, Sorting, Greedy, Binary_Search, Prefix_Sum, Sliding_Window | 564 | 88.89
+| 0540 |[Single Element in a Sorted Array](src/main/kotlin/g0501_0600/s0540_single_element_in_a_sorted_array/Solution.kt)| Medium | Array, Binary_Search | 274 | 86.67
+
+#### Day 10
+
+| | | | | |
+|-|-|-|-|-|-
+| 0222 |[Count Complete Tree Nodes](src/main/kotlin/g0201_0300/s0222_count_complete_tree_nodes/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Search, Binary_Tree | 0 | 100.00
+| 1712 |[Ways to Split Array Into Three Subarrays](src/main/kotlin/g1701_1800/s1712_ways_to_split_array_into_three_subarrays/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers, Prefix_Sum | 486 | 100.00
+
+#### Day 11
+
+| | | | | |
+|-|-|-|-|-|-
+| 0826 |[Most Profit Assigning Work](src/main/kotlin/g0801_0900/s0826_most_profit_assigning_work/Solution.kt)| Medium | Array, Sorting, Greedy, Binary_Search, Two_Pointers | 366 | 100.00
+| 0436 |[Find Right Interval](src/main/kotlin/g0401_0500/s0436_find_right_interval/Solution.kt)| Medium | Array, Sorting, Binary_Search | 333 | 100.00
+
+#### Day 12
+
+| | | | | |
+|-|-|-|-|-|-
+| 0081 |[Search in Rotated Sorted Array II](src/main/kotlin/g0001_0100/s0081_search_in_rotated_sorted_array_ii/Solution.kt)| Medium | Array, Binary_Search | 170 | 96.30
+| 0162 |[Find Peak Element](src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt)| Medium | Top_Interview_Questions, Array, Binary_Search, LeetCode_75_Binary_Search | 297 | 53.85
+
+#### Day 13
+
+| | | | | |
+|-|-|-|-|-|-
+| 0154 |[Find Minimum in Rotated Sorted Array II](src/main/kotlin/g0101_0200/s0154_find_minimum_in_rotated_sorted_array_ii/Solution.kt)| Hard | Array, Binary_Search | 275 | 84.00
+| 0528 |[Random Pick with Weight](src/main/kotlin/g0501_0600/s0528_random_pick_with_weight/Solution.kt)| Medium | Math, Binary_Search, Prefix_Sum, Randomized | 393 | 91.38
+
+#### Day 14
+
+| | | | | |
+|-|-|-|-|-|-
+| 1508 |[Range Sum of Sorted Subarray Sums](src/main/kotlin/g1501_1600/s1508_range_sum_of_sorted_subarray_sums/Solution.kt)| Medium | Array, Sorting, Binary_Search, Two_Pointers | 378 | 66.67
+| 1574 |[Shortest Subarray to be Removed to Make Array Sorted](src/main/kotlin/g1501_1600/s1574_shortest_subarray_to_be_removed_to_make_array_sorted/Solution.kt)| Medium | Array, Binary_Search, Two_Pointers, Stack, Monotonic_Stack | 477 | 50.00
+
+#### Day 15
+
+| | | | | |
+|-|-|-|-|-|-
+| 1292 |[Maximum Side Length of a Square with Sum Less than or Equal to Threshold](src/main/kotlin/g1201_1300/s1292_maximum_side_length_of_a_square_with_sum_less_than_or_equal_to_threshold/Solution.kt)| Medium | Array, Binary_Search, Matrix, Prefix_Sum | 376 | 100.00
+| 1498 |[Number of Subsequences That Satisfy the Given Sum Condition](src/main/kotlin/g1401_1500/s1498_number_of_subsequences_that_satisfy_the_given_sum_condition/Solution.kt)| Medium | Array, Sorting, Binary_Search, Two_Pointers | 487 | 97.89
+
+#### Day 16
+
+| | | | | |
+|-|-|-|-|-|-
+| 0981 |[Time Based Key-Value Store](src/main/kotlin/g0901_1000/s0981_time_based_key_value_store/TimeMap.kt)| Medium | String, Hash_Table, Binary_Search, Design | 1011 | 65.56
+| 1300 |[Sum of Mutated Array Closest to Target](src/main/kotlin/g1201_1300/s1300_sum_of_mutated_array_closest_to_target/Solution.kt)| Medium | Array, Sorting, Binary_Search | 217 | 100.00
+
+#### Day 17
+
+| | | | | |
+|-|-|-|-|-|-
+| 1802 |[Maximum Value at a Given Index in a Bounded Array](src/main/kotlin/g1801_1900/s1802_maximum_value_at_a_given_index_in_a_bounded_array/Solution.kt)| Medium | Greedy, Binary_Search | 118 | 100.00
+| 1901 |[Find a Peak Element II](src/main/kotlin/g1901_2000/s1901_find_a_peak_element_ii/Solution.kt)| Medium | Array, Binary_Search, Matrix, Divide_and_Conquer | 726 | 100.00
+
+#### Day 18
+
+| | | | | |
+|-|-|-|-|-|-
+| 1146 |[Snapshot Array](src/main/kotlin/g1101_1200/s1146_snapshot_array/SnapshotArray.kt)| Medium | Array, Hash_Table, Binary_Search, Design | 1064 | 57.14
+| 1488 |[Avoid Flood in The City](src/main/kotlin/g1401_1500/s1488_avoid_flood_in_the_city/Solution.kt)| Medium | Array, Hash_Table, Greedy, Binary_Search, Heap_Priority_Queue | 823 | 66.67
+
+#### Day 19
+
+| | | | | |
+|-|-|-|-|-|-
+| 1562 |[Find Latest Group of Size M](src/main/kotlin/g1501_1600/s1562_find_latest_group_of_size_m/Solution.kt)| Medium | Array, Binary_Search, Simulation | 534 | 100.00
+| 1648 |[Sell Diminishing-Valued Colored Balls](src/main/kotlin/g1601_1700/s1648_sell_diminishing_valued_colored_balls/Solution.kt)| Medium | Array, Math, Sorting, Greedy, Binary_Search, Heap_Priority_Queue | 509 | 100.00
+
+#### Day 20
+
+| | | | | |
+|-|-|-|-|-|-
+| 1201 |[Ugly Number III](src/main/kotlin/g1201_1300/s1201_ugly_number_iii/Solution.kt)| Medium | Math, Binary_Search, Number_Theory | 136 | 100.00
+| 0911 |[Online Election](src/main/kotlin/g0901_1000/s0911_online_election/TopVotedCandidate.kt)| Medium | Array, Hash_Table, Binary_Search, Design | 766 | 83.33
## Contributing
Your ideas/fixes/algorithms are more than welcome!
diff --git a/build.gradle.kts b/build.gradle.kts
index f550695f3..a68a64467 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,8 +1,8 @@
plugins {
- kotlin("jvm") version "1.8.22"
+ kotlin("jvm") version "2.1.21"
jacoco
- id("org.sonarqube") version "4.2.0.3129"
- id("com.diffplug.spotless") version "6.12.0"
+ id("org.sonarqube") version "5.1.0.4882"
+ id("com.diffplug.spotless") version "6.25.0"
`maven-publish`
}
@@ -14,11 +14,11 @@ repositories {
}
dependencies {
- implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.21")
- testImplementation("org.junit.jupiter:junit-jupiter-api:[5.9.3,)")
- testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:[5.9.3,)")
- testImplementation("org.hamcrest:hamcrest-core:[2.2,)")
- testImplementation("org.zapodot:embedded-db-junit-jupiter:[2.1.1,)")
+ implementation("org.jetbrains.kotlin:kotlin-stdlib:2.1.21")
+ testImplementation("org.junit.jupiter:junit-jupiter:[5.13.0,)")
+ testImplementation("org.hamcrest:hamcrest-core:[3.0,)")
+ testImplementation("org.zapodot:embedded-db-junit-jupiter:2.2.2")
+ testRuntimeOnly("org.junit.platform:junit-platform-launcher:[1.13.0,)")
}
tasks.test {
@@ -27,13 +27,15 @@ tasks.test {
}
group = "com.github.javadev"
-version = "1.14-SNAPSHOT"
+version = "1.37-SNAPSHOT"
description = "leetcode-in-kotlin"
-java.sourceCompatibility = JavaVersion.VERSION_11
-java.targetCompatibility = JavaVersion.VERSION_11
+java.sourceCompatibility = JavaVersion.VERSION_17
+java.targetCompatibility = JavaVersion.VERSION_17
tasks.withType {
- kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
+ compilerOptions {
+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
+ }
}
publishing {
@@ -50,9 +52,14 @@ spotless {
kotlin {
encoding("UTF-8")
target("**/src/**/*.kt")
- ktlint("0.43.0").userData(mapOf(
- "max_line_length" to "120"
- ))
+ ktlint("0.50.0").editorConfigOverride(
+ mapOf(
+ "max_line_length" to "120",
+ "indent_size" to "4",
+ "ktlint_standard_package-name" to "disabled",
+ "ktlint_standard_comment-wrapping" to "disabled"
+ )
+ )
toggleOffOn()
trimTrailingWhitespace()
endWithNewline()
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index ccebba771..1b33c55ba 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index bdc9a83b1..ff23a68d7 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 79a61d421..23d15a936 100644
--- a/gradlew
+++ b/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -133,10 +133,13 @@ location of your Java installation."
fi
else
JAVACMD=java
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,16 +200,20 @@ if "$cygwin" || "$msys" ; then
done
fi
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
- org.gradle.wrapper.GradleWrapperMain \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
diff --git a/gradlew.bat b/gradlew.bat
index 93e3f59f1..db3a6ac20 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
@@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+set CLASSPATH=
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/pom-central.xml b/pom-central.xml
index 0967db1f2..8cb6098d5 100644
--- a/pom-central.xml
+++ b/pom-central.xml
@@ -4,9 +4,9 @@
com.github.javadev
leetcode-in-kotlin
jar
- 1.14
+ 1.37
leetcode-in-kotlin
- Kotlin Solution for LeetCode algorithm problems, continually updating
+ Kotlin-based LeetCode algorithm problem solutions, regularly updated
https://github.com/javadev/LeetCode-in-Kotlin
@@ -27,7 +27,7 @@
https://github.com/javadev/LeetCode-in-Kotlin
- 1.8.22
+ 2.1.21
UTF-8
@@ -47,7 +47,7 @@
kotlin-maven-plugin
${kotlin.version}
- 11
+ 17
@@ -69,12 +69,12 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.0.0
+ 3.2.5
org.junit.jupiter
junit-jupiter-engine
- [5.9.3,)
+ [5.13.0,)
@@ -95,7 +95,7 @@
org.apache.maven.plugins
maven-source-plugin
- 3.2.0
+ 3.3.1
attach-sources
@@ -109,7 +109,7 @@
org.jetbrains.dokka
dokka-maven-plugin
- 1.8.10
+ 2.0.0
prepare-package
@@ -120,11 +120,14 @@
+
+ 17
+
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.2.7
sign-artifacts
@@ -146,19 +149,31 @@
org.junit.jupiter
junit-jupiter-api
- [5.9.3,)
+ [5.13.0,)
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ [5.13.0,)
+ test
+
+
+ org.junit.platform
+ junit-platform-launcher
+ [1.13.0,)
test
org.hamcrest
hamcrest-core
- [2.2,)
+ [3.0,)
test
org.zapodot
embedded-db-junit-jupiter
- [2.1.1,)
+ 2.2.2
test
diff --git a/pom.xml b/pom.xml
index 59cbbda61..d671812d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,9 +4,9 @@
com.github.javadev
leetcode-in-kotlin
jar
- 1.14-SNAPSHOT
+ 1.37-SNAPSHOT
leetcode-in-kotlin
- Kotlin Solution for LeetCode algorithm problems, continually updating
+ Kotlin-based LeetCode algorithm problem solutions, regularly updated
https://github.com/javadev/LeetCode-in-Kotlin
@@ -26,7 +26,7 @@
https://github.com/javadev/LeetCode-in-Kotlin
- 1.8.22
+ 2.1.21
UTF-8
@@ -46,7 +46,7 @@
kotlin-maven-plugin
${kotlin.version}
- 11
+ 17
@@ -68,12 +68,12 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.0.0
+ 3.5.3
org.junit.jupiter
junit-jupiter-engine
- [5.9.3,)
+ [5.13.0,)
@@ -87,7 +87,7 @@
org.apache.maven.plugins
maven-source-plugin
- 3.2.0
+ 3.3.1
attach-sources
@@ -101,7 +101,7 @@
org.jetbrains.dokka
dokka-maven-plugin
- 1.8.10
+ 2.0.0
prepare-package
@@ -116,7 +116,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.2.7
sign-artifacts
@@ -140,19 +140,31 @@
org.junit.jupiter
junit-jupiter-api
- [5.9.3,)
+ [5.13.0,)
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ [5.13.0,)
+ test
+
+
+ org.junit.platform
+ junit-platform-launcher
+ [1.13.0,)
test
org.hamcrest
hamcrest-core
- [2.2,)
+ [3.0,)
test
org.zapodot
embedded-db-junit-jupiter
- [2.1.1,)
+ 2.2.2
test
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 31add6fa5..e8c055b36 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,5 +1 @@
-/*
- * This file was generated by the Gradle 'init' task.
- */
-
-rootProject.name = "leetcode-in-kotlin"
+rootProject.name = "LeetCode-in-Kotlin"
diff --git a/src/main/kotlin/com_github_leetcode/Employee.kt b/src/main/kotlin/com_github_leetcode/Employee.kt
index 9ca82053d..78f7d309e 100644
--- a/src/main/kotlin/com_github_leetcode/Employee.kt
+++ b/src/main/kotlin/com_github_leetcode/Employee.kt
@@ -6,5 +6,5 @@ class Employee(
/** the importance value of this employee */
var importance: Int,
/** the id of direct subordinates */
- var subordinates: List = listOf()
+ var subordinates: List = listOf(),
)
diff --git a/src/main/kotlin/com_github_leetcode/Node.kt b/src/main/kotlin/com_github_leetcode/Node.kt
index 4d435c9b3..f65b9473f 100644
--- a/src/main/kotlin/com_github_leetcode/Node.kt
+++ b/src/main/kotlin/com_github_leetcode/Node.kt
@@ -1,8 +1,5 @@
package com_github_leetcode
-import java.util.StringJoiner
-import kotlin.collections.ArrayList
-
class Node {
var `val`: Int
var neighbors: List
@@ -23,18 +20,14 @@ class Node {
}
override fun toString(): String {
- val result = StringJoiner(",", "[", "]")
- for (node in neighbors) {
+ return neighbors.joinToString(separator = ",", prefix = "[", postfix = "]") { node ->
if (node.neighbors.isEmpty()) {
- result.add(node.`val`.toString())
+ node.`val`.toString()
} else {
- val result2 = StringJoiner(",", "[", "]")
- for (nodeItem in node.neighbors) {
- result2.add(nodeItem.`val`.toString())
+ node.neighbors.joinToString(separator = ",", prefix = "[", postfix = "]") { nodeItem ->
+ nodeItem.`val`.toString()
}
- result.add(result2.toString())
}
}
- return result.toString()
}
}
diff --git a/src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt b/src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt
index adc2b5de7..bd87acd71 100644
--- a/src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt
@@ -1,8 +1,9 @@
package g0001_0100.s0001_two_sum
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table
-// #Data_Structure_I_Day_2_Array #Level_1_Day_13_Hashmap #Udemy_Arrays
-// #2022_07_14_Time_234_ms_(92.75%)_Space_37.5_MB_(93.77%)
+// #Data_Structure_I_Day_2_Array #Level_1_Day_13_Hashmap #Udemy_Arrays #Top_Interview_150_Hashmap
+// #Big_O_Time_O(n)_Space_O(n) #AI_can_be_used_to_solve_the_task
+// #2023_07_03_Time_202_ms_(91.18%)_Space_38.1_MB_(76.07%)
class Solution {
fun twoSum(numbers: IntArray, target: Int): IntArray {
diff --git a/src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt b/src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt
index f98d3e206..ad1ca0c51 100644
--- a/src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0002_add_two_numbers/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0002_add_two_numbers
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Math #Linked_List #Recursion
// #Data_Structure_II_Day_10_Linked_List #Programming_Skills_II_Day_15
-// #2022_09_22_Time_417_ms_(50.44%)_Space_50.5_MB_(35.36%)
+// #Top_Interview_150_Linked_List #Big_O_Time_O(max(N,M))_Space_O(max(N,M))
+// #AI_can_be_used_to_solve_the_task #2023_07_03_Time_203_ms_(96.13%)_Space_41_MB_(77.03%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt b/src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt
index 421a8c24b..e84071a46 100644
--- a/src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0003_longest_substring_without_repeating_characters/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0003_longest_substring_without_repeating_characters
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #String #Hash_Table #Sliding_Window
// #Algorithm_I_Day_6_Sliding_Window #Level_2_Day_14_Sliding_Window/Two_Pointer #Udemy_Strings
-// #2022_09_22_Time_258_ms_(91.09%)_Space_36.5_MB_(93.39%)
+// #Top_Interview_150_Sliding_Window #Big_O_Time_O(n)_Space_O(1) #AI_can_be_used_to_solve_the_task
+// #2023_07_03_Time_201_ms_(87.28%)_Space_38.3_MB_(60.85%)
class Solution {
fun lengthOfLongestSubstring(s: String): Int {
diff --git a/src/main/kotlin/g0001_0100/s0004_median_of_two_sorted_arrays/Solution.kt b/src/main/kotlin/g0001_0100/s0004_median_of_two_sorted_arrays/Solution.kt
index 7f9c1755e..06d87954e 100644
--- a/src/main/kotlin/g0001_0100/s0004_median_of_two_sorted_arrays/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0004_median_of_two_sorted_arrays/Solution.kt
@@ -1,9 +1,8 @@
package g0001_0100.s0004_median_of_two_sorted_arrays
// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Array #Binary_Search #Divide_and_Conquer
-// #2022_09_22_Time_355_ms_(83.48%)_Space_47.3_MB_(87.89%)
-
-import kotlin.collections.ArrayList
+// #Top_Interview_150_Binary_Search #Big_O_Time_O(log(min(N,M)))_Space_O(1)
+// #AI_can_be_used_to_solve_the_task #2023_07_03_Time_293_ms_(75.96%)_Space_47.5_MB_(64.85%)
class Solution {
fun findMedianSortedArrays(nums1: IntArray, nums2: IntArray): Double {
diff --git a/src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt b/src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt
index cba766a8b..76a5fc17b 100644
--- a/src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0005_longest_palindromic_substring/Solution.kt
@@ -2,8 +2,8 @@ package g0001_0100.s0005_longest_palindromic_substring
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #String #Dynamic_Programming
// #Data_Structure_II_Day_9_String #Algorithm_II_Day_14_Dynamic_Programming
-// #Dynamic_Programming_I_Day_17 #Udemy_Strings
-// #2022_09_22_Time_323_ms_(75.48%)_Space_37.1_MB_(69.96%)
+// #Dynamic_Programming_I_Day_17 #Udemy_Strings #Top_Interview_150_Multidimensional_DP
+// #Big_O_Time_O(n)_Space_O(n) #2023_07_03_Time_162_ms_(99.00%)_Space_36.6_MB_(79.10%)
class Solution {
fun longestPalindrome(s: String): String {
@@ -19,10 +19,14 @@ class Solution {
var lpsCenter = 0
var lpsRadius = 0
for (i in newStr.indices) {
- dp[i] = if (friendCenter + friendRadius > i) Math.min(
- dp[friendCenter * 2 - i],
- friendCenter + friendRadius - i
- ) else 1
+ dp[i] = if (friendCenter + friendRadius > i) {
+ Math.min(
+ dp[friendCenter * 2 - i],
+ friendCenter + friendRadius - i,
+ )
+ } else {
+ 1
+ }
while (i + dp[i] < newStr.size && i - dp[i] >= 0 && newStr[i + dp[i]] == newStr[i - dp[i]]) {
dp[i]++
}
diff --git a/src/main/kotlin/g0001_0100/s0006_zigzag_conversion/Solution.kt b/src/main/kotlin/g0001_0100/s0006_zigzag_conversion/Solution.kt
index d68ffa9ae..3e080d105 100644
--- a/src/main/kotlin/g0001_0100/s0006_zigzag_conversion/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0006_zigzag_conversion/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0006_zigzag_conversion
-// #Medium #String #2022_09_22_Time_366_ms_(80.62%)_Space_41.6_MB_(75.43%)
+// #Medium #String #Top_Interview_150_Array/String
+// #2023_07_03_Time_200_ms_(97.79%)_Space_37.3_MB_(91.71%)
class Solution {
fun convert(s: String, numRows: Int): String {
diff --git a/src/main/kotlin/g0001_0100/s0007_reverse_integer/Solution.kt b/src/main/kotlin/g0001_0100/s0007_reverse_integer/Solution.kt
index 2ef16c9f4..db2801859 100644
--- a/src/main/kotlin/g0001_0100/s0007_reverse_integer/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0007_reverse_integer/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0007_reverse_integer
// #Medium #Top_Interview_Questions #Math #Udemy_Integers
-// #2022_09_22_Time_245_ms_(60.32%)_Space_34.1_MB_(63.10%)
+// #2023_07_03_Time_149_ms_(77.89%)_Space_33.5_MB_(84.42%)
class Solution {
fun reverse(x: Int): Int {
diff --git a/src/main/kotlin/g0001_0100/s0008_string_to_integer_atoi/Solution.kt b/src/main/kotlin/g0001_0100/s0008_string_to_integer_atoi/Solution.kt
index f142d3a6a..9cf2d12f0 100644
--- a/src/main/kotlin/g0001_0100/s0008_string_to_integer_atoi/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0008_string_to_integer_atoi/Solution.kt
@@ -1,10 +1,10 @@
package g0001_0100.s0008_string_to_integer_atoi
-// #Medium #Top_Interview_Questions #String #2022_09_22_Time_196_ms_(96.46%)_Space_35.3_MB_(96.02%)
+// #Medium #Top_Interview_Questions #String #2023_07_03_Time_172_ms_(82.90%)_Space_34.9_MB_(88.08%)
class Solution {
- fun myAtoi(str: String?): Int {
- if (str.isNullOrEmpty()) {
+ fun myAtoi(str: String): Int {
+ if (str.isEmpty()) {
return 0
}
var i = 0
diff --git a/src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt b/src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt
index 4420a461c..ed6f39feb 100644
--- a/src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0009_palindrome_number
-// #Easy #Math #Udemy_Integers #2022_09_22_Time_238_ms_(96.24%)_Space_35_MB_(98.02%)
+// #Easy #Math #Udemy_Integers #Top_Interview_150_Math
+// #2023_07_03_Time_217_ms_(95.34%)_Space_36.1_MB_(98.21%)
class Solution {
fun isPalindrome(x: Int): Boolean {
diff --git a/src/main/kotlin/g0001_0100/s0010_regular_expression_matching/Solution.kt b/src/main/kotlin/g0001_0100/s0010_regular_expression_matching/Solution.kt
index 9116789c1..549989034 100644
--- a/src/main/kotlin/g0001_0100/s0010_regular_expression_matching/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0010_regular_expression_matching/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0010_regular_expression_matching
-// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #String #Dynamic_Programming #Recursion
-// #Udemy_Dynamic_Programming #2022_09_22_Time_292_ms_(58.58%)_Space_35.6_MB_(69.23%)
+// #Hard #Top_Interview_Questions #String #Dynamic_Programming #Recursion #Udemy_Dynamic_Programming
+// #Big_O_Time_O(m*n)_Space_O(m*n) #2023_07_03_Time_171_ms_(85.26%)_Space_34.6_MB_(94.74%)
class Solution {
fun isMatch(s: String, p: String): Boolean {
@@ -31,7 +31,7 @@ class Solution {
i,
j - 2,
s,
- p
+ p,
)
}
} else {
diff --git a/src/main/kotlin/g0001_0100/s0011_container_with_most_water/Solution.kt b/src/main/kotlin/g0001_0100/s0011_container_with_most_water/Solution.kt
index f1fa1b435..b74ba246b 100644
--- a/src/main/kotlin/g0001_0100/s0011_container_with_most_water/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0011_container_with_most_water/Solution.kt
@@ -1,7 +1,8 @@
package g0001_0100.s0011_container_with_most_water
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Greedy #Two_Pointers
-// #Algorithm_II_Day_4_Two_Pointers #2022_09_22_Time_474_ms_(89.18%)_Space_49.8_MB_(97.58%)
+// #LeetCode_75_Two_Pointers #Algorithm_II_Day_4_Two_Pointers #Top_Interview_150_Two_Pointers
+// #Big_O_Time_O(n)_Space_O(1) #2023_07_03_Time_402_ms_(78.57%)_Space_52.1_MB_(77.51%)
class Solution {
fun maxArea(height: IntArray): Int {
diff --git a/src/main/kotlin/g0001_0100/s0012_integer_to_roman/Solution.kt b/src/main/kotlin/g0001_0100/s0012_integer_to_roman/Solution.kt
index 35841c2a1..3cc002a26 100644
--- a/src/main/kotlin/g0001_0100/s0012_integer_to_roman/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0012_integer_to_roman/Solution.kt
@@ -1,9 +1,10 @@
package g0001_0100.s0012_integer_to_roman
-// #Medium #String #Hash_Table #Math #2022_10_06_Time_223_ms_(93.87%)_Space_36.3_MB_(93.07%)
+// #Medium #String #Hash_Table #Math #Top_Interview_150_Array/String
+// #2023_07_03_Time_180_ms_(98.25%)_Space_37_MB_(82.89%)
class Solution {
- fun intToRoman(num: Int): String? {
+ fun intToRoman(num: Int): String {
var localNum = num
val sb = StringBuilder()
val m = 1000
diff --git a/src/main/kotlin/g0001_0100/s0013_roman_to_integer/Solution.kt b/src/main/kotlin/g0001_0100/s0013_roman_to_integer/Solution.kt
index b799720c9..219674349 100644
--- a/src/main/kotlin/g0001_0100/s0013_roman_to_integer/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0013_roman_to_integer/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0013_roman_to_integer
-// #Easy #Top_Interview_Questions #String #Hash_Table #Math
-// #2022_10_06_Time_358_ms_(75.16%)_Space_38.4_MB_(83.72%)
+// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #String #Hash_Table #Math
+// #Top_Interview_150_Array/String #2023_07_03_Time_211_ms_(83.47%)_Space_36.9_MB_(91.66%)
class Solution {
fun romanToInt(s: String): Int {
diff --git a/src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt b/src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt
index 3f2a29363..cd9e6866d 100644
--- a/src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt
@@ -1,7 +1,8 @@
package g0001_0100.s0014_longest_common_prefix
-// #Easy #Top_Interview_Questions #String #Level_2_Day_2_String #Udemy_Strings
-// #2022_10_06_Time_209_ms_(88.86%)_Space_35.8_MB_(81.15%)
+// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #String #Level_2_Day_2_String
+// #Udemy_Strings #Top_Interview_150_Array/String
+// #2023_07_03_Time_154_ms_(89.70%)_Space_34.6_MB_(95.06%)
class Solution {
fun longestCommonPrefix(strs: Array): String {
diff --git a/src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt b/src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt
index d53b23d65..5c512be6e 100644
--- a/src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt
@@ -2,9 +2,8 @@ package g0001_0100.s0015_3sum
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Sorting #Two_Pointers
// #Data_Structure_II_Day_1_Array #Algorithm_II_Day_3_Two_Pointers #Udemy_Two_Pointers
-// #2022_10_06_Time_761_ms_(90.55%)_Space_77.7_MB_(83.71%)
-
-import kotlin.collections.ArrayList
+// #Top_Interview_150_Two_Pointers #Big_O_Time_O(n*log(n))_Space_O(n^2)
+// #2023_07_03_Time_493_ms_(93.45%)_Space_53_MB_(93.97%)
class Solution {
fun threeSum(nums: IntArray): List> {
diff --git a/src/main/kotlin/g0001_0100/s0016_3sum_closest/Solution.kt b/src/main/kotlin/g0001_0100/s0016_3sum_closest/Solution.kt
index f21350d4b..abfab5021 100644
--- a/src/main/kotlin/g0001_0100/s0016_3sum_closest/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0016_3sum_closest/Solution.kt
@@ -1,11 +1,11 @@
package g0001_0100.s0016_3sum_closest
// #Medium #Array #Sorting #Two_Pointers #Level_2_Day_14_Sliding_Window/Two_Pointer
-// #2022_10_06_Time_413_ms_(95.05%)_Space_45.8_MB_(90.11%)
+// #2023_07_03_Time_163_ms_(100.00%)_Space_37.5_MB_(92.24%)
class Solution {
- fun threeSumClosest(nums: IntArray?, target: Int): Int {
- if (nums == null || nums.size < 3) {
+ fun threeSumClosest(nums: IntArray, target: Int): Int {
+ if (nums.size < 3) {
return 0
}
if (nums.size == 3) {
diff --git a/src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt b/src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt
index 012db903f..ac397e83e 100644
--- a/src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0017_letter_combinations_of_a_phone_number/Solution.kt
@@ -1,8 +1,9 @@
package g0001_0100.s0017_letter_combinations_of_a_phone_number
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #String #Hash_Table #Backtracking
-// #Algorithm_II_Day_11_Recursion_Backtracking #Udemy_Backtracking/Recursion
-// #2022_10_06_Time_262_ms_(73.59%)_Space_35.7_MB_(90.50%)
+// #LeetCode_75_Backtracking #Algorithm_II_Day_11_Recursion_Backtracking
+// #Udemy_Backtracking/Recursion #Top_Interview_150_Backtracking #Big_O_Time_O(4^n)_Space_O(n)
+// #2023_07_03_Time_155_ms_(95.24%)_Space_34.9_MB_(96.34%)
class Solution {
fun letterCombinations(digits: String): List {
@@ -19,7 +20,7 @@ class Solution {
nums: String,
letters: Array,
curr: StringBuilder,
- ans: MutableList
+ ans: MutableList,
) {
if (curr.length == nums.length) {
ans.add(curr.toString())
diff --git a/src/main/kotlin/g0001_0100/s0018_4sum/Solution.kt b/src/main/kotlin/g0001_0100/s0018_4sum/Solution.kt
index ea2148495..7d48aa1d1 100644
--- a/src/main/kotlin/g0001_0100/s0018_4sum/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0018_4sum/Solution.kt
@@ -1,6 +1,6 @@
package g0001_0100.s0018_4sum
-// #Medium #Array #Sorting #Two_Pointers #2023_02_27_Time_221_ms_(100.00%)_Space_36.8_MB_(100.00%)
+// #Medium #Array #Sorting #Two_Pointers #2023_07_03_Time_229_ms_(98.59%)_Space_37.8_MB_(100.00%)
class Solution {
fun fourSum(nums: IntArray, target: Int): List> {
diff --git a/src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt b/src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt
index 9e874d214..3fd5e91c4 100644
--- a/src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0019_remove_nth_node_from_end_of_list/Solution.kt
@@ -1,8 +1,8 @@
package g0001_0100.s0019_remove_nth_node_from_end_of_list
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Two_Pointers #Linked_List
-// #Algorithm_I_Day_5_Two_Pointers #Level_2_Day_3_Linked_List
-// #2022_10_06_Time_180_ms_(91.58%)_Space_34.9_MB_(69.39%)
+// #Algorithm_I_Day_5_Two_Pointers #Level_2_Day_3_Linked_List #Top_Interview_150_Linked_List
+// #Big_O_Time_O(L)_Space_O(L) #2023_07_03_Time_144_ms_(96.28%)_Space_34.5_MB_(76.50%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt b/src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt
index 0c9d76229..9f18f40bf 100644
--- a/src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt
@@ -1,24 +1,22 @@
package g0001_0100.s0020_valid_parentheses
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #String #Stack
-// #Data_Structure_I_Day_9_Stack_Queue #Udemy_Strings
-// #2022_10_06_Time_226_ms_(72.53%)_Space_34.1_MB_(76.91%)
-
-import java.util.Stack
+// #Data_Structure_I_Day_9_Stack_Queue #Udemy_Strings #Top_Interview_150_Stack
+// #Big_O_Time_O(n)_Space_O(n) #2023_07_03_Time_137_ms_(88.76%)_Space_33.7_MB_(90.45%)
class Solution {
fun isValid(s: String): Boolean {
- val stack = Stack()
+ val stack = ArrayDeque()
for (element in s) {
val c = element
if (c == '(' || c == '[' || c == '{') {
- stack.push(c)
- } else if (c == ')' && stack.isNotEmpty() && stack.peek() == '(') {
- stack.pop()
- } else if (c == '}' && stack.isNotEmpty() && stack.peek() == '{') {
- stack.pop()
- } else if (c == ']' && stack.isNotEmpty() && stack.peek() == '[') {
- stack.pop()
+ stack.addLast(c)
+ } else if (c == ')' && stack.isNotEmpty() && stack.last() == '(') {
+ stack.removeLast()
+ } else if (c == '}' && stack.isNotEmpty() && stack.last() == '{') {
+ stack.removeLast()
+ } else if (c == ']' && stack.isNotEmpty() && stack.last() == '[') {
+ stack.removeLast()
} else {
return false
}
diff --git a/src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt b/src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt
index 64c91d5f9..fabd6adb2 100644
--- a/src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt
@@ -2,8 +2,8 @@ package g0001_0100.s0021_merge_two_sorted_lists
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Linked_List #Recursion
// #Data_Structure_I_Day_7_Linked_List #Algorithm_I_Day_10_Recursion_Backtracking
-// #Level_1_Day_3_Linked_List #Udemy_Linked_List
-// #2022_10_06_Time_176_ms_(96.25%)_Space_35.2_MB_(89.94%)
+// #Level_1_Day_3_Linked_List #Udemy_Linked_List #Top_Interview_150_Linked_List
+// #Big_O_Time_O(m+n)_Space_O(m+n) #2023_07_03_Time_157_ms_(92.24%)_Space_35.7_MB_(68.58%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt b/src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt
index 0e6662123..4fd66a6c4 100644
--- a/src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0022_generate_parentheses/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0022_generate_parentheses
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #String #Dynamic_Programming
// #Backtracking #Algorithm_II_Day_11_Recursion_Backtracking #Udemy_Backtracking/Recursion
-// #2022_03_29_Time_210_ms_(78.51%)_Space_37.3_MB_(76.72%)
+// #Top_Interview_150_Backtracking #Big_O_Time_O(2^n)_Space_O(n)
+// #2023_07_03_Time_161_ms_(85.45%)_Space_37.3_MB_(66.18%)
class Solution {
fun generateParenthesis(n: Int): List {
diff --git a/src/main/kotlin/g0001_0100/s0023_merge_k_sorted_lists/Solution.kt b/src/main/kotlin/g0001_0100/s0023_merge_k_sorted_lists/Solution.kt
index ff652f111..8a4f5af0f 100644
--- a/src/main/kotlin/g0001_0100/s0023_merge_k_sorted_lists/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0023_merge_k_sorted_lists/Solution.kt
@@ -1,7 +1,9 @@
package g0001_0100.s0023_merge_k_sorted_lists
// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Heap_Priority_Queue #Linked_List
-// #Divide_and_Conquer #Merge_Sort #2022_03_29_Time_323_ms_(75.14%)_Space_43.3_MB_(68.27%)
+// #Divide_and_Conquer #Merge_Sort #Top_Interview_150_Divide_and_Conquer
+// #Big_O_Time_O(k*n*log(k))_Space_O(log(k))
+// #2023_07_03_Time_198_ms_(93.77%)_Space_37.6_MB_(97.03%)
import com_github_leetcode.ListNode
@@ -18,7 +20,9 @@ class Solution {
fun mergeKLists(lists: Array): ListNode? {
return if (lists.isEmpty()) {
null
- } else mergeKLists(lists, 0, lists.size)
+ } else {
+ mergeKLists(lists, 0, lists.size)
+ }
}
private fun mergeKLists(lists: Array, leftIndex: Int, rightIndex: Int): ListNode? {
diff --git a/src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt b/src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt
index 80f8eab52..b69c90ebe 100644
--- a/src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt
@@ -1,7 +1,8 @@
package g0001_0100.s0024_swap_nodes_in_pairs
// #Medium #Top_100_Liked_Questions #Linked_List #Recursion #Data_Structure_II_Day_12_Linked_List
-// #Udemy_Linked_List #2022_09_21_Time_149_ms_(99.39%)_Space_33.7_MB_(98.77%)
+// #Udemy_Linked_List #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_03_Time_149_ms_(44.20%)_Space_33.5_MB_(98.90%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt b/src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt
index 6f0bc8d5d..ffa64b8e5 100644
--- a/src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/Solution.kt
@@ -1,7 +1,8 @@
package g0001_0100.s0025_reverse_nodes_in_k_group
// #Hard #Top_100_Liked_Questions #Linked_List #Recursion #Data_Structure_II_Day_13_Linked_List
-// #Udemy_Linked_List #2022_04_26_Time_194_ms_(87.72%)_Space_35.7_MB_(100.00%)
+// #Udemy_Linked_List #Top_Interview_150_Linked_List #Big_O_Time_O(n)_Space_O(k)
+// #2023_07_03_Time_189_ms_(67.03%)_Space_36.7_MB_(71.43%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0026_remove_duplicates_from_sorted_array/Solution.kt b/src/main/kotlin/g0001_0100/s0026_remove_duplicates_from_sorted_array/Solution.kt
index 5d359846b..d3bd0a346 100644
--- a/src/main/kotlin/g0001_0100/s0026_remove_duplicates_from_sorted_array/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0026_remove_duplicates_from_sorted_array/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0026_remove_duplicates_from_sorted_array
// #Easy #Top_Interview_Questions #Array #Two_Pointers #Udemy_Two_Pointers
-// #2022_03_29_Time_361_ms_(77.19%)_Space_47.7_MB_(25.17%)
+// #Top_Interview_150_Array/String #2023_07_03_Time_249_ms_(67.38%)_Space_42_MB_(57.99%)
class Solution {
fun removeDuplicates(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0001_0100/s0027_remove_element/Solution.kt b/src/main/kotlin/g0001_0100/s0027_remove_element/Solution.kt
index e7dd67a77..e0e574f15 100644
--- a/src/main/kotlin/g0001_0100/s0027_remove_element/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0027_remove_element/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0027_remove_element
-// #Easy #Array #Two_Pointers #2022_09_18_Time_293_ms_(32.19%)_Space_35.7_MB_(26.76%)
+// #Easy #Array #Two_Pointers #Top_Interview_150_Array/String
+// #2023_07_03_Time_162_ms_(76.44%)_Space_34.8_MB_(70.69%)
class Solution {
fun removeElement(nums: IntArray, `val`: Int): Int {
diff --git a/src/main/kotlin/g0001_0100/s0028_implement_strstr/Solution.kt b/src/main/kotlin/g0001_0100/s0028_find_the_index_of_the_first_occurrence_in_a_string/Solution.kt
similarity index 69%
rename from src/main/kotlin/g0001_0100/s0028_implement_strstr/Solution.kt
rename to src/main/kotlin/g0001_0100/s0028_find_the_index_of_the_first_occurrence_in_a_string/Solution.kt
index 62d5324f5..24b77726f 100644
--- a/src/main/kotlin/g0001_0100/s0028_implement_strstr/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0028_find_the_index_of_the_first_occurrence_in_a_string/Solution.kt
@@ -1,7 +1,8 @@
-package g0001_0100.s0028_implement_strstr
+package g0001_0100.s0028_find_the_index_of_the_first_occurrence_in_a_string
// #Easy #Top_Interview_Questions #String #Two_Pointers #String_Matching
-// #Programming_Skills_II_Day_1 #2022_09_18_Time_257_ms_(32.35%)_Space_34.5_MB_(60.63%)
+// #Programming_Skills_II_Day_1 #Top_Interview_150_Array/String
+// #2023_07_03_Time_126_ms_(97.58%)_Space_34.2_MB_(76.09%)
class Solution {
fun strStr(haystack: String, needle: String): Int {
diff --git a/src/main/kotlin/g0001_0100/s0028_implement_strstr/readme.md b/src/main/kotlin/g0001_0100/s0028_find_the_index_of_the_first_occurrence_in_a_string/readme.md
similarity index 100%
rename from src/main/kotlin/g0001_0100/s0028_implement_strstr/readme.md
rename to src/main/kotlin/g0001_0100/s0028_find_the_index_of_the_first_occurrence_in_a_string/readme.md
diff --git a/src/main/kotlin/g0001_0100/s0029_divide_two_integers/Solution.kt b/src/main/kotlin/g0001_0100/s0029_divide_two_integers/Solution.kt
index a5bfcbfd7..f0508922b 100644
--- a/src/main/kotlin/g0001_0100/s0029_divide_two_integers/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0029_divide_two_integers/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0029_divide_two_integers
// #Medium #Top_Interview_Questions #Math #Bit_Manipulation #Udemy_Bit_Manipulation
-// #2022_09_18_Time_281_ms_(31.67%)_Space_34.5_MB_(28.33%)
+// #2023_07_03_Time_144_ms_(82.50%)_Space_33.4_MB_(100.00%)
@Suppress("INTEGER_OVERFLOW")
class Solution {
diff --git a/src/main/kotlin/g0001_0100/s0030_substring_with_concatenation_of_all_words/Solution.kt b/src/main/kotlin/g0001_0100/s0030_substring_with_concatenation_of_all_words/Solution.kt
index e370902bf..b32dcb62c 100644
--- a/src/main/kotlin/g0001_0100/s0030_substring_with_concatenation_of_all_words/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0030_substring_with_concatenation_of_all_words/Solution.kt
@@ -1,47 +1,44 @@
package g0001_0100.s0030_substring_with_concatenation_of_all_words
-// #Hard #String #Hash_Table #Sliding_Window #2022_09_18_Time_441_ms_(85.84%)_Space_42.9_MB_(88.25%)
+// #Hard #String #Hash_Table #Sliding_Window #Top_Interview_150_Sliding_Window
+// #2025_03_04_Time_14_ms_(98.62%)_Space_39.70_MB_(91.72%)
class Solution {
fun findSubstring(s: String, words: Array): List {
- val indices: MutableList = ArrayList()
- if (words.size == 0) {
- return indices
+ val ans: MutableList = ArrayList()
+ val n1 = words[0].length
+ val n2 = s.length
+ val map1: MutableMap = HashMap()
+ for (ch in words) {
+ map1.put(ch, map1.getOrDefault(ch, 0) + 1)
}
- // Put each word into a HashMap and calculate word frequency
- val wordMap: MutableMap = HashMap()
- for (word in words) {
- wordMap[word] = wordMap.getOrDefault(word, 0) + 1
- }
- val wordLength = words[0].length
- val window = words.size * wordLength
- for (i in 0 until wordLength) {
- // move a word's length each time
+ for (i in 0.. = HashMap()
- // start from the last word
- for (k in words.indices.reversed()) {
- // get the word from subStr
- val word = subStr.substring(k * wordLength, (k + 1) * wordLength)
- val count = map.getOrDefault(word, 0) + 1
- // if the num of the word is greater than wordMap's, move (k * wordLength) and
- // break
- if (count > wordMap.getOrDefault(word, 0)) {
- j = j + k * wordLength
- break
- } else if (k == 0) {
- indices.add(j)
- } else {
- map[word] = count
+ var c = 0
+ val map2: MutableMap = HashMap()
+ while (j + n1 <= n2) {
+ val word1 = s.substring(j, j + n1)
+ j += n1
+ if (map1.containsKey(word1)) {
+ map2.put(word1, map2.getOrDefault(word1, 0) + 1)
+ c++
+ while (map2[word1]!! > map1[word1]!!) {
+ val word2 = s.substring(left, left + n1)
+ map2.put(word2, map2[word2]!! - 1)
+ left += n1
+ c--
+ }
+ if (c == words.size) {
+ ans.add(left)
}
+ } else {
+ map2.clear()
+ c = 0
+ left = j
}
- j = j + wordLength
}
}
- return indices
+ return ans
}
}
diff --git a/src/main/kotlin/g0001_0100/s0031_next_permutation/Solution.kt b/src/main/kotlin/g0001_0100/s0031_next_permutation/Solution.kt
index a8017b040..b5e47243b 100644
--- a/src/main/kotlin/g0001_0100/s0031_next_permutation/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0031_next_permutation/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0031_next_permutation
-// #Medium #Top_100_Liked_Questions #Array #Two_Pointers
-// #2022_09_18_Time_211_ms_(94.23%)_Space_35.9_MB_(92.31%)
+// #Medium #Top_100_Liked_Questions #Array #Two_Pointers #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_05_Time_205_ms_(48.21%)_Space_36.6_MB_(87.50%)
class Solution {
fun nextPermutation(nums: IntArray) {
@@ -12,7 +12,8 @@ class Solution {
while (j >= i + 1 && nums[i] >= nums[j]) { j-- }
nums[i] = nums[j].also { nums[j] = nums[i] }
}
- var l = i + 1; var r = nums.size - 1
+ var l = i + 1
+ var r = nums.size - 1
while (l < r) {
nums[l] = nums[r].also { nums[r] = nums[l] }
l++
diff --git a/src/main/kotlin/g0001_0100/s0032_longest_valid_parentheses/Solution.kt b/src/main/kotlin/g0001_0100/s0032_longest_valid_parentheses/Solution.kt
index d3371a07a..acab96e3a 100644
--- a/src/main/kotlin/g0001_0100/s0032_longest_valid_parentheses/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0032_longest_valid_parentheses/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0032_longest_valid_parentheses
-// #Hard #Top_100_Liked_Questions #String #Dynamic_Programming #Stack
-// #2022_09_16_Time_215_ms_(95.71%)_Space_35.1_MB_(100.00%)
+// #Hard #Top_100_Liked_Questions #String #Dynamic_Programming #Stack #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_05_Time_161_ms_(82.14%)_Space_36.3_MB_(91.07%)
class Solution {
fun longestValidParentheses(s: String): Int {
diff --git a/src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt b/src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt
index fd3043818..af4bc0dc5 100644
--- a/src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0033_search_in_rotated_sorted_array/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0033_search_in_rotated_sorted_array
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Binary_Search
// #Algorithm_II_Day_1_Binary_Search #Binary_Search_I_Day_11 #Level_2_Day_8_Binary_Search
-// #Udemy_Binary_Search #2022_03_29_Time_184_ms_(86.08%)_Space_37.2_MB_(36.66%)
+// #Udemy_Binary_Search #Top_Interview_150_Binary_Search #Big_O_Time_O(log_n)_Space_O(1)
+// #2023_07_05_Time_151_ms_(93.77%)_Space_34.5_MB_(94.08%)
class Solution {
fun search(nums: IntArray, target: Int): Int {
diff --git a/src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt b/src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt
index f1640e6a2..decc1deec 100644
--- a/src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/Solution.kt
@@ -1,10 +1,10 @@
package g0001_0100.s0034_find_first_and_last_position_of_element_in_sorted_array
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Binary_Search
-// #Algorithm_II_Day_1_Binary_Search #Binary_Search_I_Day_5
-// #2022_04_30_Time_228_ms_(83.38%)_Space_39.6_MB_(85.97%)
+// #Algorithm_II_Day_1_Binary_Search #Binary_Search_I_Day_5 #Top_Interview_150_Binary_Search
+// #Big_O_Time_O(log_n)_Space_O(1) #2023_07_05_Time_174_ms_(100.00%)_Space_37.8_MB_(71.70%)
-class Solution constructor() {
+class Solution {
fun searchRange(nums: IntArray, target: Int): IntArray {
val ans = IntArray(2)
ans[0] = helper(nums, target, false)
diff --git a/src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt b/src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt
index b82065ec4..f12fd25ca 100644
--- a/src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt
@@ -1,7 +1,8 @@
package g0001_0100.s0035_search_insert_position
// #Easy #Top_100_Liked_Questions #Array #Binary_Search #Algorithm_I_Day_1_Binary_Search
-// #Binary_Search_I_Day_2 #2022_04_30_Time_267_ms_(50.32%)_Space_39.5_MB_(33.93%)
+// #Binary_Search_I_Day_2 #Top_Interview_150_Binary_Search #Big_O_Time_O(log_n)_Space_O(1)
+// #2023_07_05_Time_159_ms_(93.03%)_Space_36.7_MB_(95.90%)
class Solution {
fun searchInsert(nums: IntArray, target: Int): Int {
diff --git a/src/main/kotlin/g0001_0100/s0036_valid_sudoku/Solution.kt b/src/main/kotlin/g0001_0100/s0036_valid_sudoku/Solution.kt
index 21bd37832..58586328a 100644
--- a/src/main/kotlin/g0001_0100/s0036_valid_sudoku/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0036_valid_sudoku/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0036_valid_sudoku
// #Medium #Top_Interview_Questions #Array #Hash_Table #Matrix #Data_Structure_I_Day_5_Array
-// #2022_09_18_Time_346_ms_(65.03%)_Space_45_MB_(70.91%)
+// #Top_Interview_150_Matrix #2023_07_05_Time_181_ms_(95.15%)_Space_40_MB_(62.78%)
class Solution {
private var j1 = 0
diff --git a/src/main/kotlin/g0001_0100/s0037_sudoku_solver/Solution.kt b/src/main/kotlin/g0001_0100/s0037_sudoku_solver/Solution.kt
index f65b1c22a..8002240f0 100644
--- a/src/main/kotlin/g0001_0100/s0037_sudoku_solver/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0037_sudoku_solver/Solution.kt
@@ -1,6 +1,6 @@
package g0001_0100.s0037_sudoku_solver
-// #Hard #Array #Matrix #Backtracking #2022_09_18_Time_294_ms_(79.69%)_Space_34.8_MB_(93.75%)
+// #Hard #Array #Matrix #Backtracking #2023_07_05_Time_148_ms_(100.00%)_Space_34.3_MB_(96.30%)
class Solution {
private val emptyCells: MutableList = ArrayList()
diff --git a/src/main/kotlin/g0001_0100/s0038_count_and_say/Solution.kt b/src/main/kotlin/g0001_0100/s0038_count_and_say/Solution.kt
index 20a9cb697..4980da06b 100644
--- a/src/main/kotlin/g0001_0100/s0038_count_and_say/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0038_count_and_say/Solution.kt
@@ -1,6 +1,6 @@
package g0001_0100.s0038_count_and_say
-// #Medium #Top_Interview_Questions #String #2022_09_18_Time_317_ms_(41.11%)_Space_35.3_MB_(85.56%)
+// #Medium #Top_Interview_Questions #String #2023_07_05_Time_135_ms_(100.00%)_Space_34.4_MB_(98.31%)
class Solution {
fun countAndSay(n: Int): String {
diff --git a/src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt b/src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt
index 29b21d12c..5b965710e 100644
--- a/src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0039_combination_sum
// #Medium #Top_100_Liked_Questions #Array #Backtracking #Algorithm_II_Day_10_Recursion_Backtracking
// #Level_2_Day_20_Brute_Force/Backtracking #Udemy_Backtracking/Recursion
-// #2022_08_27_Time_317_ms_(86.85%)_Space_45.1_MB_(63.75%)
+// #Top_Interview_150_Backtracking #Big_O_Time_O(2^n)_Space_O(n+2^n)
+// #2023_07_05_Time_226_ms_(88.89%)_Space_38.1_MB_(94.95%)
class Solution {
fun combinationSum(candidates: IntArray, target: Int): List> {
diff --git a/src/main/kotlin/g0001_0100/s0040_combination_sum_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0040_combination_sum_ii/Solution.kt
index fe796b5a8..0c80480b9 100644
--- a/src/main/kotlin/g0001_0100/s0040_combination_sum_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0040_combination_sum_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0040_combination_sum_ii
// #Medium #Array #Backtracking #Algorithm_II_Day_10_Recursion_Backtracking
-// #2022_09_18_Time_348_ms_(80.92%)_Space_38_MB_(96.18%)
+// #2023_07_05_Time_217_ms_(93.75%)_Space_38_MB_(89.06%)
import java.util.LinkedList
@@ -19,7 +19,7 @@ class Solution {
target: Int,
start: Int,
sums: MutableList>,
- sum: LinkedList
+ sum: LinkedList,
) {
if (target == 0) {
// make a deep copy of the current combination
@@ -28,7 +28,6 @@ class Solution {
}
var i = start
while (i < candidates.size && target >= candidates[i]) {
-
// If candidate[i] equals candidate[i-1], then solutions for i is subset of
// solution of i-1
if (i == start || i > start && candidates[i] != candidates[i - 1]) {
diff --git a/src/main/kotlin/g0001_0100/s0041_first_missing_positive/Solution.kt b/src/main/kotlin/g0001_0100/s0041_first_missing_positive/Solution.kt
index f0ba295e9..8ba63243a 100644
--- a/src/main/kotlin/g0001_0100/s0041_first_missing_positive/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0041_first_missing_positive/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0041_first_missing_positive
// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Udemy_Arrays
-// #2022_08_27_Time_345_ms_(100.00%)_Space_47.3_MB_(100.00%)
+// #Big_O_Time_O(n)_Space_O(n) #2023_07_05_Time_357_ms_(97.17%)_Space_50.7_MB_(90.57%)
class Solution {
fun firstMissingPositive(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt b/src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt
index 38e47292b..b0ef88fbf 100644
--- a/src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0042_trapping_rain_water/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0042_trapping_rain_water
// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming #Two_Pointers
// #Stack #Monotonic_Stack #Dynamic_Programming_I_Day_9 #Udemy_Two_Pointers
-// #2022_08_27_Time_196_ms_(100.00%)_Space_36.9_MB_(98.52%)
+// #Top_Interview_150_Array/String #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_05_Time_189_ms_(99.37%)_Space_39.4_MB_(81.90%)
class Solution {
fun trap(height: IntArray): Int {
diff --git a/src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt b/src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt
index 150b65e64..0cef8b5c9 100644
--- a/src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0043_multiply_strings
// #Medium #String #Math #Simulation #Data_Structure_II_Day_8_String #Programming_Skills_II_Day_4
-// #Level_2_Day_2_String #2022_09_18_Time_390_ms_(56.25%)_Space_36.1_MB_(85.42%)
+// #Level_2_Day_2_String #2023_07_05_Time_165_ms_(96.72%)_Space_36.1_MB_(67.21%)
class Solution {
private fun getIntArray(s: String): IntArray {
diff --git a/src/main/kotlin/g0001_0100/s0044_wildcard_matching/Solution.kt b/src/main/kotlin/g0001_0100/s0044_wildcard_matching/Solution.kt
index be98f1894..ab41ccd99 100644
--- a/src/main/kotlin/g0001_0100/s0044_wildcard_matching/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0044_wildcard_matching/Solution.kt
@@ -1,21 +1,21 @@
package g0001_0100.s0044_wildcard_matching
// #Hard #Top_Interview_Questions #String #Dynamic_Programming #Greedy #Recursion
-// #Udemy_Dynamic_Programming #2022_09_18_Time_401_ms_(86.11%)_Space_40.1_MB_(91.67%)
+// #Udemy_Dynamic_Programming #2023_07_05_Time_220_ms_(84.85%)_Space_37.8_MB_(90.91%)
class Solution {
- fun isMatch(inputString: String, pattern: String): Boolean {
+ fun isMatch(s: String, p: String): Boolean {
var i = 0
var j = 0
var starIdx = -1
var lastMatch = -1
- while (i < inputString.length) {
- if (j < pattern.length &&
- (inputString[i] == pattern[j] || pattern[j] == '?')
+ while (i < s.length) {
+ if (j < p.length &&
+ (s[i] == p[j] || p[j] == '?')
) {
i++
j++
- } else if (j < pattern.length && pattern[j] == '*') {
+ } else if (j < p.length && p[j] == '*') {
starIdx = j
lastMatch = i
j++
@@ -34,10 +34,10 @@ class Solution {
}
}
var isMatch = true
- while (j < pattern.length && pattern[j] == '*') {
+ while (j < p.length && p[j] == '*') {
j++
}
- if (i != inputString.length || j != pattern.length) {
+ if (i != s.length || j != p.length) {
isMatch = false
}
return isMatch
diff --git a/src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt
index 9bd22e9ea..4433fd06f 100644
--- a/src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0045_jump_game_ii
// #Medium #Top_100_Liked_Questions #Array #Dynamic_Programming #Greedy
// #Algorithm_II_Day_13_Dynamic_Programming #Dynamic_Programming_I_Day_4
-// #2022_08_29_Time_227_ms_(98.14%)_Space_37.3_MB_(100.00%)
+// #Top_Interview_150_Array/String #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_05_Time_208_ms_(93.37%)_Space_38.2_MB_(94.48%)
class Solution {
fun jump(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt b/src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt
index e97926e4d..cc5ec1780 100644
--- a/src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0046_permutations
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Backtracking
// #Algorithm_I_Day_11_Recursion_Backtracking #Level_2_Day_20_Brute_Force/Backtracking
-// #Udemy_Backtracking/Recursion #2022_08_29_Time_186_ms_(100.00%)_Space_36.9_MB_(98.90%)
+// #Udemy_Backtracking/Recursion #Top_Interview_150_Backtracking #Big_O_Time_O(n*n!)_Space_O(n+n!)
+// #2023_07_05_Time_188_ms_(99.00%)_Space_37.4_MB_(88.94%)
class Solution {
fun permute(nums: IntArray): List> {
@@ -18,7 +19,7 @@ class Solution {
nums: IntArray,
finalResult: MutableList>,
currResult: MutableList,
- used: BooleanArray
+ used: BooleanArray,
) {
if (currResult.size == nums.size) {
finalResult.add(ArrayList(currResult))
diff --git a/src/main/kotlin/g0001_0100/s0047_permutations_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0047_permutations_ii/Solution.kt
index 1e13a926a..c571f5ad2 100644
--- a/src/main/kotlin/g0001_0100/s0047_permutations_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0047_permutations_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0047_permutations_ii
// #Medium #Array #Backtracking #Algorithm_II_Day_10_Recursion_Backtracking
-// #2022_09_18_Time_406_ms_(76.36%)_Space_47.2_MB_(80.00%)
+// #2023_07_05_Time_199_ms_(100.00%)_Space_39.1_MB_(92.98%)
class Solution {
private var ans: MutableList>? = null
diff --git a/src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt b/src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt
index c1da2e692..f1187f18e 100644
--- a/src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0048_rotate_image
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Math #Matrix
// #Data_Structure_II_Day_3_Array #Programming_Skills_II_Day_7 #Udemy_2D_Arrays/Matrix
-// #2022_08_29_Time_287_ms_(46.50%)_Space_35.9_MB_(45.39%)
+// #Top_Interview_150_Matrix #Big_O_Time_O(n^2)_Space_O(1)
+// #2023_07_05_Time_160_ms_(90.11%)_Space_35_MB_(84.07%)
class Solution {
fun rotate(matrix: Array) {
@@ -13,7 +14,7 @@ class Solution {
intArrayOf(i, j),
intArrayOf(j, n - 1 - i),
intArrayOf(n - 1 - i, n - 1 - j),
- intArrayOf(n - 1 - j, i)
+ intArrayOf(n - 1 - j, i),
)
var t = matrix[pos[0][0]][pos[0][1]]
for (k in 1 until pos.size) {
diff --git a/src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt b/src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt
index 686aa6df5..32d69d57a 100644
--- a/src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0049_group_anagrams/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0049_group_anagrams
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #String #Hash_Table #Sorting
// #Data_Structure_II_Day_8_String #Programming_Skills_II_Day_11 #Udemy_Strings
-// #2022_08_29_Time_506_ms_(86.55%)_Space_72.5_MB_(81.04%)
+// #Top_Interview_150_Hashmap #Big_O_Time_O(n*k_log_k)_Space_O(n)
+// #2023_07_05_Time_308_ms_(96.34%)_Space_43.3_MB_(81.41%)
class Solution {
fun groupAnagrams(strs: Array): List> {
@@ -12,7 +13,7 @@ class Solution {
ch.sort()
val temp = String(ch)
hm.computeIfAbsent(
- temp
+ temp,
) { _: String? -> ArrayList() }
hm.getValue(temp).add(s)
}
diff --git a/src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt b/src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt
index 0414dc417..3429435d7 100644
--- a/src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0050_powx_n
-// #Medium #Top_Interview_Questions #Math #Recursion #Udemy_Integers
-// #2022_09_27_Time_264_ms_(52.98%)_Space_34.9_MB_(76.82%)
+// #Medium #Top_Interview_Questions #Math #Recursion #Udemy_Integers #Top_Interview_150_Math
+// #2023_07_05_Time_172_ms_(38.68%)_Space_34.8_MB_(66.04%)
@Suppress("NAME_SHADOWING")
class Solution {
@@ -23,6 +23,8 @@ class Solution {
}
return if (n < 0) {
1.0 / res
- } else res
+ } else {
+ res
+ }
}
}
diff --git a/src/main/kotlin/g0001_0100/s0051_n_queens/Solution.kt b/src/main/kotlin/g0001_0100/s0051_n_queens/Solution.kt
index d546af4c7..fe0e69edf 100644
--- a/src/main/kotlin/g0001_0100/s0051_n_queens/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0051_n_queens/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0051_n_queens
-// #Hard #Top_100_Liked_Questions #Array #Backtracking
-// #2022_08_29_Time_243_ms_(95.10%)_Space_39.7_MB_(91.18%)
+// #Hard #Top_100_Liked_Questions #Array #Backtracking #Big_O_Time_O(N!)_Space_O(N)
+// #2023_07_10_Time_192_ms_(90.74%)_Space_37.8_MB_(88.89%)
class Solution {
fun solveNQueens(n: Int): List> {
diff --git a/src/main/kotlin/g0001_0100/s0052_n_queens_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0052_n_queens_ii/Solution.kt
index 084b776db..3123c54e4 100644
--- a/src/main/kotlin/g0001_0100/s0052_n_queens_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0052_n_queens_ii/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0052_n_queens_ii
-// #Hard #Backtracking #2022_09_21_Time_231_ms_(80.00%)_Space_33.7_MB_(94.29%)
+// #Hard #Backtracking #Top_Interview_150_Backtracking
+// #2023_07_10_Time_128_ms_(97.56%)_Space_32.7_MB_(92.68%)
class Solution {
fun totalNQueens(n: Int): Int {
@@ -17,7 +18,7 @@ class Solution {
row: BooleanArray,
col: BooleanArray,
diagonal: BooleanArray,
- antiDiagonal: BooleanArray
+ antiDiagonal: BooleanArray,
): Int {
if (r == n) {
return 1
diff --git a/src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt b/src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt
index db1007419..723acc76f 100644
--- a/src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0053_maximum_subarray/Solution.kt
@@ -1,8 +1,9 @@
package g0001_0100.s0053_maximum_subarray
-// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
+// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
// #Divide_and_Conquer #Data_Structure_I_Day_1_Array #Dynamic_Programming_I_Day_5
-// #Udemy_Famous_Algorithm #2022_08_29_Time_662_ms_(82.48%)_Space_97.8_MB_(24.28%)
+// #Udemy_Famous_Algorithm #Top_Interview_150_Kadane's_Algorithm #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_10_Time_510_ms_(78.81%)_Space_54.7_MB_(69.00%)
class Solution {
fun maxSubArray(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt b/src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt
index 4a4a337a3..fbcc051a9 100644
--- a/src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt
@@ -1,8 +1,8 @@
package g0001_0100.s0054_spiral_matrix
-// #Medium #Top_Interview_Questions #Array #Matrix #Simulation #Programming_Skills_II_Day_8
-// #Level_2_Day_1_Implementation/Simulation #Udemy_2D_Arrays/Matrix
-// #2022_08_29_Time_224_ms_(62.50%)_Space_34.4_MB_(63.36%)
+// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Matrix #Simulation
+// #Programming_Skills_II_Day_8 #Level_2_Day_1_Implementation/Simulation #Udemy_2D_Arrays/Matrix
+// #Top_Interview_150_Matrix #2023_07_10_Time_132_ms_(95.12%)_Space_33.5_MB_(93.17%)
class Solution {
fun spiralOrder(matrix: Array): List {
diff --git a/src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt b/src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt
index 5a032ef16..a8d4981fa 100644
--- a/src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0055_jump_game/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0055_jump_game
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming #Greedy
// #Algorithm_II_Day_12_Dynamic_Programming #Dynamic_Programming_I_Day_4 #Udemy_Arrays
-// #2022_08_29_Time_670_ms_(66.67%)_Space_71.2_MB_(44.45%)
+// #Top_Interview_150_Array/String #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_10_Time_332_ms_(89.35%)_Space_39_MB_(96.44%)
class Solution {
fun canJump(nums: IntArray): Boolean {
diff --git a/src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt b/src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt
index a4e61678b..ccc311017 100644
--- a/src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0056_merge_intervals/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0056_merge_intervals
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Sorting
// #Data_Structure_II_Day_2_Array #Level_2_Day_17_Interval #Udemy_2D_Arrays/Matrix
-// #2023_02_27_Time_320_ms_(94.22%)_Space_44.4_MB_(72.95%)
+// #Top_Interview_150_Intervals #Big_O_Time_O(n_log_n)_Space_O(n)
+// #2023_07_10_Time_334_ms_(80.67%)_Space_43.7_MB_(78.81%)
class Solution {
fun merge(intervals: Array): Array {
diff --git a/src/main/kotlin/g0001_0100/s0057_insert_interval/Solution.kt b/src/main/kotlin/g0001_0100/s0057_insert_interval/Solution.kt
index b5c5fd9b8..6635f97ad 100644
--- a/src/main/kotlin/g0001_0100/s0057_insert_interval/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0057_insert_interval/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0057_insert_interval
-// #Medium #Array #Level_2_Day_17_Interval #2022_09_21_Time_257_ms_(99.52%)_Space_37.1_MB_(99.52%)
+// #Medium #Array #Level_2_Day_17_Interval #Top_Interview_150_Intervals
+// #2023_07_10_Time_249_ms_(75.63%)_Space_40.4_MB_(60.87%)
class Solution {
fun insert(intervals: Array, newInterval: IntArray): Array {
diff --git a/src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt b/src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt
index b720487db..8718b418a 100644
--- a/src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt
@@ -1,13 +1,13 @@
package g0001_0100.s0058_length_of_last_word
-// #Easy #String #Programming_Skills_II_Day_6 #Udemy_Arrays
-// #2022_09_21_Time_243_ms_(63.33%)_Space_35.7_MB_(73.11%)
+// #Easy #String #Programming_Skills_II_Day_6 #Udemy_Arrays #Top_Interview_150_Array/String
+// #2023_07_10_Time_135_ms_(93.67%)_Space_34.3_MB_(94.69%)
class Solution {
- fun lengthOfLastWord(str: String): Int {
+ fun lengthOfLastWord(s: String): Int {
var len = 0
- for (i in str.length - 1 downTo 0) {
- val ch = str[i]
+ for (i in s.length - 1 downTo 0) {
+ val ch = s[i]
if (ch == ' ' && len > 0) {
break
} else if (ch != ' ') {
diff --git a/src/main/kotlin/g0001_0100/s0059_spiral_matrix_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0059_spiral_matrix_ii/Solution.kt
index 36d1c9d67..0cd1a7864 100644
--- a/src/main/kotlin/g0001_0100/s0059_spiral_matrix_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0059_spiral_matrix_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0059_spiral_matrix_ii
// #Medium #Array #Matrix #Simulation #Data_Structure_II_Day_3_Array
-// #2022_09_27_Time_153_ms_(100.00%)_Space_34_MB_(98.15%)
+// #2023_07_10_Time_153_ms_(41.70%)_Space_34.2_MB_(89.36%)
class Solution {
fun generateMatrix(n: Int): Array {
diff --git a/src/main/kotlin/g0001_0100/s0060_permutation_sequence/Solution.kt b/src/main/kotlin/g0001_0100/s0060_permutation_sequence/Solution.kt
index 22594cc0d..1166eaf87 100644
--- a/src/main/kotlin/g0001_0100/s0060_permutation_sequence/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0060_permutation_sequence/Solution.kt
@@ -1,6 +1,6 @@
package g0001_0100.s0060_permutation_sequence
-// #Hard #Math #Recursion #2022_11_25_Time_146_ms_(100.00%)_Space_33.7_MB_(95.45%)
+// #Hard #Math #Recursion #2023_07_10_Time_132_ms_(100.00%)_Space_33.2_MB_(96.43%)
@Suppress("NAME_SHADOWING")
class Solution {
diff --git a/src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt b/src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt
index c9af06076..ddd1f97f1 100644
--- a/src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0061_rotate_list
// #Medium #Two_Pointers #Linked_List #Programming_Skills_II_Day_16 #Udemy_Linked_List
-// #2022_09_27_Time_193_ms_(92.16%)_Space_35.3_MB_(91.18%)
+// #Top_Interview_150_Linked_List #2023_07_10_Time_160_ms_(92.22%)_Space_36.2_MB_(63.33%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt b/src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt
index eafe10d15..c8b298141 100644
--- a/src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0062_unique_paths/Solution.kt
@@ -1,8 +1,9 @@
package g0001_0100.s0062_unique_paths
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Dynamic_Programming #Math
-// #Combinatorics #Algorithm_II_Day_13_Dynamic_Programming #Dynamic_Programming_I_Day_15
-// #Level_1_Day_11_Dynamic_Programming #2022_08_30_Time_209_ms_(49.18%)_Space_33.5_MB_(60.44%)
+// #Combinatorics #LeetCode_75_DP/Multidimensional #Algorithm_II_Day_13_Dynamic_Programming
+// #Dynamic_Programming_I_Day_15 #Level_1_Day_11_Dynamic_Programming
+// #Big_O_Time_O(m*n)_Space_O(m*n) #2023_07_10_Time_118_ms_(94.65%)_Space_33_MB_(81.62%)
class Solution {
fun uniquePaths(m: Int, n: Int): Int {
diff --git a/src/main/kotlin/g0001_0100/s0063_unique_paths_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0063_unique_paths_ii/Solution.kt
index 9b86658ee..dace610be 100644
--- a/src/main/kotlin/g0001_0100/s0063_unique_paths_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0063_unique_paths_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0063_unique_paths_ii
// #Medium #Array #Dynamic_Programming #Matrix #Dynamic_Programming_I_Day_15
-// #2022_09_22_Time_187_ms_(84.62%)_Space_43.5_MB_(6.15%)
+// #Top_Interview_150_Multidimensional_DP #2023_07_10_Time_151_ms_(81.94%)_Space_34.3_MB_(94.44%)
class Solution {
fun uniquePathsWithObstacles(obstacleGrid: Array): Int {
diff --git a/src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt b/src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt
index 220c5c5f6..f04282731 100644
--- a/src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt
@@ -1,8 +1,8 @@
package g0001_0100.s0064_minimum_path_sum
// #Medium #Top_100_Liked_Questions #Array #Dynamic_Programming #Matrix
-// #Dynamic_Programming_I_Day_16 #Udemy_Dynamic_Programming
-// #2022_08_30_Time_222_ms_(95.70%)_Space_38_MB_(98.92%)
+// #Dynamic_Programming_I_Day_16 #Udemy_Dynamic_Programming #Top_Interview_150_Multidimensional_DP
+// #Big_O_Time_O(m*n)_Space_O(m*n) #2023_07_10_Time_164_ms_(100.00%)_Space_37.3_MB_(84.71%)
class Solution {
fun minPathSum(grid: Array): Int {
diff --git a/src/main/kotlin/g0001_0100/s0065_valid_number/Solution.kt b/src/main/kotlin/g0001_0100/s0065_valid_number/Solution.kt
index eb0b5424d..1f4bf577e 100644
--- a/src/main/kotlin/g0001_0100/s0065_valid_number/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0065_valid_number/Solution.kt
@@ -1,6 +1,6 @@
package g0001_0100.s0065_valid_number
-// #Hard #String #2022_09_23_Time_310_ms_(81.82%)_Space_35.5_MB_(87.88%)
+// #Hard #String #2023_07_10_Time_151_ms_(100.00%)_Space_34.7_MB_(88.89%)
class Solution {
fun isNumber(s: String): Boolean {
diff --git a/src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt b/src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt
index 0da7f002f..07c4a8873 100644
--- a/src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0066_plus_one
// #Easy #Top_Interview_Questions #Array #Math #Programming_Skills_II_Day_3 #Udemy_Arrays
-// #2022_09_23_Time_303_ms_(35.18%)_Space_35.1_MB_(80.78%)
+// #Top_Interview_150_Math #2023_07_10_Time_148_ms_(98.75%)_Space_34.6_MB_(81.44%)
class Solution {
fun plusOne(digits: IntArray): IntArray {
diff --git a/src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt b/src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt
index ecb6ba132..95ef64af2 100644
--- a/src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0067_add_binary
// #Easy #String #Math #Bit_Manipulation #Simulation #Programming_Skills_II_Day_5
-// #2022_09_23_Time_327_ms_(32.67%)_Space_36_MB_(75.91%)
+// #Top_Interview_150_Bit_Manipulation #2023_07_10_Time_164_ms_(90.60%)_Space_34.4_MB_(99.25%)
class Solution {
fun addBinary(a: String, b: String): String {
diff --git a/src/main/kotlin/g0001_0100/s0068_text_justification/Solution.kt b/src/main/kotlin/g0001_0100/s0068_text_justification/Solution.kt
index 2386b1966..cc7b164c3 100644
--- a/src/main/kotlin/g0001_0100/s0068_text_justification/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0068_text_justification/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0068_text_justification
-// #Hard #Array #String #Simulation #2022_09_23_Time_269_ms_(50.00%)_Space_34.8_MB_(97.06%)
+// #Hard #Array #String #Simulation #Top_Interview_150_Array/String
+// #2023_07_10_Time_153_ms_(92.96%)_Space_34.1_MB_(100.00%)
class Solution {
fun fullJustify(words: Array, maxWidth: Int): List {
@@ -54,7 +55,7 @@ class Solution {
startWord = i + 1
// resetting these to 0 for processing next line
lineTotal = 0
- numWordsOnLine = lineTotal
+ numWordsOnLine = 0
// need a new StringBuilder for the next line
sb = StringBuilder(maxWidth)
}
diff --git a/src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt b/src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt
index ee6433bf8..373db1e3b 100644
--- a/src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0069_sqrtx
// #Easy #Top_Interview_Questions #Math #Binary_Search #Binary_Search_I_Day_4
-// #2022_09_24_Time_153_ms_(95.75%)_Space_33.2_MB_(99.35%)
+// #Top_Interview_150_Math #2023_07_10_Time_140_ms_(94.72%)_Space_33.5_MB_(66.67%)
class Solution {
fun mySqrt(x: Int): Int {
diff --git a/src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt b/src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt
index 4766c2f12..310fcdbfc 100644
--- a/src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0070_climbing_stairs/Solution.kt
@@ -2,8 +2,8 @@ package g0001_0100.s0070_climbing_stairs
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Dynamic_Programming #Math #Memoization
// #Algorithm_I_Day_12_Dynamic_Programming #Dynamic_Programming_I_Day_2
-// #Level_1_Day_10_Dynamic_Programming #Udemy_Dynamic_Programming
-// #2022_08_30_Time_127_ms_(97.06%)_Space_32.7_MB_(97.70%)
+// #Level_1_Day_10_Dynamic_Programming #Udemy_Dynamic_Programming #Top_Interview_150_1D_DP
+// #Big_O_Time_O(n)_Space_O(n) #2023_07_10_Time_124_ms_(71.98%)_Space_33.2_MB_(48.60%)
class Solution {
fun climbStairs(n: Int): Int {
diff --git a/src/main/kotlin/g0001_0100/s0071_simplify_path/Solution.kt b/src/main/kotlin/g0001_0100/s0071_simplify_path/Solution.kt
index 38e95a5dc..93a6c1b11 100644
--- a/src/main/kotlin/g0001_0100/s0071_simplify_path/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0071_simplify_path/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0071_simplify_path
-// #Medium #String #Stack #2022_09_24_Time_318_ms_(64.44%)_Space_37.8_MB_(77.78%)
+// #Medium #String #Stack #Top_Interview_150_Stack
+// #2023_07_10_Time_185_ms_(92.86%)_Space_36.3_MB_(100.00%)
import java.util.ArrayDeque
import java.util.Deque
diff --git a/src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt b/src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt
index 98f2006e4..c456d1a3d 100644
--- a/src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt
@@ -1,15 +1,16 @@
package g0001_0100.s0072_edit_distance
-// #Hard #Top_100_Liked_Questions #String #Dynamic_Programming
+// #Medium #Top_100_Liked_Questions #String #Dynamic_Programming #LeetCode_75_DP/Multidimensional
// #Algorithm_II_Day_18_Dynamic_Programming #Dynamic_Programming_I_Day_19
-// #Udemy_Dynamic_Programming #2022_08_30_Time_320_ms_(63.53%)_Space_37.2_MB_(83.53%)
+// #Udemy_Dynamic_Programming #Top_Interview_150_Multidimensional_DP #Big_O_Time_O(n^2)_Space_O(n2)
+// #2023_07_10_Time_182_ms_(92.16%)_Space_36.2_MB_(98.04%)
class Solution {
- fun minDistance(w1: String, w2: String): Int {
- val n1 = w1.length
- val n2 = w2.length
+ fun minDistance(word1: String, word2: String): Int {
+ val n1 = word1.length
+ val n2 = word2.length
if (n2 > n1) {
- return minDistance(w2, w1)
+ return minDistance(word2, word1)
}
val dp = IntArray(n2 + 1)
for (j in 0..n2) {
@@ -20,7 +21,7 @@ class Solution {
dp[0] = i
for (j in 1..n2) {
val tmp = dp[j]
- dp[j] = if (w1[i - 1] != w2[j - 1]) 1 + Math.min(pre, Math.min(dp[j], dp[j - 1])) else pre
+ dp[j] = if (word1[i - 1] != word2[j - 1]) 1 + Math.min(pre, Math.min(dp[j], dp[j - 1])) else pre
pre = tmp
}
}
diff --git a/src/main/kotlin/g0001_0100/s0073_set_matrix_zeroes/Solution.kt b/src/main/kotlin/g0001_0100/s0073_set_matrix_zeroes/Solution.kt
index fc5ae90fe..21f421c87 100644
--- a/src/main/kotlin/g0001_0100/s0073_set_matrix_zeroes/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0073_set_matrix_zeroes/Solution.kt
@@ -1,7 +1,8 @@
package g0001_0100.s0073_set_matrix_zeroes
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Matrix
-// #Udemy_2D_Arrays/Matrix #2022_08_31_Time_255_ms_(100.00%)_Space_45.7_MB_(91.72%)
+// #Udemy_2D_Arrays/Matrix #Top_Interview_150_Matrix #Big_O_Time_O(m*n)_Space_O(1)
+// #2023_07_10_Time_248_ms_(97.33%)_Space_41.6_MB_(79.87%)
class Solution {
// Approach: Use first row and first column for storing whether in future
diff --git a/src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt b/src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt
index 2fc23fc03..85dda955c 100644
--- a/src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0074_search_a_2d_matrix/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0074_search_a_2d_matrix
// #Medium #Top_100_Liked_Questions #Array #Binary_Search #Matrix #Data_Structure_I_Day_5_Array
// #Algorithm_II_Day_1_Binary_Search #Binary_Search_I_Day_8 #Level_2_Day_8_Binary_Search
-// #Udemy_2D_Arrays/Matrix #2022_08_31_Time_290_ms_(40.17%)_Space_35.4_MB_(96.48%)
+// #Udemy_2D_Arrays/Matrix #Top_Interview_150_Binary_Search #Big_O_Time_O(endRow+endCol)_Space_O(1)
+// #2023_07_10_Time_159_ms_(74.46%)_Space_35.1_MB_(74.89%)
class Solution {
fun searchMatrix(matrix: Array, target: Int): Boolean {
diff --git a/src/main/kotlin/g0001_0100/s0075_sort_colors/Solution.kt b/src/main/kotlin/g0001_0100/s0075_sort_colors/Solution.kt
index 7bd852a9f..6b465cf24 100644
--- a/src/main/kotlin/g0001_0100/s0075_sort_colors/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0075_sort_colors/Solution.kt
@@ -1,8 +1,8 @@
package g0001_0100.s0075_sort_colors
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Sorting #Two_Pointers
-// #Data_Structure_II_Day_2_Array #Udemy_Arrays
-// #2022_08_31_Time_198_ms_(85.66%)_Space_34.8_MB_(84.84%)
+// #Data_Structure_II_Day_2_Array #Udemy_Arrays #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_10_Time_164_ms_(64.43%)_Space_34.4_MB_(84.54%)
class Solution {
fun sortColors(nums: IntArray) {
diff --git a/src/main/kotlin/g0001_0100/s0076_minimum_window_substring/Solution.kt b/src/main/kotlin/g0001_0100/s0076_minimum_window_substring/Solution.kt
index 411fc8e1a..05f6e3c96 100644
--- a/src/main/kotlin/g0001_0100/s0076_minimum_window_substring/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0076_minimum_window_substring/Solution.kt
@@ -1,8 +1,8 @@
package g0001_0100.s0076_minimum_window_substring
// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #String #Hash_Table #Sliding_Window
-// #Level_2_Day_14_Sliding_Window/Two_Pointer
-// #2022_08_31_Time_346_ms_(85.20%)_Space_39.3_MB_(93.88%)
+// #Level_2_Day_14_Sliding_Window/Two_Pointer #Top_Interview_150_Sliding_Window
+// #Big_O_Time_O(s.length())_Space_O(1) #2023_07_10_Time_191_ms_(96.38%)_Space_37.2_MB_(93.33%)
class Solution {
fun minWindow(s: String, t: String): String {
diff --git a/src/main/kotlin/g0001_0100/s0077_combinations/Solution.kt b/src/main/kotlin/g0001_0100/s0077_combinations/Solution.kt
index dadd5272c..690ec7764 100644
--- a/src/main/kotlin/g0001_0100/s0077_combinations/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0077_combinations/Solution.kt
@@ -1,9 +1,7 @@
package g0001_0100.s0077_combinations
-// #Medium #Backtracking #Algorithm_I_Day_11_Recursion_Backtracking
-// #2022_09_24_Time_244_ms_(100.00%)_Space_40.5_MB_(99.00%)
-
-import java.util.Stack
+// #Medium #Backtracking #Algorithm_I_Day_11_Recursion_Backtracking #Top_Interview_150_Backtracking
+// #2023_07_10_Time_232_ms_(100.00%)_Space_41.1_MB_(95.65%)
class Solution {
fun combine(n: Int, k: Int): List> {
@@ -12,11 +10,11 @@ class Solution {
if (n > 20 || k < 1 || k > n) {
return ans
}
- backtrack(ans, n, k, 1, Stack())
+ backtrack(ans, n, k, 1, ArrayDeque())
return ans
}
- private fun backtrack(ans: MutableList>, n: Int, k: Int, s: Int, stack: Stack) {
+ private fun backtrack(ans: MutableList>, n: Int, k: Int, s: Int, stack: ArrayDeque) {
// Base case
// If k becomes 0
if (k == 0) {
@@ -25,10 +23,10 @@ class Solution {
}
// Start with s till n-k+1
for (i in s..n - k + 1) {
- stack.push(i)
+ stack.addLast(i)
// Update start for recursion and decrease k by 1
backtrack(ans, n, k - 1, i + 1, stack)
- stack.pop()
+ stack.removeLast()
}
}
}
diff --git a/src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt b/src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt
index 0b596e454..6205c8f87 100644
--- a/src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt
@@ -2,7 +2,7 @@ package g0001_0100.s0078_subsets
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Bit_Manipulation #Backtracking
// #Algorithm_II_Day_9_Recursion_Backtracking #Udemy_Backtracking/Recursion
-// #2022_11_25_Time_191_ms_(97.44%)_Space_36.1_MB_(96.15%)
+// #Big_O_Time_O(2^n)_Space_O(n*2^n) #2023_07_10_Time_171_ms_(94.92%)_Space_35.8_MB_(96.09%)
class Solution {
fun subsets(nums: IntArray): List> {
diff --git a/src/main/kotlin/g0001_0100/s0079_word_search/Solution.kt b/src/main/kotlin/g0001_0100/s0079_word_search/Solution.kt
index 0e3c9054c..3e65c1961 100644
--- a/src/main/kotlin/g0001_0100/s0079_word_search/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0079_word_search/Solution.kt
@@ -1,8 +1,8 @@
package g0001_0100.s0079_word_search
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Matrix #Backtracking
-// #Algorithm_II_Day_11_Recursion_Backtracking
-// #2022_09_01_Time_463_ms_(68.49%)_Space_34.9_MB_(81.09%)
+// #Algorithm_II_Day_11_Recursion_Backtracking #Top_Interview_150_Backtracking
+// #Big_O_Time_O(4^(m*n))_Space_O(m*n) #2023_07_10_Time_392_ms_(72.92%)_Space_34.7_MB_(83.33%)
class Solution {
private fun backtrace(
@@ -11,7 +11,7 @@ class Solution {
word: String,
index: Int,
x: Int,
- y: Int
+ y: Int,
): Boolean {
if (index == word.length) {
return true
@@ -40,7 +40,7 @@ class Solution {
fun exist(board: Array, word: String): Boolean {
val visited = Array(board.size) {
BooleanArray(
- board[0].size
+ board[0].size,
)
}
for (i in board.indices) {
diff --git a/src/main/kotlin/g0001_0100/s0080_remove_duplicates_from_sorted_array_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0080_remove_duplicates_from_sorted_array_ii/Solution.kt
index 1dc7e2d73..72f3ce63f 100644
--- a/src/main/kotlin/g0001_0100/s0080_remove_duplicates_from_sorted_array_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0080_remove_duplicates_from_sorted_array_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0080_remove_duplicates_from_sorted_array_ii
-// #Medium #Array #Two_Pointers #Udemy_Arrays
-// #2022_09_24_Time_357_ms_(44.78%)_Space_40.7_MB_(25.37%)
+// #Medium #Array #Two_Pointers #Udemy_Arrays #Top_Interview_150_Array/String
+// #2023_07_10_Time_192_ms_(80.67%)_Space_37.2_MB_(62.67%)
class Solution {
fun removeDuplicates(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0001_0100/s0081_search_in_rotated_sorted_array_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0081_search_in_rotated_sorted_array_ii/Solution.kt
index 2281e359a..28bd473aa 100644
--- a/src/main/kotlin/g0001_0100/s0081_search_in_rotated_sorted_array_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0081_search_in_rotated_sorted_array_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0081_search_in_rotated_sorted_array_ii
// #Medium #Array #Binary_Search #Binary_Search_II_Day_12
-// #2022_09_25_Time_352_ms_(42.31%)_Space_37.5_MB_(88.46%)
+// #2023_07_10_Time_170_ms_(96.30%)_Space_36.5_MB_(96.30%)
class Solution {
fun search(nums: IntArray, target: Int): Boolean {
diff --git a/src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt
index 5b3c63317..b09549669 100644
--- a/src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/Solution.kt
@@ -1,7 +1,8 @@
package g0001_0100.s0082_remove_duplicates_from_sorted_list_ii
// #Medium #Two_Pointers #Linked_List #Data_Structure_II_Day_11_Linked_List
-// #Algorithm_II_Day_3_Two_Pointers #2022_09_25_Time_241_ms_(91.04%)_Space_39.6_MB_(16.42%)
+// #Algorithm_II_Day_3_Two_Pointers #Top_Interview_150_Linked_List
+// #2023_07_10_Time_166_ms_(89.47%)_Space_36.8_MB_(63.16%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0083_remove_duplicates_from_sorted_list/Solution.kt b/src/main/kotlin/g0001_0100/s0083_remove_duplicates_from_sorted_list/Solution.kt
index 3ef13882f..77b415e63 100644
--- a/src/main/kotlin/g0001_0100/s0083_remove_duplicates_from_sorted_list/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0083_remove_duplicates_from_sorted_list/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0083_remove_duplicates_from_sorted_list
// #Easy #Linked_List #Data_Structure_I_Day_8_Linked_List
-// #2022_09_25_Time_274_ms_(77.82%)_Space_37.9_MB_(53.23%)
+// #2023_07_10_Time_173_ms_(82.42%)_Space_36.6_MB_(53.33%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0084_largest_rectangle_in_histogram/Solution.kt b/src/main/kotlin/g0001_0100/s0084_largest_rectangle_in_histogram/Solution.kt
index 5b0f41624..f30e5539c 100644
--- a/src/main/kotlin/g0001_0100/s0084_largest_rectangle_in_histogram/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0084_largest_rectangle_in_histogram/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0084_largest_rectangle_in_histogram
// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Array #Stack #Monotonic_Stack
-// #2022_09_01_Time_525_ms_(100.00%)_Space_50.7_MB_(98.51%)
+// #Big_O_Time_O(n_log_n)_Space_O(log_n) #2023_07_10_Time_476_ms_(90.79%)_Space_51.8_MB_(84.21%)
import kotlin.math.max
@@ -38,7 +38,7 @@ class Solution {
maxOfThreeNums(
largestArea(a, start, minInd),
a[minInd] * (limit - start),
- largestArea(a, minInd + 1, limit)
+ largestArea(a, minInd + 1, limit),
)
}
}
diff --git a/src/main/kotlin/g0001_0100/s0085_maximal_rectangle/Solution.kt b/src/main/kotlin/g0001_0100/s0085_maximal_rectangle/Solution.kt
index 5360b9b63..4c6a766cb 100644
--- a/src/main/kotlin/g0001_0100/s0085_maximal_rectangle/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0085_maximal_rectangle/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0085_maximal_rectangle
// #Hard #Array #Dynamic_Programming #Matrix #Stack #Monotonic_Stack
-// #2022_09_25_Time_463_ms_(55.17%)_Space_58.5_MB_(62.07%)
+// #2023_07_10_Time_209_ms_(100.00%)_Space_37.9_MB_(100.00%)
class Solution {
fun maximalRectangle(matrix: Array): Int {
diff --git a/src/main/kotlin/g0001_0100/s0086_partition_list/Solution.kt b/src/main/kotlin/g0001_0100/s0086_partition_list/Solution.kt
index 48094fec6..81147818d 100644
--- a/src/main/kotlin/g0001_0100/s0086_partition_list/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0086_partition_list/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0086_partition_list
-// #Medium #Two_Pointers #Linked_List #2022_09_27_Time_172_ms_(94.00%)_Space_35.1_MB_(76.00%)
+// #Medium #Two_Pointers #Linked_List #Top_Interview_150_Linked_List
+// #2023_07_10_Time_160_ms_(70.73%)_Space_35.1_MB_(46.34%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0087_scramble_string/Solution.kt b/src/main/kotlin/g0001_0100/s0087_scramble_string/Solution.kt
index f29bbd8da..602f8de60 100644
--- a/src/main/kotlin/g0001_0100/s0087_scramble_string/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0087_scramble_string/Solution.kt
@@ -1,6 +1,6 @@
package g0001_0100.s0087_scramble_string
-// #Hard #String #Dynamic_Programming #2022_09_25_Time_366_ms_(85.00%)_Space_36.2_MB_(100.00%)
+// #Hard #String #Dynamic_Programming #2023_07_10_Time_174_ms_(87.50%)_Space_36.5_MB_(50.00%)
class Solution {
fun isScramble(s1: String, s2: String): Boolean {
diff --git a/src/main/kotlin/g0001_0100/s0088_merge_sorted_array/Solution.kt b/src/main/kotlin/g0001_0100/s0088_merge_sorted_array/Solution.kt
index c205bde76..6d928639f 100644
--- a/src/main/kotlin/g0001_0100/s0088_merge_sorted_array/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0088_merge_sorted_array/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0088_merge_sorted_array
// #Easy #Top_Interview_Questions #Array #Sorting #Two_Pointers #Data_Structure_I_Day_2_Array
-// #2022_09_25_Time_311_ms_(33.40%)_Space_35.7_MB_(57.76%)
+// #Top_Interview_150_Array/String #2023_07_10_Time_170_ms_(69.74%)_Space_34.5_MB_(99.18%)
class Solution {
fun merge(nums1: IntArray, m: Int, nums2: IntArray, n: Int) {
diff --git a/src/main/kotlin/g0001_0100/s0089_gray_code/Solution.kt b/src/main/kotlin/g0001_0100/s0089_gray_code/Solution.kt
index 03c14711a..b038f7810 100644
--- a/src/main/kotlin/g0001_0100/s0089_gray_code/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0089_gray_code/Solution.kt
@@ -1,22 +1,22 @@
package g0001_0100.s0089_gray_code
// #Medium #Math #Bit_Manipulation #Backtracking
-// #2022_09_27_Time_273_ms_(100.00%)_Space_44.1_MB_(97.14%)
+// #2023_07_10_Time_271_ms_(69.23%)_Space_45.8_MB_(30.77%)
@Suppress("NAME_SHADOWING")
class Solution {
- fun grayCode(n: Int): List {
+ fun grayCode(n: Int): List {
var n = n
- var n1 = arrayOf(0)
+ var n1 = arrayOf(0)
var shift = 1
while (n > 0) {
- val temp = arrayOfNulls(n1.size * 2)
+ val temp = Array(n1.size * 2) { 0 }
var pos = 0
for (integer in n1) {
temp[pos++] = integer
}
for (i in n1.indices.reversed()) {
- temp[pos++] = n1[i]!! or shift
+ temp[pos++] = n1[i] or shift
}
n1 = temp
shift = shift shl 1
diff --git a/src/main/kotlin/g0001_0100/s0090_subsets_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0090_subsets_ii/Solution.kt
index a9d5950d2..2fee51465 100644
--- a/src/main/kotlin/g0001_0100/s0090_subsets_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0090_subsets_ii/Solution.kt
@@ -1,12 +1,13 @@
package g0001_0100.s0090_subsets_ii
// #Medium #Array #Bit_Manipulation #Backtracking #Algorithm_II_Day_9_Recursion_Backtracking
-// #2022_09_26_Time_366_ms_(58.09%)_Space_38.9_MB_(88.97%
+// #2023_07_10_Time_200_ms_(88.33%)_Space_38_MB_(85.00%)
class Solution {
- var allComb: MutableList> = ArrayList()
- var comb: MutableList = ArrayList()
- lateinit var nums: IntArray
+ private var allComb: MutableList> = ArrayList()
+ private var comb: MutableList = ArrayList()
+ private lateinit var nums: IntArray
+
fun subsetsWithDup(nums: IntArray): List> {
nums.sort()
this.nums = nums
diff --git a/src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt b/src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt
index 80fe898ae..383694cbf 100644
--- a/src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt
@@ -2,7 +2,7 @@ package g0001_0100.s0091_decode_ways
// #Medium #Top_Interview_Questions #String #Dynamic_Programming
// #Algorithm_II_Day_15_Dynamic_Programming #Dynamic_Programming_I_Day_10
-// #2022_09_27_Time_237_ms_(76.88%)_Space_34.5_MB_(86.88%)
+// #2023_07_10_Time_148_ms_(79.07%)_Space_34_MB_(82.56%)
class Solution {
fun numDecodings(s: String): Int {
diff --git a/src/main/kotlin/g0001_0100/s0092_reverse_linked_list_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0092_reverse_linked_list_ii/Solution.kt
index cd4b43cc5..e89522198 100644
--- a/src/main/kotlin/g0001_0100/s0092_reverse_linked_list_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0092_reverse_linked_list_ii/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0092_reverse_linked_list_ii
-// #Medium #Linked_List #2022_09_26_Time_191_ms_(82.35%)_Space_34.4_MB_(29.41%)
+// #Medium #Linked_List #Top_Interview_150_Linked_List
+// #2023_07_10_Time_144_ms_(75.00%)_Space_33.8_MB_(72.06%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0001_0100/s0093_restore_ip_addresses/Solution.kt b/src/main/kotlin/g0001_0100/s0093_restore_ip_addresses/Solution.kt
index 59b260bf4..c7f7ea1d3 100644
--- a/src/main/kotlin/g0001_0100/s0093_restore_ip_addresses/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0093_restore_ip_addresses/Solution.kt
@@ -1,6 +1,6 @@
package g0001_0100.s0093_restore_ip_addresses
-// #Medium #String #Backtracking #2022_09_26_Time_304_ms_(73.33%)_Space_35.8_MB_(93.33%)
+// #Medium #String #Backtracking #2023_07_10_Time_152_ms_(100.00%)_Space_34.7_MB_(100.00%)
class Solution {
fun restoreIpAddresses(s: String): List {
@@ -17,7 +17,7 @@ class Solution {
'.' +
octets[2] +
'.' +
- octets[3]
+ octets[3],
)
} else if (count < 4 && pos < 12) {
var octet = 0
diff --git a/src/main/kotlin/g0001_0100/s0094_binary_tree_inorder_traversal/Solution.kt b/src/main/kotlin/g0001_0100/s0094_binary_tree_inorder_traversal/Solution.kt
index 707af75f6..e25001e1b 100644
--- a/src/main/kotlin/g0001_0100/s0094_binary_tree_inorder_traversal/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0094_binary_tree_inorder_traversal/Solution.kt
@@ -1,8 +1,8 @@
package g0001_0100.s0094_binary_tree_inorder_traversal
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Depth_First_Search #Tree #Binary_Tree
-// #Stack #Data_Structure_I_Day_10_Tree #Udemy_Tree_Stack_Queue
-// #2022_09_27_Time_269_ms_(38.80%)_Space_35.9_MB_(14.49%)
+// #Stack #Data_Structure_I_Day_10_Tree #Udemy_Tree_Stack_Queue #Big_O_Time_O(n)_Space_O(n)
+// #2023_07_10_Time_152_ms_(66.67%)_Space_35.3_MB_(28.86%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0001_0100/s0095_unique_binary_search_trees_ii/Solution.kt b/src/main/kotlin/g0001_0100/s0095_unique_binary_search_trees_ii/Solution.kt
index b986cd166..3c92e5a10 100644
--- a/src/main/kotlin/g0001_0100/s0095_unique_binary_search_trees_ii/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0095_unique_binary_search_trees_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0095_unique_binary_search_trees_ii
// #Medium #Dynamic_Programming #Tree #Binary_Tree #Backtracking #Binary_Search_Tree
-// #2022_09_26_Time_360_ms_(41.38%)_Space_42.4_MB_(72.41%)
+// #2023_07_10_Time_167_ms_(100.00%)_Space_36.6_MB_(100.00%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0001_0100/s0096_unique_binary_search_trees/Solution.kt b/src/main/kotlin/g0001_0100/s0096_unique_binary_search_trees/Solution.kt
index 8707c3e2f..852e0a6e7 100644
--- a/src/main/kotlin/g0001_0100/s0096_unique_binary_search_trees/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0096_unique_binary_search_trees/Solution.kt
@@ -1,8 +1,8 @@
package g0001_0100.s0096_unique_binary_search_trees
-// #Medium #Top_100_Liked_Questions #Dynamic_Programming #Math #Tree #Binary_Tree
-// #Binary_Search_Tree #Dynamic_Programming_I_Day_11
-// #2022_10_07_Time_147_ms_(88.52%)_Space_32.6_MB_(96.72%)
+// #Medium #Dynamic_Programming #Math #Tree #Binary_Tree #Binary_Search_Tree
+// #Dynamic_Programming_I_Day_11 #Big_O_Time_O(n)_Space_O(1)
+// #2023_07_10_Time_116_ms_(92.31%)_Space_32.6_MB_(84.62%)
class Solution {
fun numTrees(n: Int): Int {
diff --git a/src/main/kotlin/g0001_0100/s0097_interleaving_string/Solution.kt b/src/main/kotlin/g0001_0100/s0097_interleaving_string/Solution.kt
index 51832f5a7..52e49a8d4 100644
--- a/src/main/kotlin/g0001_0100/s0097_interleaving_string/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0097_interleaving_string/Solution.kt
@@ -1,6 +1,7 @@
package g0001_0100.s0097_interleaving_string
-// #Medium #String #Dynamic_Programming #2022_09_26_Time_240_ms_(57.50%)_Space_35.1_MB_(57.50%)
+// #Medium #String #Dynamic_Programming #Top_Interview_150_Multidimensional_DP
+// #2023_07_10_Time_149_ms_(81.58%)_Space_33.8_MB_(97.37%)
class Solution {
fun isInterleave(s1: String, s2: String, s3: String): Boolean {
@@ -18,7 +19,7 @@ class Solution {
i1: Int,
i2: Int,
i3: Int,
- cache: Array>
+ cache: Array>,
): Boolean {
if (cache[i1][i2] != null) {
return cache[i1][i2]!!
diff --git a/src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt b/src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt
index 07aa4202e..ad18a6182 100644
--- a/src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt
@@ -2,7 +2,8 @@ package g0001_0100.s0098_validate_binary_search_tree
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Depth_First_Search #Tree #Binary_Tree
// #Binary_Search_Tree #Data_Structure_I_Day_14_Tree #Level_1_Day_8_Binary_Search_Tree
-// #Udemy_Tree_Stack_Queue #2022_09_02_Time_330_ms_(41.38%)_Space_40_MB_(43.80%)
+// #Udemy_Tree_Stack_Queue #Top_Interview_150_Binary_Search_Tree #Big_O_Time_O(N)_Space_O(log(N))
+// #2023_07_10_Time_190_ms_(61.62%)_Space_37.6_MB_(48.48%)
import com_github_leetcode.TreeNode
@@ -29,6 +30,8 @@ class Solution {
}
return if (root.`val` <= left || root.`val` >= right) {
false
- } else solve(root.left, left, root.`val`.toLong()) && solve(root.right, root.`val`.toLong(), right)
+ } else {
+ solve(root.left, left, root.`val`.toLong()) && solve(root.right, root.`val`.toLong(), right)
+ }
}
}
diff --git a/src/main/kotlin/g0001_0100/s0099_recover_binary_search_tree/Solution.kt b/src/main/kotlin/g0001_0100/s0099_recover_binary_search_tree/Solution.kt
index 3a33aff84..ba56b41ea 100644
--- a/src/main/kotlin/g0001_0100/s0099_recover_binary_search_tree/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0099_recover_binary_search_tree/Solution.kt
@@ -1,7 +1,7 @@
package g0001_0100.s0099_recover_binary_search_tree
// #Medium #Depth_First_Search #Tree #Binary_Tree #Binary_Search_Tree
-// #2022_09_27_Time_492_ms_(39.39%)_Space_50.6_MB_(21.21%)
+// #2023_07_10_Time_221_ms_(90.00%)_Space_37_MB_(90.00%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt b/src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt
index 9e0386699..2f9acf4ee 100644
--- a/src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt
@@ -1,7 +1,8 @@
package g0001_0100.s0100_same_tree
// #Easy #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree #Level_2_Day_15_Tree
-// #Udemy_Tree_Stack_Queue #2022_09_28_Time_208_ms_(72.24%)_Space_34.3_MB_(34.28%)
+// #Udemy_Tree_Stack_Queue #Top_Interview_150_Binary_Tree_General
+// #2023_07_10_Time_134_ms_(86.63%)_Space_33.8_MB_(48.19%)
import com_github_leetcode.TreeNode
@@ -20,7 +21,9 @@ class Solution {
return if (n != null && m != null) {
if (n.`val` != m.`val`) {
false
- } else trav(n.left, m.left) && trav(n.right, m.right)
+ } else {
+ trav(n.left, m.left) && trav(n.right, m.right)
+ }
} else {
n == null && m == null
}
diff --git a/src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt b/src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt
index 3c5c06634..6614e8381 100644
--- a/src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0101_symmetric_tree/Solution.kt
@@ -2,7 +2,8 @@ package g0101_0200.s0101_symmetric_tree
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Depth_First_Search #Breadth_First_Search
// #Tree #Binary_Tree #Data_Structure_I_Day_11_Tree #Level_2_Day_15_Tree
-// #2022_11_25_Time_190_ms_(91.36%)_Space_36.7_MB_(20.94%)
+// #Top_Interview_150_Binary_Tree_General #Big_O_Time_O(N)_Space_O(log(N))
+// #2023_07_11_Time_153_ms_(82.35%)_Space_34.2_MB_(88.24%)
import com_github_leetcode.TreeNode
@@ -20,7 +21,9 @@ class Solution {
fun isSymmetric(root: TreeNode?): Boolean {
return if (root == null) {
true
- } else helper(root.left, root.right)
+ } else {
+ helper(root.left, root.right)
+ }
}
private fun helper(leftNode: TreeNode?, rightNode: TreeNode?): Boolean {
@@ -29,6 +32,8 @@ class Solution {
}
return if (leftNode.`val` != rightNode.`val`) {
false
- } else helper(leftNode.left, rightNode.right) && helper(leftNode.right, rightNode.left)
+ } else {
+ helper(leftNode.left, rightNode.right) && helper(leftNode.right, rightNode.left)
+ }
}
}
diff --git a/src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt b/src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt
index 1f153c681..4d9901ace 100644
--- a/src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0102_binary_tree_level_order_traversal/Solution.kt
@@ -2,7 +2,8 @@ package g0101_0200.s0102_binary_tree_level_order_traversal
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Breadth_First_Search #Tree
// #Binary_Tree #Data_Structure_I_Day_11_Tree #Level_1_Day_6_Tree #Udemy_Tree_Stack_Queue
-// #2022_11_25_Time_332_ms_(67.53%)_Space_37_MB_(56.24%)
+// #Top_Interview_150_Binary_Tree_BFS #Big_O_Time_O(N)_Space_O(N)
+// #2023_07_11_Time_198_ms_(95.14%)_Space_37_MB_(88.26%)
import com_github_leetcode.TreeNode
import java.util.ArrayList
diff --git a/src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt b/src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt
index 456b6a438..af8004c2a 100644
--- a/src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0103_binary_tree_zigzag_level_order_traversal/Solution.kt
@@ -1,8 +1,8 @@
package g0101_0200.s0103_binary_tree_zigzag_level_order_traversal
// #Medium #Top_Interview_Questions #Breadth_First_Search #Tree #Binary_Tree
-// #Data_Structure_II_Day_15_Tree #Udemy_Tree_Stack_Queue
-// #2022_09_27_Time_316_ms_(34.25%)_Space_35.3_MB_(95.21%)
+// #Data_Structure_II_Day_15_Tree #Udemy_Tree_Stack_Queue #Top_Interview_150_Binary_Tree_BFS
+// #2023_07_11_Time_176_ms_(71.62%)_Space_34.9_MB_(87.84%)
import com_github_leetcode.TreeNode
import java.util.LinkedList
diff --git a/src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt b/src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt
index 27257df1c..c820f59b9 100644
--- a/src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0104_maximum_depth_of_binary_tree/Solution.kt
@@ -1,9 +1,10 @@
package g0101_0200.s0104_maximum_depth_of_binary_tree
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Depth_First_Search #Breadth_First_Search
-// #Tree #Binary_Tree #Data_Structure_I_Day_11_Tree
+// #Tree #Binary_Tree #LeetCode_75_Binary_Tree/DFS #Data_Structure_I_Day_11_Tree
// #Programming_Skills_I_Day_10_Linked_List_and_Tree #Udemy_Tree_Stack_Queue
-// #2022_09_02_Time_236_ms_(83.39%)_Space_36.2_MB_(88.26%)
+// #Top_Interview_150_Binary_Tree_General #Big_O_Time_O(N)_Space_O(H)
+// #2023_07_11_Time_166_ms_(83.53%)_Space_36.5_MB_(86.11%)
import com_github_leetcode.TreeNode
import kotlin.math.max
diff --git a/src/main/kotlin/g0101_0200/s0105_construct_binary_tree_from_preorder_and_inorder_traversal/Solution.kt b/src/main/kotlin/g0101_0200/s0105_construct_binary_tree_from_preorder_and_inorder_traversal/Solution.kt
index cf9f5a3f3..b4a3ec000 100644
--- a/src/main/kotlin/g0101_0200/s0105_construct_binary_tree_from_preorder_and_inorder_traversal/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0105_construct_binary_tree_from_preorder_and_inorder_traversal/Solution.kt
@@ -1,11 +1,10 @@
package g0101_0200.s0105_construct_binary_tree_from_preorder_and_inorder_traversal
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Tree #Binary_Tree
-// #Divide_and_Conquer #Data_Structure_II_Day_15_Tree
-// #2022_09_03_Time_370_ms_(58.31%)_Space_37.6_MB_(93.81%)
+// #Divide_and_Conquer #Data_Structure_II_Day_15_Tree #Top_Interview_150_Binary_Tree_General
+// #Big_O_Time_O(N)_Space_O(N) #2023_07_11_Time_183_ms_(95.45%)_Space_36.9_MB_(82.73%)
import com_github_leetcode.TreeNode
-import java.util.HashMap
/*
* Example:
diff --git a/src/main/kotlin/g0101_0200/s0106_construct_binary_tree_from_inorder_and_postorder_traversal/Solution.kt b/src/main/kotlin/g0101_0200/s0106_construct_binary_tree_from_inorder_and_postorder_traversal/Solution.kt
index 86a914032..9294ffce5 100644
--- a/src/main/kotlin/g0101_0200/s0106_construct_binary_tree_from_inorder_and_postorder_traversal/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0106_construct_binary_tree_from_inorder_and_postorder_traversal/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0106_construct_binary_tree_from_inorder_and_postorder_traversal
// #Medium #Array #Hash_Table #Tree #Binary_Tree #Divide_and_Conquer
-// #2022_09_27_Time_358_ms_(61.29%)_Space_37.1_MB_(96.77%)
+// #Top_Interview_150_Binary_Tree_General #2023_07_11_Time_167_ms_(100.00%)_Space_36.9_MB_(88.46%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0107_binary_tree_level_order_traversal_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0107_binary_tree_level_order_traversal_ii/Solution.kt
index 55680404e..240a1201b 100644
--- a/src/main/kotlin/g0101_0200/s0107_binary_tree_level_order_traversal_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0107_binary_tree_level_order_traversal_ii/Solution.kt
@@ -1,11 +1,10 @@
package g0101_0200.s0107_binary_tree_level_order_traversal_ii
// #Medium #Breadth_First_Search #Tree #Binary_Tree
-// #2022_10_07_Time_204_ms_(98.04%)_Space_35.7_MB_(96.08%)
+// #2023_07_11_Time_187_ms_(87.50%)_Space_36.6_MB_(100.00%)
import com_github_leetcode.TreeNode
import java.util.Collections
-import kotlin.collections.ArrayList
/*
* Example:
@@ -19,6 +18,7 @@ import kotlin.collections.ArrayList
*/
class Solution {
private val order: MutableList> = ArrayList()
+
fun levelOrderBottom(root: TreeNode?): List> {
getOrder(root, 0)
Collections.reverse(order)
diff --git a/src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt b/src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt
index 2ce0374f7..3c0860052 100644
--- a/src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/Solution.kt
@@ -2,7 +2,7 @@ package g0101_0200.s0108_convert_sorted_array_to_binary_search_tree
// #Easy #Top_Interview_Questions #Array #Tree #Binary_Tree #Binary_Search_Tree #Divide_and_Conquer
// #Data_Structure_II_Day_15_Tree #Level_2_Day_9_Binary_Search_Tree #Udemy_Tree_Stack_Queue
-// #2022_09_28_Time_334_ms_(35.39%)_Space_36.9_MB_(92.05%)
+// #Top_Interview_150_Divide_and_Conquer #2023_07_11_Time_167_ms_(80.29%)_Space_36.6_MB_(83.94%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0109_convert_sorted_list_to_binary_search_tree/Solution.kt b/src/main/kotlin/g0101_0200/s0109_convert_sorted_list_to_binary_search_tree/Solution.kt
index e901aa6f9..570b7cf61 100644
--- a/src/main/kotlin/g0101_0200/s0109_convert_sorted_list_to_binary_search_tree/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0109_convert_sorted_list_to_binary_search_tree/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0109_convert_sorted_list_to_binary_search_tree
// #Medium #Tree #Binary_Tree #Linked_List #Binary_Search_Tree #Divide_and_Conquer
-// #2022_09_28_Time_376_ms_(59.26%)_Space_43.3_MB_(66.67%)
+// #2023_07_11_Time_191_ms_(100.00%)_Space_39.5_MB_(61.54%)
import com_github_leetcode.ListNode
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt b/src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt
index 3220d9670..d2ae348fa 100644
--- a/src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0110_balanced_binary_tree
// #Easy #Depth_First_Search #Tree #Binary_Tree #Programming_Skills_II_Day_2 #Level_2_Day_6_Tree
-// #Udemy_Tree_Stack_Queue #2022_10_07_Time_310_ms_(63.63%)_Space_37.5_MB_(90.91%)
+// #Udemy_Tree_Stack_Queue #2023_07_11_Time_182_ms_(71.30%)_Space_36.5_MB_(78.48%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0112_path_sum/Solution.kt b/src/main/kotlin/g0101_0200/s0112_path_sum/Solution.kt
index d251ff661..5e79cc5b5 100644
--- a/src/main/kotlin/g0101_0200/s0112_path_sum/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0112_path_sum/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0112_path_sum
// #Easy #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree #Data_Structure_I_Day_12_Tree
-// #2022_09_29_Time_322_ms_(36.41%)_Space_39.6_MB_(18.97%)
+// #Top_Interview_150_Binary_Tree_General #2022_09_29_Time_322_ms_(36.41%)_Space_39.6_MB_(18.97%)
import com_github_leetcode.TreeNode
@@ -22,6 +22,8 @@ class Solution {
}
return if (targetSum == root.`val` && root.left == null && root.right == null) {
true
- } else hasPathSum(root.left, targetSum - root.`val`) || hasPathSum(root.right, targetSum - root.`val`)
+ } else {
+ hasPathSum(root.left, targetSum - root.`val`) || hasPathSum(root.right, targetSum - root.`val`)
+ }
}
}
diff --git a/src/main/kotlin/g0101_0200/s0113_path_sum_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0113_path_sum_ii/Solution.kt
index 4532d4188..99aac2986 100644
--- a/src/main/kotlin/g0101_0200/s0113_path_sum_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0113_path_sum_ii/Solution.kt
@@ -31,7 +31,7 @@ class Solution {
al: ArrayList,
sum: Int,
targetSum: Int,
- root: TreeNode?
+ root: TreeNode?,
) {
var sum = sum
if (root == null) {
diff --git a/src/main/kotlin/g0101_0200/s0114_flatten_binary_tree_to_linked_list/Solution.kt b/src/main/kotlin/g0101_0200/s0114_flatten_binary_tree_to_linked_list/Solution.kt
index 1084ec0a5..ffbe95c14 100644
--- a/src/main/kotlin/g0101_0200/s0114_flatten_binary_tree_to_linked_list/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0114_flatten_binary_tree_to_linked_list/Solution.kt
@@ -1,7 +1,8 @@
package g0101_0200.s0114_flatten_binary_tree_to_linked_list
// #Medium #Top_100_Liked_Questions #Depth_First_Search #Tree #Binary_Tree #Stack #Linked_List
-// #Udemy_Linked_List #2022_09_27_Time_191_ms_(93.10%)_Space_35_MB_(97.70%)
+// #Udemy_Linked_List #Top_Interview_150_Binary_Tree_General #Big_O_Time_O(N)_Space_O(N)
+// #2022_09_27_Time_191_ms_(93.10%)_Space_35_MB_(97.70%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0117_populating_next_right_pointers_in_each_node_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0117_populating_next_right_pointers_in_each_node_ii/Solution.kt
index d03ea8f0f..6a26253af 100644
--- a/src/main/kotlin/g0101_0200/s0117_populating_next_right_pointers_in_each_node_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0117_populating_next_right_pointers_in_each_node_ii/Solution.kt
@@ -2,7 +2,7 @@ package g0101_0200.s0117_populating_next_right_pointers_in_each_node_ii
// #Medium #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree #Linked_List
// #Algorithm_II_Day_7_Breadth_First_Search_Depth_First_Search
-// #2022_10_08_Time_199_ms_(94.67%)_Space_37_MB_(93.33%)
+// #Top_Interview_150_Binary_Tree_General #2022_10_08_Time_199_ms_(94.67%)_Space_37_MB_(93.33%)
import com_github_leetcode.left_right.Node
import java.util.LinkedList
diff --git a/src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt b/src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt
index 3daea4f30..3691f459c 100644
--- a/src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0118_pascals_triangle
-// #Easy #Top_Interview_Questions #Array #Dynamic_Programming #Data_Structure_I_Day_4_Array
-// #Dynamic_Programming_I_Day_12 #Udemy_Dynamic_Programming
+// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
+// #Data_Structure_I_Day_4_Array #Dynamic_Programming_I_Day_12 #Udemy_Dynamic_Programming
// #2022_10_08_Time_277_ms_(33.22%)_Space_34.2_MB_(90.60%)
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt b/src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt
index a0bbd0467..c1cb7ea68 100644
--- a/src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0120_triangle
// #Medium #Array #Dynamic_Programming #Algorithm_I_Day_12_Dynamic_Programming
-// #Dynamic_Programming_I_Day_13 #Udemy_Dynamic_Programming
+// #Dynamic_Programming_I_Day_13 #Udemy_Dynamic_Programming #Top_Interview_150_Multidimensional_DP
// #2022_10_08_Time_194_ms_(97.87%)_Space_40_MB_(71.28%)
class Solution {
@@ -27,7 +27,7 @@ class Solution {
triangle[row][col] +
Math.min(
dfs(triangle, dp, row + 1, col),
- dfs(triangle, dp, row + 1, col + 1)
+ dfs(triangle, dp, row + 1, col + 1),
)
)
dp[row][col] = sum
diff --git a/src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt b/src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt
index 694c980d2..9a39d5c25 100644
--- a/src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0121_best_time_to_buy_and_sell_stock/Solution.kt
@@ -2,6 +2,7 @@ package g0101_0200.s0121_best_time_to_buy_and_sell_stock
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
// #Data_Structure_I_Day_3_Array #Dynamic_Programming_I_Day_7 #Level_1_Day_5_Greedy #Udemy_Arrays
+// #Top_Interview_150_Array/String #Big_O_Time_O(N)_Space_O(1)
// #2022_09_03_Time_609_ms_(94.06%)_Space_57.3_MB_(94.43%)
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt
index 31fb6d7c6..2f50d9f3b 100644
--- a/src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/Solution.kt
@@ -1,7 +1,8 @@
package g0101_0200.s0122_best_time_to_buy_and_sell_stock_ii
// #Medium #Top_Interview_Questions #Array #Dynamic_Programming #Greedy #Dynamic_Programming_I_Day_7
-// #Udemy_Arrays #2022_11_25_Time_197_ms_(95.10%)_Space_35.3_MB_(96.33%)
+// #Udemy_Arrays #Top_Interview_150_Array/String
+// #2022_11_25_Time_197_ms_(95.10%)_Space_35.3_MB_(96.33%)
class Solution {
fun maxProfit(prices: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0123_best_time_to_buy_and_sell_stock_iii/Solution.kt b/src/main/kotlin/g0101_0200/s0123_best_time_to_buy_and_sell_stock_iii/Solution.kt
index b55ff744e..e4ea677ef 100644
--- a/src/main/kotlin/g0101_0200/s0123_best_time_to_buy_and_sell_stock_iii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0123_best_time_to_buy_and_sell_stock_iii/Solution.kt
@@ -1,11 +1,12 @@
package g0101_0200.s0123_best_time_to_buy_and_sell_stock_iii
-// #Hard #Array #Dynamic_Programming #2022_10_08_Time_585_ms_(95.24%)_Space_55.8_MB_(92.86%)
+// #Hard #Array #Dynamic_Programming #Top_Interview_150_Multidimensional_DP
+// #2022_10_08_Time_585_ms_(95.24%)_Space_55.8_MB_(92.86%)
class Solution {
fun maxProfit(prices: IntArray): Int {
val n = prices.size
- if (n <2) {
+ if (n < 2) {
return 0
}
val a = IntArray(n) { 0 }
diff --git a/src/main/kotlin/g0101_0200/s0124_binary_tree_maximum_path_sum/Solution.kt b/src/main/kotlin/g0101_0200/s0124_binary_tree_maximum_path_sum/Solution.kt
index 4c2d74743..498fcc9e3 100644
--- a/src/main/kotlin/g0101_0200/s0124_binary_tree_maximum_path_sum/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0124_binary_tree_maximum_path_sum/Solution.kt
@@ -1,8 +1,8 @@
package g0101_0200.s0124_binary_tree_maximum_path_sum
// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Dynamic_Programming #Depth_First_Search
-// #Tree #Binary_Tree #Udemy_Tree_Stack_Queue
-// #2022_09_03_Time_331_ms_(74.42%)_Space_45.1_MB_(59.88%)
+// #Tree #Binary_Tree #Udemy_Tree_Stack_Queue #Top_Interview_150_Binary_Tree_General
+// #Big_O_Time_O(N)_Space_O(N) #2022_09_03_Time_331_ms_(74.42%)_Space_45.1_MB_(59.88%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0125_valid_palindrome/Solution.kt b/src/main/kotlin/g0101_0200/s0125_valid_palindrome/Solution.kt
index c60cda33a..130910d48 100644
--- a/src/main/kotlin/g0101_0200/s0125_valid_palindrome/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0125_valid_palindrome/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0125_valid_palindrome
// #Easy #Top_Interview_Questions #String #Two_Pointers #Udemy_Two_Pointers
-// #2022_10_08_Time_353_ms_(52.06%)_Space_39.2_MB_(73.02%)
+// #Top_Interview_150_Two_Pointers #2022_10_08_Time_353_ms_(52.06%)_Space_39.2_MB_(73.02%)
@Suppress("NAME_SHADOWING")
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0126_word_ladder_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0126_word_ladder_ii/Solution.kt
index eafff9f8d..0465b60c8 100644
--- a/src/main/kotlin/g0101_0200/s0126_word_ladder_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0126_word_ladder_ii/Solution.kt
@@ -32,7 +32,7 @@ class Solution {
if (isLadder(word, next)) {
// construct the reverse graph from endWord
val reverseLadders = reverse.computeIfAbsent(
- next
+ next,
) { _: String? -> HashSet() }
reverseLadders.add(word)
if (endWord == next) {
@@ -71,7 +71,7 @@ class Solution {
beginWord: String,
graph: Map>,
ans: MutableList>,
- path: MutableSet
+ path: MutableSet,
) {
val next = graph[endWord] ?: return
for (word in next) {
diff --git a/src/main/kotlin/g0101_0200/s0127_word_ladder/Solution.kt b/src/main/kotlin/g0101_0200/s0127_word_ladder/Solution.kt
index 3e2fb33f9..160eb5b02 100644
--- a/src/main/kotlin/g0101_0200/s0127_word_ladder/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0127_word_ladder/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0127_word_ladder
// #Hard #Top_Interview_Questions #String #Hash_Table #Breadth_First_Search
-// #Graph_Theory_I_Day_12_Breadth_First_Search
+// #Graph_Theory_I_Day_12_Breadth_First_Search #Top_Interview_150_Graph_BFS
// #2022_10_08_Time_396_ms_(98.68%)_Space_49.1_MB_(80.26%)
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0128_longest_consecutive_sequence/Solution.kt b/src/main/kotlin/g0101_0200/s0128_longest_consecutive_sequence/Solution.kt
index e4921d084..801c738a8 100644
--- a/src/main/kotlin/g0101_0200/s0128_longest_consecutive_sequence/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0128_longest_consecutive_sequence/Solution.kt
@@ -1,6 +1,7 @@
package g0101_0200.s0128_longest_consecutive_sequence
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Union_Find
+// #Top_Interview_150_Hashmap #Big_O_Time_O(N_log_N)_Space_O(1)
// #2022_09_03_Time_460_ms_(97.77%)_Space_51_MB_(99.32%)
import java.util.PriorityQueue
@@ -22,7 +23,7 @@ class Solution {
if (num == lastNum) {
continue
}
- length ++
+ length++
if (num - lastNum > 1) {
length = 1
}
diff --git a/src/main/kotlin/g0101_0200/s0129_sum_root_to_leaf_numbers/Solution.kt b/src/main/kotlin/g0101_0200/s0129_sum_root_to_leaf_numbers/Solution.kt
index 3828b48e6..d18f9ff07 100644
--- a/src/main/kotlin/g0101_0200/s0129_sum_root_to_leaf_numbers/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0129_sum_root_to_leaf_numbers/Solution.kt
@@ -1,6 +1,6 @@
package g0101_0200.s0129_sum_root_to_leaf_numbers
-// #Medium #Depth_First_Search #Tree #Binary_Tree
+// #Medium #Depth_First_Search #Tree #Binary_Tree #Top_Interview_150_Binary_Tree_General
// #2022_11_25_Time_237_ms_(52.50%)_Space_34.1_MB_(55.00%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0130_surrounded_regions/Solution.kt b/src/main/kotlin/g0101_0200/s0130_surrounded_regions/Solution.kt
index a5974f7a5..42df01cb3 100644
--- a/src/main/kotlin/g0101_0200/s0130_surrounded_regions/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0130_surrounded_regions/Solution.kt
@@ -2,7 +2,7 @@ package g0101_0200.s0130_surrounded_regions
// #Medium #Top_Interview_Questions #Array #Depth_First_Search #Breadth_First_Search #Matrix
// #Union_Find #Algorithm_II_Day_8_Breadth_First_Search_Depth_First_Search
-// #2022_10_08_Time_355_ms_(84.42%)_Space_51.2_MB_(68.83%)
+// #Top_Interview_150_Graph_General #2022_10_08_Time_355_ms_(84.42%)_Space_51.2_MB_(68.83%)
class Solution {
fun solve(board: Array) {
diff --git a/src/main/kotlin/g0101_0200/s0131_palindrome_partitioning/Solution.kt b/src/main/kotlin/g0101_0200/s0131_palindrome_partitioning/Solution.kt
index 73eeb9a24..9b928d3ee 100644
--- a/src/main/kotlin/g0101_0200/s0131_palindrome_partitioning/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0131_palindrome_partitioning/Solution.kt
@@ -1,7 +1,8 @@
package g0101_0200.s0131_palindrome_partitioning
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #String #Dynamic_Programming
-// #Backtracking #2022_09_03_Time_820_ms_(87.27%)_Space_59.5_MB_(90.91%)
+// #Backtracking #Big_O_Time_O(N*2^N)_Space_O(2^N*N)
+// #2022_09_03_Time_820_ms_(87.27%)_Space_59.5_MB_(90.91%)
@Suppress("NAME_SHADOWING")
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt b/src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt
index 4a8ac9e33..5580bd23b 100644
--- a/src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0133_clone_graph
// #Medium #Hash_Table #Depth_First_Search #Breadth_First_Search #Graph #Udemy_Graph
-// #2022_10_09_Time_351_ms_(60.91%)_Space_37.1_MB_(70.56%)
+// #Top_Interview_150_Graph_General #2022_10_09_Time_351_ms_(60.91%)_Space_37.1_MB_(70.56%)
import com_github_leetcode.neighbors.Node
diff --git a/src/main/kotlin/g0101_0200/s0134_gas_station/Solution.kt b/src/main/kotlin/g0101_0200/s0134_gas_station/Solution.kt
index a2935e040..190d0dd06 100644
--- a/src/main/kotlin/g0101_0200/s0134_gas_station/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0134_gas_station/Solution.kt
@@ -1,6 +1,6 @@
package g0101_0200.s0134_gas_station
-// #Medium #Top_Interview_Questions #Array #Greedy
+// #Medium #Top_Interview_Questions #Array #Greedy #Top_Interview_150_Array/String
// #2022_10_09_Time_545_ms_(70.18%)_Space_74.6_MB_(45.61%)
class Solution {
@@ -24,6 +24,8 @@ class Solution {
}
return if (sumGas < sumCost) {
-1
- } else result
+ } else {
+ result
+ }
}
}
diff --git a/src/main/kotlin/g0101_0200/s0135_candy/Solution.kt b/src/main/kotlin/g0101_0200/s0135_candy/Solution.kt
index 14a751fab..30f2f2a07 100644
--- a/src/main/kotlin/g0101_0200/s0135_candy/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0135_candy/Solution.kt
@@ -1,6 +1,7 @@
package g0101_0200.s0135_candy
-// #Hard #Array #Greedy #2022_10_09_Time_466_ms_(58.33%)_Space_51.2_MB_(83.33%)
+// #Hard #Array #Greedy #Top_Interview_150_Array/String
+// #2022_10_09_Time_466_ms_(58.33%)_Space_51.2_MB_(83.33%)
class Solution {
fun candy(ratings: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt b/src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt
index 78141da68..dbc909c3f 100644
--- a/src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt
@@ -1,8 +1,9 @@
package g0101_0200.s0136_single_number
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Bit_Manipulation
-// #Data_Structure_II_Day_1_Array #Algorithm_I_Day_14_Bit_Manipulation #Udemy_Integers
-// #2022_09_03_Time_344_ms_(83.63%)_Space_47.6_MB_(82.58%)
+// #LeetCode_75_Bit_Manipulation #Data_Structure_II_Day_1_Array
+// #Algorithm_I_Day_14_Bit_Manipulation #Udemy_Integers #Top_Interview_150_Bit_Manipulation
+// #Big_O_Time_O(N)_Space_O(1) #2022_09_03_Time_344_ms_(83.63%)_Space_47.6_MB_(82.58%)
class Solution {
fun singleNumber(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0137_single_number_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0137_single_number_ii/Solution.kt
index 4e80172d6..77a6fb34c 100644
--- a/src/main/kotlin/g0101_0200/s0137_single_number_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0137_single_number_ii/Solution.kt
@@ -1,6 +1,7 @@
package g0101_0200.s0137_single_number_ii
-// #Medium #Array #Bit_Manipulation #2022_10_09_Time_344_ms_(64.29%)_Space_38.4_MB_(92.86%)
+// #Medium #Array #Bit_Manipulation #Top_Interview_150_Bit_Manipulation
+// #2022_10_09_Time_344_ms_(64.29%)_Space_38.4_MB_(92.86%)
class Solution {
fun singleNumber(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt b/src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt
index 4fcf23ed7..70b4013e9 100644
--- a/src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0138_copy_list_with_random_pointer/Solution.kt
@@ -1,8 +1,8 @@
package g0101_0200.s0138_copy_list_with_random_pointer
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Hash_Table #Linked_List
-// #Programming_Skills_II_Day_14 #Udemy_Linked_List
-// #2022_09_03_Time_274_ms_(80.58%)_Space_40.5_MB_(58.99%)
+// #Programming_Skills_II_Day_14 #Udemy_Linked_List #Top_Interview_150_Linked_List
+// #Big_O_Time_O(N)_Space_O(N) #2022_09_03_Time_274_ms_(80.58%)_Space_40.5_MB_(58.99%)
import com_github_leetcode.random.Node
diff --git a/src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt b/src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt
index 3080e693f..8470b6039 100644
--- a/src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0139_word_break/Solution.kt
@@ -2,8 +2,8 @@ package g0101_0200.s0139_word_break
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #String #Hash_Table
// #Dynamic_Programming #Trie #Memoization #Algorithm_II_Day_15_Dynamic_Programming
-// #Dynamic_Programming_I_Day_9 #Udemy_Dynamic_Programming
-// #2022_09_03_Time_197_ms_(87.17%)_Space_34.4_MB_(99.25%)
+// #Dynamic_Programming_I_Day_9 #Udemy_Dynamic_Programming #Top_Interview_150_1D_DP
+// #Big_O_Time_O(M+max*N)_Space_O(M+N+max) #2022_09_03_Time_197_ms_(87.17%)_Space_34.4_MB_(99.25%)
import java.util.HashSet
diff --git a/src/main/kotlin/g0101_0200/s0140_word_break_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0140_word_break_ii/Solution.kt
index 017683e3d..2642a273a 100644
--- a/src/main/kotlin/g0101_0200/s0140_word_break_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0140_word_break_ii/Solution.kt
@@ -18,7 +18,7 @@ class Solution {
wordSet: Set,
index: Int,
sb: StringBuilder,
- result: MutableList
+ result: MutableList,
) {
if (index == s.length) {
if (sb[sb.length - 1] == ' ') {
diff --git a/src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt b/src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt
index 87d63fb12..5d16bc854 100644
--- a/src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0141_linked_list_cycle/Solution.kt
@@ -1,8 +1,8 @@
package g0101_0200.s0141_linked_list_cycle
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Hash_Table #Two_Pointers #Linked_List
-// #Data_Structure_I_Day_7_Linked_List #Udemy_Linked_List
-// #2022_09_18_Time_223_ms_(91.85%)_Space_38.2_MB_(87.85%)
+// #Data_Structure_I_Day_7_Linked_List #Udemy_Linked_List #Top_Interview_150_Linked_List
+// #Big_O_Time_O(N)_Space_O(1) #2022_09_18_Time_223_ms_(91.85%)_Space_38.2_MB_(87.85%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt
index 8cb669b43..76251c2f7 100644
--- a/src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0142_linked_list_cycle_ii/Solution.kt
@@ -2,7 +2,7 @@ package g0101_0200.s0142_linked_list_cycle_ii
// #Medium #Top_100_Liked_Questions #Hash_Table #Two_Pointers #Linked_List
// #Data_Structure_II_Day_10_Linked_List #Level_1_Day_4_Linked_List #Udemy_Linked_List
-// #2022_09_03_Time_192_ms_(63.39%)_Space_35.2_MB_(80.95%)
+// #Big_O_Time_O(N)_Space_O(1) #2022_09_03_Time_192_ms_(63.39%)_Space_35.2_MB_(80.95%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0101_0200/s0144_binary_tree_preorder_traversal/Solution.kt b/src/main/kotlin/g0101_0200/s0144_binary_tree_preorder_traversal/Solution.kt
index 5b2c07e56..bc2581a89 100644
--- a/src/main/kotlin/g0101_0200/s0144_binary_tree_preorder_traversal/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0144_binary_tree_preorder_traversal/Solution.kt
@@ -4,7 +4,6 @@ package g0101_0200.s0144_binary_tree_preorder_traversal
// #Udemy_Tree_Stack_Queue #2022_10_09_Time_277_ms_(37.90%)_Space_34.2_MB_(82.19%)
import com_github_leetcode.TreeNode
-import java.util.Stack
/*
* Example:
@@ -22,15 +21,15 @@ class Solution {
if (root == null) {
return result
}
- val stack: Stack = Stack()
+ val stack: ArrayDeque = ArrayDeque()
var current: TreeNode? = root
while (current != null || stack.isNotEmpty()) {
while (current != null) {
result.add(current.`val`)
- stack.push(current.right)
+ stack.addLast(current.right)
current = current.left
}
- current = stack.pop()
+ current = stack.removeLast()
}
return result
}
diff --git a/src/main/kotlin/g0101_0200/s0146_lru_cache/LRUCache.kt b/src/main/kotlin/g0101_0200/s0146_lru_cache/LRUCache.kt
index a16b6e1a0..13d4ee50d 100644
--- a/src/main/kotlin/g0101_0200/s0146_lru_cache/LRUCache.kt
+++ b/src/main/kotlin/g0101_0200/s0146_lru_cache/LRUCache.kt
@@ -1,7 +1,8 @@
package g0101_0200.s0146_lru_cache
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Hash_Table #Design #Linked_List
-// #Doubly_Linked_List #Udemy_Linked_List #2022_09_03_Time_1116_ms_(97.93%)_Space_139.6_MB_(97.51%)
+// #Doubly_Linked_List #Udemy_Linked_List #Top_Interview_150_Linked_List
+// #Big_O_Time_O(1)_Space_O(capacity) #2022_09_03_Time_1116_ms_(97.93%)_Space_139.6_MB_(97.51%)
class LRUCache(capacity: Int) {
private val nodeMap = HashMap()
diff --git a/src/main/kotlin/g0101_0200/s0148_sort_list/Solution.kt b/src/main/kotlin/g0101_0200/s0148_sort_list/Solution.kt
index 9d972468c..f8a6c1a84 100644
--- a/src/main/kotlin/g0101_0200/s0148_sort_list/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0148_sort_list/Solution.kt
@@ -1,8 +1,8 @@
package g0101_0200.s0148_sort_list
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Sorting #Two_Pointers #Linked_List
-// #Divide_and_Conquer #Merge_Sort #Level_2_Day_4_Linked_List
-// #2022_09_06_Time_820_ms_(61.70%)_Space_76_MB_(28.72%)
+// #Divide_and_Conquer #Merge_Sort #Level_2_Day_4_Linked_List #Top_Interview_150_Divide_and_Conquer
+// #Big_O_Time_O(log(N))_Space_O(log(N)) #2022_09_06_Time_820_ms_(61.70%)_Space_76_MB_(28.72%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0101_0200/s0149_max_points_on_a_line/Solution.kt b/src/main/kotlin/g0101_0200/s0149_max_points_on_a_line/Solution.kt
index afb0cbab7..0ed8ef29d 100644
--- a/src/main/kotlin/g0101_0200/s0149_max_points_on_a_line/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0149_max_points_on_a_line/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0149_max_points_on_a_line
// #Hard #Top_Interview_Questions #Array #Hash_Table #Math #Geometry #Algorithm_II_Day_21_Others
-// #2022_10_09_Time_307_ms_(83.33%)_Space_34.5_MB_(100.00%)
+// #Top_Interview_150_Math #2022_10_09_Time_307_ms_(83.33%)_Space_34.5_MB_(100.00%)
class Solution {
fun maxPoints(points: Array): Int {
diff --git a/src/main/kotlin/g0101_0200/s0150_evaluate_reverse_polish_notation/Solution.kt b/src/main/kotlin/g0101_0200/s0150_evaluate_reverse_polish_notation/Solution.kt
index 36a637edc..863396779 100644
--- a/src/main/kotlin/g0101_0200/s0150_evaluate_reverse_polish_notation/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0150_evaluate_reverse_polish_notation/Solution.kt
@@ -1,16 +1,14 @@
package g0101_0200.s0150_evaluate_reverse_polish_notation
// #Medium #Top_Interview_Questions #Array #Math #Stack #Programming_Skills_II_Day_3
-// #2022_10_09_Time_233_ms_(88.82%)_Space_36.7_MB_(91.45%)
-
-import java.util.function.BiFunction
+// #Top_Interview_150_Stack #2022_10_09_Time_233_ms_(88.82%)_Space_36.7_MB_(91.45%)
class Solution {
- val op = mapOf>(
- "/" to BiFunction { a, b -> a / b },
- "*" to BiFunction { a, b -> a * b },
- "+" to BiFunction { a, b -> a + b },
- "-" to BiFunction { a, b -> a - b }
+ val op = mapOf Int>(
+ "/" to { a, b -> a / b },
+ "*" to { a, b -> a * b },
+ "+" to { a, b -> a + b },
+ "-" to { a, b -> a - b },
)
fun evalRPN(tokens: Array): Int {
val stack = ArrayDeque()
@@ -18,7 +16,7 @@ class Solution {
if (op.contains(t)) {
val b = stack.removeFirst().toInt()
val a = stack.removeFirst().toInt()
- val c = op.getValue(t).apply(a, b)
+ val c = op.getValue(t).invoke(a, b)
stack.addFirst(c.toString())
} else {
stack.addFirst(t)
diff --git a/src/main/kotlin/g0101_0200/s0151_reverse_words_in_a_string/Solution.kt b/src/main/kotlin/g0101_0200/s0151_reverse_words_in_a_string/Solution.kt
index 84fe850b8..bb8d43baa 100644
--- a/src/main/kotlin/g0101_0200/s0151_reverse_words_in_a_string/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0151_reverse_words_in_a_string/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0151_reverse_words_in_a_string
-// #Medium #String #Two_Pointers #Udemy_Strings
-// #2022_10_11_Time_206_ms_(98.90%)_Space_36.1_MB_(96.70%)
+// #Medium #String #Two_Pointers #LeetCode_75_Array/String #Udemy_Strings
+// #Top_Interview_150_Array/String #2022_10_11_Time_206_ms_(98.90%)_Space_36.1_MB_(96.70%)
class Solution {
fun reverseWords(s: String): String {
diff --git a/src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt b/src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt
index db2b796eb..eab356172 100644
--- a/src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0152_maximum_product_subarray/Solution.kt
@@ -2,7 +2,7 @@ package g0101_0200.s0152_maximum_product_subarray
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
// #Dynamic_Programming_I_Day_6 #Level_2_Day_13_Dynamic_Programming #Udemy_Dynamic_Programming
-// #2022_09_06_Time_253_ms_(88.42%)_Space_42.1_MB_(44.74%)
+// #Big_O_Time_O(N)_Space_O(1) #2022_09_06_Time_253_ms_(88.42%)_Space_42.1_MB_(44.74%)
class Solution {
fun maxProduct(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt b/src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt
index 5bea6bcff..0db9e73d5 100644
--- a/src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0153_find_minimum_in_rotated_sorted_array/Solution.kt
@@ -1,8 +1,8 @@
package g0101_0200.s0153_find_minimum_in_rotated_sorted_array
// #Medium #Top_100_Liked_Questions #Array #Binary_Search #Algorithm_II_Day_2_Binary_Search
-// #Binary_Search_I_Day_12 #Udemy_Binary_Search
-// #2022_09_06_Time_262_ms_(60.96%)_Space_35.4_MB_(86.45%)
+// #Binary_Search_I_Day_12 #Udemy_Binary_Search #Top_Interview_150_Binary_Search
+// #Big_O_Time_O(log_N)_Space_O(log_N) #2022_09_06_Time_262_ms_(60.96%)_Space_35.4_MB_(86.45%)
class Solution {
private fun findMinUtil(nums: IntArray, l: Int, r: Int): Int {
diff --git a/src/main/kotlin/g0101_0200/s0154_find_minimum_in_rotated_sorted_array_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0154_find_minimum_in_rotated_sorted_array_ii/Solution.kt
index c8b7c19e1..6def9f22a 100644
--- a/src/main/kotlin/g0101_0200/s0154_find_minimum_in_rotated_sorted_array_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0154_find_minimum_in_rotated_sorted_array_ii/Solution.kt
@@ -7,7 +7,9 @@ class Solution {
fun findMin(nums: IntArray): Int {
return if (nums.isEmpty()) {
0
- } else find(0, nums.size - 1, nums)
+ } else {
+ find(0, nums.size - 1, nums)
+ }
}
private fun find(left: Int, right: Int, nums: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt b/src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt
index cab9b6aa0..85d1230aa 100644
--- a/src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt
+++ b/src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt
@@ -1,34 +1,35 @@
package g0101_0200.s0155_min_stack
-// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Stack #Design
+// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Stack #Design
// #Data_Structure_II_Day_14_Stack_Queue #Programming_Skills_II_Day_18 #Level_2_Day_16_Design
-// #Udemy_Design #2022_09_06_Time_331_ms_(84.88%)_Space_54.3_MB_(46.34%)
-
-import java.util.Stack
+// #Udemy_Design #Top_Interview_150_Stack #Big_O_Time_O(1)_Space_O(N)
+// #2022_09_06_Time_331_ms_(84.88%)_Space_54.3_MB_(46.34%)
class MinStack() {
- private val stack: Stack> = Stack()
+ private val stack: ArrayDeque> = ArrayDeque()
fun push(x: Int) {
- val min: Int = if (stack.isEmpty()) x
- else getMin()
-
- stack.push(x to minOf(min, x))
+ val min: Int = if (stack.isEmpty()) {
+ x
+ } else {
+ getMin()
+ }
+ stack.addLast(x to minOf(min, x))
}
fun pop() {
- stack.pop()
+ stack.removeLast()
}
fun top(): Int {
return stack
- .peek()
+ .last()
.first
}
fun getMin(): Int {
return stack
- .peek()
+ .last()
.second
}
}
diff --git a/src/main/kotlin/g0101_0200/s0160_intersection_of_two_linked_lists/Solution.kt b/src/main/kotlin/g0101_0200/s0160_intersection_of_two_linked_lists/Solution.kt
index c1b861e1f..481842493 100644
--- a/src/main/kotlin/g0101_0200/s0160_intersection_of_two_linked_lists/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0160_intersection_of_two_linked_lists/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0160_intersection_of_two_linked_lists
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Hash_Table #Two_Pointers #Linked_List
-// #Data_Structure_II_Day_11_Linked_List #Udemy_Linked_List
+// #Data_Structure_II_Day_11_Linked_List #Udemy_Linked_List #Big_O_Time_O(M+N)_Space_O(1)
// #2022_09_08_Time_262_ms_(83.50%)_Space_54.7_MB_(75.26%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt b/src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt
index 3336e9927..4006377d1 100644
--- a/src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt
@@ -1,7 +1,8 @@
package g0101_0200.s0162_find_peak_element
-// #Medium #Top_Interview_Questions #Array #Binary_Search #Algorithm_II_Day_2_Binary_Search
-// #Binary_Search_II_Day_12 #2022_10_11_Time_297_ms_(53.85%)_Space_36.8_MB_(66.27%)
+// #Medium #Top_Interview_Questions #Array #Binary_Search #LeetCode_75_Binary_Search
+// #Algorithm_II_Day_2_Binary_Search #Binary_Search_II_Day_12 #Top_Interview_150_Binary_Search
+// #2022_10_11_Time_297_ms_(53.85%)_Space_36.8_MB_(66.27%)
class Solution {
fun findPeakElement(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0164_maximum_gap/Solution.kt b/src/main/kotlin/g0101_0200/s0164_maximum_gap/Solution.kt
index e511957b0..db5942f3f 100644
--- a/src/main/kotlin/g0101_0200/s0164_maximum_gap/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0164_maximum_gap/Solution.kt
@@ -1,6 +1,6 @@
package g0101_0200.s0164_maximum_gap
-// #Hard #Array #Sorting #Bucket_Sort #Radix_Sort
+// #Medium #Array #Sorting #Bucket_Sort #Radix_Sort
// #2022_10_11_Time_991_ms_(68.00%)_Space_77.2_MB_(88.00%)
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt b/src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt
index 2cdfbeb31..b3c45b184 100644
--- a/src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0167_two_sum_ii_input_array_is_sorted/Solution.kt
@@ -1,7 +1,8 @@
package g0101_0200.s0167_two_sum_ii_input_array_is_sorted
// #Medium #Array #Binary_Search #Two_Pointers #Algorithm_I_Day_3_Two_Pointers
-// #Binary_Search_I_Day_7 #2022_10_11_Time_403_ms_(68.74%)_Space_47.2_MB_(58.24%)
+// #Binary_Search_I_Day_7 #Top_Interview_150_Two_Pointers
+// #2022_10_11_Time_403_ms_(68.74%)_Space_47.2_MB_(58.24%)
class Solution {
fun twoSum(numbers: IntArray, target: Int): IntArray {
diff --git a/src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt b/src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt
index 5d9bc008f..fdacdbbd5 100644
--- a/src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0169_majority_element/Solution.kt
@@ -2,6 +2,7 @@ package g0101_0200.s0169_majority_element
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Sorting #Counting
// #Divide_and_Conquer #Data_Structure_II_Day_1_Array #Udemy_Famous_Algorithm
+// #Top_Interview_150_Array/String #Big_O_Time_O(n)_Space_O(1)
// #2022_09_08_Time_460_ms_(51.25%)_Space_52.9_MB_(52.64%)
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0172_factorial_trailing_zeroes/Solution.kt b/src/main/kotlin/g0101_0200/s0172_factorial_trailing_zeroes/Solution.kt
index 4e8540057..c644535e3 100644
--- a/src/main/kotlin/g0101_0200/s0172_factorial_trailing_zeroes/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0172_factorial_trailing_zeroes/Solution.kt
@@ -1,6 +1,6 @@
package g0101_0200.s0172_factorial_trailing_zeroes
-// #Medium #Top_Interview_Questions #Math #Udemy_Integers
+// #Medium #Top_Interview_Questions #Math #Udemy_Integers #Top_Interview_150_Math
// #2022_10_12_Time_220_ms_(67.65%)_Space_34.2_MB_(14.71%)
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt b/src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt
index 5ef871443..b7d95570f 100644
--- a/src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt
+++ b/src/main/kotlin/g0101_0200/s0173_binary_search_tree_iterator/BSTIterator.kt
@@ -2,7 +2,7 @@ package g0101_0200.s0173_binary_search_tree_iterator
// #Medium #Tree #Binary_Tree #Stack #Design #Binary_Search_Tree #Iterator
// #Data_Structure_II_Day_17_Tree #Programming_Skills_II_Day_16 #Level_2_Day_9_Binary_Search_Tree
-// #2022_10_12_Time_563_ms_(46.91%)_Space_60.5_MB_(66.67%)
+// #Top_Interview_150_Binary_Tree_General #2022_10_12_Time_563_ms_(46.91%)_Space_60.5_MB_(66.67%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0188_best_time_to_buy_and_sell_stock_iv/Solution.kt b/src/main/kotlin/g0101_0200/s0188_best_time_to_buy_and_sell_stock_iv/Solution.kt
index 4fc5b4a17..579bbb8e0 100644
--- a/src/main/kotlin/g0101_0200/s0188_best_time_to_buy_and_sell_stock_iv/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0188_best_time_to_buy_and_sell_stock_iv/Solution.kt
@@ -1,6 +1,7 @@
package g0101_0200.s0188_best_time_to_buy_and_sell_stock_iv
-// #Hard #Array #Dynamic_Programming #2022_10_18_Time_293_ms_(68.31%)_Space_34.9_MB_(84.15%)
+// #Hard #Array #Dynamic_Programming #Top_Interview_150_Multidimensional_DP
+// #2022_10_18_Time_293_ms_(68.31%)_Space_34.9_MB_(84.15%)
class Solution {
fun maxProfit(k: Int, prices: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt b/src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt
index 3fb82d8b8..e6f1a7c6d 100644
--- a/src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0189_rotate_array/Solution.kt
@@ -1,8 +1,8 @@
package g0101_0200.s0189_rotate_array
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Math #Two_Pointers
-// #Algorithm_I_Day_2_Two_Pointers #Udemy_Arrays
-// #2022_09_08_Time_483_ms_(86.95%)_Space_71.9_MB_(50.13%)
+// #Algorithm_I_Day_2_Two_Pointers #Udemy_Arrays #Top_Interview_150_Array/String
+// #Big_O_Time_O(n)_Space_O(1) #2022_09_08_Time_483_ms_(86.95%)_Space_71.9_MB_(50.13%)
@Suppress("NAME_SHADOWING")
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt b/src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt
index 4e532cd2e..13a67fa8a 100644
--- a/src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0190_reverse_bits
// #Easy #Top_Interview_Questions #Bit_Manipulation #Divide_and_Conquer
-// #Algorithm_I_Day_14_Bit_Manipulation #Udemy_Bit_Manipulation
+// #Algorithm_I_Day_14_Bit_Manipulation #Udemy_Bit_Manipulation #Top_Interview_150_Bit_Manipulation
// #2022_10_18_Time_198_ms_(81.82%)_Space_32.8_MB_(73.86%)
@Suppress("NAME_SHADOWING")
diff --git a/src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt b/src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt
index bd288c7ed..06f133bdc 100644
--- a/src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0191_number_of_1_bits
// #Easy #Top_Interview_Questions #Bit_Manipulation #Algorithm_I_Day_13_Bit_Manipulation
-// #Programming_Skills_I_Day_2_Operator #Udemy_Bit_Manipulation
+// #Programming_Skills_I_Day_2_Operator #Udemy_Bit_Manipulation #Top_Interview_150_Bit_Manipulation
// #2022_10_18_Time_237_ms_(68.44%)_Space_33.8_MB_(52.46%)
class Solution {
diff --git a/src/main/kotlin/g0101_0200/s0194_transpose_file/script.sh b/src/main/kotlin/g0101_0200/s0194_transpose_file/script.sh
index 65f94e5a0..2b5f71645 100644
--- a/src/main/kotlin/g0101_0200/s0194_transpose_file/script.sh
+++ b/src/main/kotlin/g0101_0200/s0194_transpose_file/script.sh
@@ -1,8 +1,17 @@
# Read from the file file.txt and print its transposed content to stdout.
-# #Medium #Shell #2022_11_25_Time_461_ms_(33.47%)_Space_3.9_MB_(34.89%)
-wordcount=$(head -1 file.txt | wc -w)
-col_n=1
-while [[ $col_n -le $wordcount ]]; do
- awk "{ print \$$col_n }" file.txt | paste -sd " "
- col_n=$((col_n + 1))
-done
+# #Medium #Shell #2025_05_03_Time_61_ms_(88.19%)_Space_4.14_MB_(38.67%)
+awk '
+{
+ for (i = 1; i <= NF; i++) {
+ if (NR == 1) {
+ a[i] = $i
+ } else {
+ a[i] = a[i] " " $i
+ }
+ }
+}
+END {
+ for (i = 1; i <= NF; i++) {
+ print a[i]
+ }
+}' file.txt
diff --git a/src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt b/src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt
index d4edfc1e1..df63a0e78 100644
--- a/src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt
@@ -1,9 +1,9 @@
package g0101_0200.s0198_house_robber
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
-// #Algorithm_I_Day_12_Dynamic_Programming #Dynamic_Programming_I_Day_3
-// #Level_2_Day_12_Dynamic_Programming #Udemy_Dynamic_Programming
-// #2022_09_08_Time_156_ms_(92.24%)_Space_34.1_MB_(61.64%)
+// #LeetCode_75_DP/1D #Algorithm_I_Day_12_Dynamic_Programming #Dynamic_Programming_I_Day_3
+// #Level_2_Day_12_Dynamic_Programming #Udemy_Dynamic_Programming #Top_Interview_150_1D_DP
+// #Big_O_Time_O(n)_Space_O(n) #2022_09_08_Time_156_ms_(92.24%)_Space_34.1_MB_(61.64%)
class Solution {
fun rob(nums: IntArray): Int {
diff --git a/src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt b/src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt
index 9dc8b8782..60e70e528 100644
--- a/src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0199_binary_tree_right_side_view/Solution.kt
@@ -1,8 +1,8 @@
package g0101_0200.s0199_binary_tree_right_side_view
-// #Medium #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree
-// #Data_Structure_II_Day_16_Tree #Level_2_Day_15_Tree
-// #2022_09_09_Time_194_ms_(92.89%)_Space_35.4_MB_(67.89%)
+// #Medium #Top_100_Liked_Questions #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree
+// #LeetCode_75_Binary_Tree/BFS #Data_Structure_II_Day_16_Tree #Level_2_Day_15_Tree
+// #Top_Interview_150_Binary_Tree_BFS #2022_09_09_Time_194_ms_(92.89%)_Space_35.4_MB_(67.89%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt b/src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt
index 4a1c0ddc1..453e0cd0b 100644
--- a/src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0200_number_of_islands/Solution.kt
@@ -4,6 +4,7 @@ package g0101_0200.s0200_number_of_islands
// #Breadth_First_Search #Matrix #Union_Find
// #Algorithm_II_Day_6_Breadth_First_Search_Depth_First_Search
// #Graph_Theory_I_Day_1_Matrix_Related_Problems #Level_1_Day_9_Graph/BFS/DFS #Udemy_Graph
+// #Top_Interview_150_Graph_General #Big_O_Time_O(M*N)_Space_O(M*N)
// #2022_09_09_Time_252_ms_(95.41%)_Space_52.4_MB_(86.52%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0201_bitwise_and_of_numbers_range/Solution.kt b/src/main/kotlin/g0201_0300/s0201_bitwise_and_of_numbers_range/Solution.kt
index b39057084..301ef7911 100644
--- a/src/main/kotlin/g0201_0300/s0201_bitwise_and_of_numbers_range/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0201_bitwise_and_of_numbers_range/Solution.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0201_bitwise_and_of_numbers_range
// #Medium #Bit_Manipulation #Algorithm_II_Day_19_Bit_Manipulation
-// #2022_10_19_Time_368_ms_(80.00%)_Space_37.1_MB_(76.67%)
+// #Top_Interview_150_Bit_Manipulation #2022_10_19_Time_368_ms_(80.00%)_Space_37.1_MB_(76.67%)
class Solution {
fun rangeBitwiseAnd(left: Int, right: Int): Int {
@@ -41,7 +41,7 @@ class Solution {
-0x10,
-0x8,
-0x4,
- -0x2
+ -0x2,
)
}
}
diff --git a/src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt b/src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt
index 3d1036197..5579081d8 100644
--- a/src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt
@@ -2,7 +2,7 @@ package g0201_0300.s0202_happy_number
// #Easy #Top_Interview_Questions #Hash_Table #Math #Two_Pointers #Algorithm_II_Day_21_Others
// #Programming_Skills_I_Day_4_Loop #Level_2_Day_1_Implementation/Simulation
-// #2022_10_19_Time_261_ms_(45.08%)_Space_33.7_MB_(78.51%)
+// #Top_Interview_150_Hashmap #2022_10_19_Time_261_ms_(45.08%)_Space_33.7_MB_(78.51%)
class Solution {
private val set = mutableSetOf()
diff --git a/src/main/kotlin/g0201_0300/s0205_isomorphic_strings/Solution.kt b/src/main/kotlin/g0201_0300/s0205_isomorphic_strings/Solution.kt
index e547881ce..1e00d8e9d 100644
--- a/src/main/kotlin/g0201_0300/s0205_isomorphic_strings/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0205_isomorphic_strings/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0205_isomorphic_strings
-// #Easy #String #Hash_Table #Level_1_Day_2_String
+// #Easy #String #Hash_Table #Level_1_Day_2_String #Top_Interview_150_Hashmap
// #2022_10_20_Time_278_ms_(79.96%)_Space_37.7_MB_(72.52%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt b/src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt
index c0c3fd21f..53843930a 100644
--- a/src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0206_reverse_linked_list/Solution.kt
@@ -1,9 +1,9 @@
package g0201_0300.s0206_reverse_linked_list
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Linked_List #Recursion
-// #Data_Structure_I_Day_8_Linked_List #Algorithm_I_Day_10_Recursion_Backtracking
-// #Level_1_Day_3_Linked_List #Udemy_Linked_List
-// #2022_09_27_Time_279_ms_(45.78%)_Space_36.2_MB_(49.40%)
+// #LeetCode_75_LinkedList #Data_Structure_I_Day_8_Linked_List
+// #Algorithm_I_Day_10_Recursion_Backtracking #Level_1_Day_3_Linked_List #Udemy_Linked_List
+// #Big_O_Time_O(N)_Space_O(1) #2022_09_27_Time_279_ms_(45.78%)_Space_36.2_MB_(49.40%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0201_0300/s0207_course_schedule/Solution.kt b/src/main/kotlin/g0201_0300/s0207_course_schedule/Solution.kt
index 356d68570..694d90bdb 100644
--- a/src/main/kotlin/g0201_0300/s0207_course_schedule/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0207_course_schedule/Solution.kt
@@ -1,30 +1,27 @@
package g0201_0300.s0207_course_schedule
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Depth_First_Search
-// #Breadth_First_Search #Graph #Topological_Sort
-// #2022_09_09_Time_416_ms_(40.10%)_Space_48.5_MB_(75.40%)
+// #Breadth_First_Search #Graph #Topological_Sort #Top_Interview_150_Graph_General
+// #Big_O_Time_O(N)_Space_O(N) #2024_01_16_Time_183_ms_(92.07%)_Space_39.1_MB_(81.50%)
class Solution {
fun canFinish(numCourses: Int, prerequisites: Array): Boolean {
- val adj: Array?> = arrayOfNulls>(numCourses)
- for (i in 0 until numCourses) {
- adj[i] = ArrayList()
- }
+ val adj: Array> = Array(numCourses) { ArrayList() }
for (pre in prerequisites) {
- adj[pre[1]]?.add(pre[0])
+ adj[pre[1]].add(pre[0])
}
val colors = IntArray(numCourses)
for (i in 0 until numCourses) {
- if (colors[i] == WHITE && !adj[i]?.isEmpty()!! && hasCycle(adj, i, colors)) {
+ if (colors[i] == WHITE && adj[i].isNotEmpty() && hasCycle(adj, i, colors)) {
return false
}
}
return true
}
- private fun hasCycle(adj: Array?>, node: Int, colors: IntArray): Boolean {
+ private fun hasCycle(adj: Array>, node: Int, colors: IntArray): Boolean {
colors[node] = GRAY
- for (nei in adj[node]!!) {
+ for (nei in adj[node]) {
if (colors[nei] == GRAY) {
return true
}
diff --git a/src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt b/src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt
index 421febf43..66a9c5725 100644
--- a/src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt
+++ b/src/main/kotlin/g0201_0300/s0208_implement_trie_prefix_tree/Trie.kt
@@ -1,7 +1,8 @@
package g0201_0300.s0208_implement_trie_prefix_tree
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #String #Hash_Table #Design #Trie
-// #Level_2_Day_16_Design #Udemy_Trie_and_Heap
+// #LeetCode_75_Trie #Level_2_Day_16_Design #Udemy_Trie_and_Heap #Top_Interview_150_Trie
+// #Big_O_Time_O(word.length())_or_O(prefix.length())_Space_O(N)
// #2022_09_10_Time_689_ms_(61.00%)_Space_87.9_MB_(36.00%)
class Trie {
@@ -61,3 +62,11 @@ class Trie {
root = TrieNode()
}
}
+
+/*
+ * Your Trie object will be instantiated and called as such:
+ * var obj = Trie()
+ * obj.insert(word)
+ * var param_2 = obj.search(word)
+ * var param_3 = obj.startsWith(prefix)
+ */
diff --git a/src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt b/src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt
index 9b1b481bd..7b9d18330 100644
--- a/src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0209_minimum_size_subarray_sum/Solution.kt
@@ -1,7 +1,8 @@
package g0201_0300.s0209_minimum_size_subarray_sum
// #Medium #Array #Binary_Search #Prefix_Sum #Sliding_Window #Algorithm_II_Day_5_Sliding_Window
-// #Binary_Search_II_Day_1 #2022_10_20_Time_315_ms_(96.73%)_Space_46.7_MB_(90.20%)
+// #Binary_Search_II_Day_1 #Top_Interview_150_Sliding_Window
+// #2022_10_20_Time_315_ms_(96.73%)_Space_46.7_MB_(90.20%)
class Solution {
fun minSubArrayLen(s: Int, nums: IntArray): Int {
diff --git a/src/main/kotlin/g0201_0300/s0210_course_schedule_ii/Solution.kt b/src/main/kotlin/g0201_0300/s0210_course_schedule_ii/Solution.kt
index 871371fa6..90dd74162 100644
--- a/src/main/kotlin/g0201_0300/s0210_course_schedule_ii/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0210_course_schedule_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0210_course_schedule_ii
// #Medium #Top_Interview_Questions #Depth_First_Search #Breadth_First_Search #Graph
-// #Topological_Sort #Level_2_Day_11_Graph/BFS/DFS
+// #Topological_Sort #Level_2_Day_11_Graph/BFS/DFS #Top_Interview_150_Graph_General
// #2022_10_20_Time_266_ms_(96.32%)_Space_45.9_MB_(92.65%)
class Solution {
@@ -34,7 +34,7 @@ class Solution {
private fun buildGraph(
numCourses: Int,
prerequisites: Array,
- indegrees: IntArray
+ indegrees: IntArray,
): List> {
val graph = List(numCourses) { mutableListOf() }
for ((cur, prev) in prerequisites) {
diff --git a/src/main/kotlin/g0201_0300/s0211_design_add_and_search_words_data_structure/WordDictionary.kt b/src/main/kotlin/g0201_0300/s0211_design_add_and_search_words_data_structure/WordDictionary.kt
index 2c001452e..ddc122874 100644
--- a/src/main/kotlin/g0201_0300/s0211_design_add_and_search_words_data_structure/WordDictionary.kt
+++ b/src/main/kotlin/g0201_0300/s0211_design_add_and_search_words_data_structure/WordDictionary.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0211_design_add_and_search_words_data_structure
-// #Medium #String #Depth_First_Search #Design #Trie
+// #Medium #String #Depth_First_Search #Design #Trie #Top_Interview_150_Trie
// #2022_10_24_Time_2256_ms_(87.04%)_Space_237.4_MB_(83.33%)
class WordDictionary {
diff --git a/src/main/kotlin/g0201_0300/s0212_word_search_ii/Solution.kt b/src/main/kotlin/g0201_0300/s0212_word_search_ii/Solution.kt
index 52cfa70b8..8ca3f24f0 100644
--- a/src/main/kotlin/g0201_0300/s0212_word_search_ii/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0212_word_search_ii/Solution.kt
@@ -1,18 +1,19 @@
package g0201_0300.s0212_word_search_ii
-// #Hard #Top_Interview_Questions #Array #String #Matrix #Backtracking #Trie
+// #Hard #Top_Interview_Questions #Array #String #Matrix #Backtracking #Trie #Top_Interview_150_Trie
// #2022_10_24_Time_268_ms_(100.00%)_Space_37.5_MB_(95.08%)
@Suppress("NAME_SHADOWING")
class Solution {
private var root: Tree? = null
- fun findWords(board: Array, words: Array): List {
- if (board.size < 1 || board[0].size < 1) {
+
+ fun findWords(board: Array, words: Array): List {
+ if (board.isEmpty() || board[0].isEmpty()) {
return emptyList()
}
root = Tree()
for (word in words) {
- Tree.addWord(root, word!!)
+ Tree.addWord(root, word)
}
val collected: MutableList = ArrayList()
for (i in board.indices) {
diff --git a/src/main/kotlin/g0201_0300/s0215_kth_largest_element_in_an_array/Solution.kt b/src/main/kotlin/g0201_0300/s0215_kth_largest_element_in_an_array/Solution.kt
index 205748851..afc7a88fc 100644
--- a/src/main/kotlin/g0201_0300/s0215_kth_largest_element_in_an_array/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0215_kth_largest_element_in_an_array/Solution.kt
@@ -1,8 +1,9 @@
package g0201_0300.s0215_kth_largest_element_in_an_array
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Sorting #Heap_Priority_Queue
-// #Divide_and_Conquer #Quickselect #Data_Structure_II_Day_20_Heap_Priority_Queue
-// #2022_09_10_Time_839_ms_(34.43%)_Space_72.5_MB_(26.95%)
+// #Divide_and_Conquer #Quickselect #LeetCode_75_Heap/Priority_Queue
+// #Data_Structure_II_Day_20_Heap_Priority_Queue #Top_Interview_150_Heap
+// #Big_O_Time_O(n*log(n))_Space_O(log(n)) #2022_09_10_Time_839_ms_(34.43%)_Space_72.5_MB_(26.95%)
class Solution {
fun findKthLargest(nums: IntArray, k: Int): Int {
diff --git a/src/main/kotlin/g0201_0300/s0216_combination_sum_iii/Solution.kt b/src/main/kotlin/g0201_0300/s0216_combination_sum_iii/Solution.kt
index eaf4c827f..50699e392 100644
--- a/src/main/kotlin/g0201_0300/s0216_combination_sum_iii/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0216_combination_sum_iii/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0216_combination_sum_iii
-// #Medium #Array #Backtracking #Udemy_Backtracking/Recursion
+// #Medium #Array #Backtracking #LeetCode_75_Backtracking #Udemy_Backtracking/Recursion
// #2022_10_25_Time_175_ms_(90.91%)_Space_34.4_MB_(72.73%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0218_the_skyline_problem/Solution.kt b/src/main/kotlin/g0201_0300/s0218_the_skyline_problem/Solution.kt
index 34b06c13a..f791b6207 100644
--- a/src/main/kotlin/g0201_0300/s0218_the_skyline_problem/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0218_the_skyline_problem/Solution.kt
@@ -1,8 +1,7 @@
package g0201_0300.s0218_the_skyline_problem
-// #Hard #Top_Interview_Questions #Array #Heap_Priority_Queue #Ordered_Set #Divide_and_Conquer
-// #Segment_Tree #Binary_Indexed_Tree #Line_Sweep
-// #2022_10_25_Time_365_ms_(93.14%)_Space_45.7_MB_(93.71%)
+// #Hard #Array #Heap_Priority_Queue #Ordered_Set #Divide_and_Conquer #Segment_Tree
+// #Binary_Indexed_Tree #Line_Sweep #2025_03_29_Time_50_ms_(100.00%)_Space_63.12_MB_(10.53%)
import java.util.TreeMap
@@ -13,21 +12,18 @@ class Solution {
return ans
}
val totalBuildings = blds.size
- val buildings = Array(totalBuildings * 2) { null }
- var idx = 0
- for (building in blds) {
- buildings[idx] = Building(building[0], building[2], true)
- buildings[idx + 1] = Building(building[1], building[2], false)
- idx += 2
+ val buildings = Array(totalBuildings * 2) { i ->
+ if (i % 2 == 0) {
+ Building(blds[i / 2][0], blds[i / 2][2], true)
+ } else {
+ Building(blds[i / 2][1], blds[i / 2][2], false)
+ }
}
buildings.sort()
val skyline = TreeMap()
skyline[0] = 1
var prevMaxHeight = 0
for (building in buildings) {
- if (building == null) {
- continue
- }
val height = building.height
if (building.isStart) {
skyline[height] = 1 + (skyline[height] ?: 0)
diff --git a/src/main/kotlin/g0201_0300/s0219_contains_duplicate_ii/Solution.kt b/src/main/kotlin/g0201_0300/s0219_contains_duplicate_ii/Solution.kt
index ad15ed8f3..44120aa17 100644
--- a/src/main/kotlin/g0201_0300/s0219_contains_duplicate_ii/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0219_contains_duplicate_ii/Solution.kt
@@ -1,6 +1,7 @@
package g0201_0300.s0219_contains_duplicate_ii
-// #Easy #Array #Hash_Table #Sliding_Window #2022_10_25_Time_813_ms_(80.46%)_Space_71.1_MB_(81.22%)
+// #Easy #Array #Hash_Table #Sliding_Window #Top_Interview_150_Hashmap
+// #2022_10_25_Time_813_ms_(80.46%)_Space_71.1_MB_(81.22%)
class Solution {
fun containsNearbyDuplicate(nums: IntArray, k: Int): Boolean {
diff --git a/src/main/kotlin/g0201_0300/s0220_contains_duplicate_iii/Solution.kt b/src/main/kotlin/g0201_0300/s0220_contains_duplicate_iii/Solution.kt
index 2007cba61..5cf88c1b0 100644
--- a/src/main/kotlin/g0201_0300/s0220_contains_duplicate_iii/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0220_contains_duplicate_iii/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0220_contains_duplicate_iii
-// #Medium #Array #Sorting #Sliding_Window #Ordered_Set #Bucket_Sort
+// #Hard #Array #Sorting #Sliding_Window #Ordered_Set #Bucket_Sort
// #2022_10_25_Time_921_ms_(72.22%)_Space_77.4_MB_(41.67%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0221_maximal_square/Solution.kt b/src/main/kotlin/g0201_0300/s0221_maximal_square/Solution.kt
index 3a8b91e40..a0888f38f 100644
--- a/src/main/kotlin/g0201_0300/s0221_maximal_square/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0221_maximal_square/Solution.kt
@@ -1,7 +1,8 @@
package g0201_0300.s0221_maximal_square
-// #Medium #Top_100_Liked_Questions #Array #Dynamic_Programming #Matrix
-// #Dynamic_Programming_I_Day_16 #2022_09_10_Time_614_ms_(44.00%)_Space_76.2_MB_(65.33%)
+// #Medium #Array #Dynamic_Programming #Matrix #Dynamic_Programming_I_Day_16
+// #Top_Interview_150_Multidimensional_DP #Big_O_Time_O(m*n)_Space_O(m*n)
+// #2022_09_10_Time_614_ms_(44.00%)_Space_76.2_MB_(65.33%)
class Solution {
fun maximalSquare(matrix: Array): Int {
diff --git a/src/main/kotlin/g0201_0300/s0222_count_complete_tree_nodes/Solution.kt b/src/main/kotlin/g0201_0300/s0222_count_complete_tree_nodes/Solution.kt
index 399668032..fd2f29e2c 100644
--- a/src/main/kotlin/g0201_0300/s0222_count_complete_tree_nodes/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0222_count_complete_tree_nodes/Solution.kt
@@ -1,5 +1,8 @@
package g0201_0300.s0222_count_complete_tree_nodes
+// #Easy #Depth_First_Search #Tree #Binary_Search #Binary_Tree #Binary_Search_II_Day_10
+// #Top_Interview_150_Binary_Tree_General #2025_02_08_Time_0_ms_(100.00%)_Space_41.04_MB_(43.09%)
+
import com_github_leetcode.TreeNode
/*
@@ -30,12 +33,16 @@ class Solution {
private fun leftHeight(root: TreeNode?): Int {
return if (root == null) {
0
- } else 1 + leftHeight(root.left)
+ } else {
+ 1 + leftHeight(root.left)
+ }
}
private fun rightHeight(root: TreeNode?): Int {
return if (root == null) {
0
- } else 1 + rightHeight(root.right)
+ } else {
+ 1 + rightHeight(root.right)
+ }
}
}
diff --git a/src/main/kotlin/g0201_0300/s0224_basic_calculator/Solution.kt b/src/main/kotlin/g0201_0300/s0224_basic_calculator/Solution.kt
index 0e9a5b138..5c7a880b0 100644
--- a/src/main/kotlin/g0201_0300/s0224_basic_calculator/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0224_basic_calculator/Solution.kt
@@ -1,6 +1,7 @@
package g0201_0300.s0224_basic_calculator
-// #Hard #String #Math #Stack #Recursion #2022_10_25_Time_294_ms_(93.33%)_Space_40.3_MB_(90.00%)
+// #Hard #String #Math #Stack #Recursion #Top_Interview_150_Stack
+// #2022_10_25_Time_294_ms_(93.33%)_Space_40.3_MB_(90.00%)
class Solution {
private var i = 0
diff --git a/src/main/kotlin/g0201_0300/s0225_implement_stack_using_queues/MyStack.kt b/src/main/kotlin/g0201_0300/s0225_implement_stack_using_queues/MyStack.kt
index 9e006d86c..5893a2c1c 100644
--- a/src/main/kotlin/g0201_0300/s0225_implement_stack_using_queues/MyStack.kt
+++ b/src/main/kotlin/g0201_0300/s0225_implement_stack_using_queues/MyStack.kt
@@ -1,66 +1,43 @@
package g0201_0300.s0225_implement_stack_using_queues
-// #Easy #Stack #Design #Queue #2022_10_26_Time_248_ms_(73.44%)_Space_36.1_MB_(43.75%)
+// #Easy #Stack #Design #Queue #2024_08_17_Time_147_ms_(88.57%)_Space_35.9_MB_(87.62%)
import java.util.LinkedList
+import java.util.Queue
-class MyStack {
- private var queuePair = Pair(LinkedList(), LinkedList())
- private var top: Int? = null
+class MyStack() {
+ private val queue1: Queue = LinkedList()
+ private val queue2: Queue = LinkedList()
fun push(x: Int) {
- queuePair.first.addLast(x)
- top = x
+ queue1.add(x)
}
fun pop(): Int {
- if (isQueuesEmpty()) {
- throw Exception()
+ while (queue1.size > 1) {
+ queue2.add(queue1.remove())
}
- val queuePair = selectSourceAndDestinationQueues(queuePair)
- var value = 0
- repeat(queuePair.first.size) {
- when (queuePair.first.size) {
- 2 -> {
- top = queuePair.first.removeFirst()
- queuePair.second.addLast(top)
- }
- 1 -> {
- value = queuePair.first.removeFirst()
- }
- else -> {
- queuePair.second.addLast(queuePair.first.removeFirst())
- }
- }
- }
- return value
+ val top = queue1.remove()
+ queue1.clear()
+ queue1.addAll(queue2)
+ queue2.clear()
+ return top
}
fun top(): Int {
- if (isQueuesEmpty()) {
- throw Exception()
+ while (queue1.size > 1) {
+ queue2.add(queue1.remove())
}
- return top!!
+ val top = queue1.remove()
+ queue2.add(top)
+ queue1.clear()
+ queue1.addAll(queue2)
+ queue2.clear()
+ return top
}
fun empty(): Boolean {
- return isQueuesEmpty()
- }
-
- private fun isQueuesEmpty(): Boolean {
- if (queuePair.first.isEmpty() && queuePair.second.isEmpty()) {
- return true
- }
- return false
- }
-
- private fun selectSourceAndDestinationQueues(queuePair: Pair, LinkedList>):
- Pair, LinkedList> {
- return if (queuePair.first.isNotEmpty()) {
- Pair(queuePair.first, queuePair.second)
- } else {
- Pair(queuePair.second, queuePair.first)
- }
+ return queue1.isEmpty()
}
}
diff --git a/src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt b/src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt
index d3da6e0ec..13863da26 100644
--- a/src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0226_invert_binary_tree/Solution.kt
@@ -2,6 +2,7 @@ package g0201_0300.s0226_invert_binary_tree
// #Easy #Top_100_Liked_Questions #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree
// #Data_Structure_I_Day_12_Tree #Level_2_Day_6_Tree #Udemy_Tree_Stack_Queue
+// #Top_Interview_150_Binary_Tree_General #Big_O_Time_O(n)_Space_O(n)
// #2022_09_27_Time_233_ms_(54.90%)_Space_34.5_MB_(11.33%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0201_0300/s0227_basic_calculator_ii/Solution.kt b/src/main/kotlin/g0201_0300/s0227_basic_calculator_ii/Solution.kt
index 150cfc00b..27e00d159 100644
--- a/src/main/kotlin/g0201_0300/s0227_basic_calculator_ii/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0227_basic_calculator_ii/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0227_basic_calculator_ii
-// #Medium #Top_Interview_Questions #String #Math #Stack #Level_2_Day_18_Stack
+// #Medium #String #Math #Stack #Level_2_Day_18_Stack
// #2022_10_26_Time_383_ms_(62.50%)_Space_39.5_MB_(83.33%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0228_summary_ranges/Solution.kt b/src/main/kotlin/g0201_0300/s0228_summary_ranges/Solution.kt
index 1a1b340a0..d3dbc8e65 100644
--- a/src/main/kotlin/g0201_0300/s0228_summary_ranges/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0228_summary_ranges/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0228_summary_ranges
-// #Easy #Array #2022_10_26_Time_169_ms_(91.89%)_Space_34_MB_(95.95%)
+// #Easy #Array #Top_Interview_150_Intervals #2022_10_26_Time_169_ms_(91.89%)_Space_34_MB_(95.95%)
class Solution {
fun summaryRanges(nums: IntArray): List {
diff --git a/src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt b/src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt
index a00f24b50..9108b9b26 100644
--- a/src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0230_kth_smallest_element_in_a_bst/Solution.kt
@@ -1,7 +1,8 @@
package g0201_0300.s0230_kth_smallest_element_in_a_bst
-// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Depth_First_Search #Tree #Binary_Tree
-// #Binary_Search_Tree #Data_Structure_II_Day_17_Tree #Level_2_Day_9_Binary_Search_Tree
+// #Medium #Top_100_Liked_Questions #Depth_First_Search #Tree #Binary_Tree #Binary_Search_Tree
+// #Data_Structure_II_Day_17_Tree #Level_2_Day_9_Binary_Search_Tree
+// #Top_Interview_150_Binary_Search_Tree #Big_O_Time_O(n)_Space_O(n)
// #2022_09_10_Time_393_ms_(33.33%)_Space_41.8_MB_(66.67%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0201_0300/s0234_palindrome_linked_list/Solution.kt b/src/main/kotlin/g0201_0300/s0234_palindrome_linked_list/Solution.kt
index d6668b876..cfac91f76 100644
--- a/src/main/kotlin/g0201_0300/s0234_palindrome_linked_list/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0234_palindrome_linked_list/Solution.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0234_palindrome_linked_list
-// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Two_Pointers #Stack #Linked_List
-// #Recursion #Level_2_Day_3_Linked_List #Udemy_Linked_List
+// #Easy #Top_100_Liked_Questions #Two_Pointers #Stack #Linked_List #Recursion
+// #Level_2_Day_3_Linked_List #Udemy_Linked_List #Big_O_Time_O(n)_Space_O(1)
// #2022_09_18_Time_641_ms_(79.53%)_Space_80.9_MB_(58.23%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0201_0300/s0235_lowest_common_ancestor_of_a_binary_search_tree/Solution.kt b/src/main/kotlin/g0201_0300/s0235_lowest_common_ancestor_of_a_binary_search_tree/Solution.kt
index 1b11d8972..7990ffdd6 100644
--- a/src/main/kotlin/g0201_0300/s0235_lowest_common_ancestor_of_a_binary_search_tree/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0235_lowest_common_ancestor_of_a_binary_search_tree/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0235_lowest_common_ancestor_of_a_binary_search_tree
-// #Easy #Depth_First_Search #Tree #Binary_Tree #Binary_Search_Tree #Data_Structure_I_Day_14_Tree
+// #Medium #Depth_First_Search #Tree #Binary_Tree #Binary_Search_Tree #Data_Structure_I_Day_14_Tree
// #Level_1_Day_8_Binary_Search_Tree #2022_10_26_Time_404_ms_(75.59%)_Space_46.1_MB_(78.74%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt b/src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt
index 0f04a5e62..b104864c2 100644
--- a/src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.kt
@@ -1,7 +1,8 @@
package g0201_0300.s0236_lowest_common_ancestor_of_a_binary_tree
-// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Depth_First_Search #Tree #Binary_Tree
-// #Data_Structure_II_Day_18_Tree #Udemy_Tree_Stack_Queue
+// #Medium #Top_100_Liked_Questions #Depth_First_Search #Tree #Binary_Tree
+// #LeetCode_75_Binary_Tree/DFS #Data_Structure_II_Day_18_Tree #Udemy_Tree_Stack_Queue
+// #Top_Interview_150_Binary_Tree_General #Big_O_Time_O(n)_Space_O(n)
// #2022_09_10_Time_386_ms_(45.21%)_Space_43.9_MB_(81.65%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0201_0300/s0237_delete_node_in_a_linked_list/Solution.kt b/src/main/kotlin/g0201_0300/s0237_delete_node_in_a_linked_list/Solution.kt
index 9396af9fb..1942616a9 100644
--- a/src/main/kotlin/g0201_0300/s0237_delete_node_in_a_linked_list/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0237_delete_node_in_a_linked_list/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0237_delete_node_in_a_linked_list
-// #Easy #Top_Interview_Questions #Linked_List #2022_10_27_Time_183_ms_(93.00%)_Space_35_MB_(95.19%)
+// #Medium #Linked_List #2022_10_27_Time_183_ms_(93.00%)_Space_35_MB_(95.19%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt b/src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt
index b6e28493a..f4d01ea2b 100644
--- a/src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0238_product_of_array_except_self/Solution.kt
@@ -1,8 +1,8 @@
package g0201_0300.s0238_product_of_array_except_self
-// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Prefix_Sum
-// #Data_Structure_II_Day_5_Array #Udemy_Arrays
-// #2022_09_10_Time_669_ms_(48.96%)_Space_69_MB_(86.94%)
+// #Medium #Top_100_Liked_Questions #Array #Prefix_Sum #LeetCode_75_Array/String
+// #Data_Structure_II_Day_5_Array #Udemy_Arrays #Top_Interview_150_Array/String
+// #Big_O_Time_O(n^2)_Space_O(n) #2022_09_10_Time_669_ms_(48.96%)_Space_69_MB_(86.94%)
class Solution {
fun productExceptSelf(nums: IntArray): IntArray {
diff --git a/src/main/kotlin/g0201_0300/s0239_sliding_window_maximum/Solution.kt b/src/main/kotlin/g0201_0300/s0239_sliding_window_maximum/Solution.kt
index 9e197182f..444a3f74f 100644
--- a/src/main/kotlin/g0201_0300/s0239_sliding_window_maximum/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0239_sliding_window_maximum/Solution.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0239_sliding_window_maximum
-// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Array #Heap_Priority_Queue
-// #Sliding_Window #Queue #Monotonic_Queue #Udemy_Arrays
+// #Hard #Top_100_Liked_Questions #Array #Heap_Priority_Queue #Sliding_Window #Queue
+// #Monotonic_Queue #Udemy_Arrays #Big_O_Time_O(n*k)_Space_O(n+k)
// #2022_09_10_Time_1059_ms_(86.14%)_Space_113.7_MB_(65.35%)
import java.util.LinkedList
diff --git a/src/main/kotlin/g0201_0300/s0240_search_a_2d_matrix_ii/Solution.kt b/src/main/kotlin/g0201_0300/s0240_search_a_2d_matrix_ii/Solution.kt
index 4f09075de..abcbfa4a6 100644
--- a/src/main/kotlin/g0201_0300/s0240_search_a_2d_matrix_ii/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0240_search_a_2d_matrix_ii/Solution.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0240_search_a_2d_matrix_ii
-// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Binary_Search #Matrix
-// #Divide_and_Conquer #Data_Structure_II_Day_4_Array #Binary_Search_II_Day_8
+// #Medium #Top_100_Liked_Questions #Array #Binary_Search #Matrix #Divide_and_Conquer
+// #Data_Structure_II_Day_4_Array #Binary_Search_II_Day_8 #Big_O_Time_O(n+m)_Space_O(1)
// #2022_09_10_Time_460_ms_(66.08%)_Space_55.9_MB_(65.19%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt b/src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt
index 87cf0b646..969148b3f 100644
--- a/src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0242_valid_anagram
-// #Easy #Top_Interview_Questions #String #Hash_Table #Sorting #Data_Structure_I_Day_6_String
-// #Programming_Skills_I_Day_11_Containers_and_Libraries #Udemy_Strings
+// #Easy #String #Hash_Table #Sorting #Data_Structure_I_Day_6_String
+// #Programming_Skills_I_Day_11_Containers_and_Libraries #Udemy_Strings #Top_Interview_150_Hashmap
// #2022_10_27_Time_251_ms_(87.65%)_Space_39.1_MB_(69.49%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0258_add_digits/Solution.kt b/src/main/kotlin/g0201_0300/s0258_add_digits/Solution.kt
index cdfffaf49..9ba8be40c 100644
--- a/src/main/kotlin/g0201_0300/s0258_add_digits/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0258_add_digits/Solution.kt
@@ -9,6 +9,8 @@ class Solution {
}
return if (num % 9 == 0) {
9
- } else num % 9
+ } else {
+ num % 9
+ }
}
}
diff --git a/src/main/kotlin/g0201_0300/s0268_missing_number/Solution.kt b/src/main/kotlin/g0201_0300/s0268_missing_number/Solution.kt
index 4604a4757..2ef039786 100644
--- a/src/main/kotlin/g0201_0300/s0268_missing_number/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0268_missing_number/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0268_missing_number
-// #Easy #Top_Interview_Questions #Array #Hash_Table #Math #Sorting #Binary_Search #Bit_Manipulation
+// #Easy #Array #Hash_Table #Math #Sorting #Binary_Search #Bit_Manipulation
// #2022_11_03_Time_380_ms_(83.49%)_Space_48.6_MB_(76.76%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0273_integer_to_english_words/Solution.kt b/src/main/kotlin/g0201_0300/s0273_integer_to_english_words/Solution.kt
index 1c2799707..903de826f 100644
--- a/src/main/kotlin/g0201_0300/s0273_integer_to_english_words/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0273_integer_to_english_words/Solution.kt
@@ -7,7 +7,7 @@ import java.util.StringJoiner
class Solution {
private val ones = arrayOf(
- "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine "
+ "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ",
)
private val teens = arrayOf(
"Ten ",
@@ -19,10 +19,17 @@ class Solution {
"Sixteen ",
"Seventeen ",
"Eighteen ",
- "Nineteen "
+ "Nineteen ",
)
private val twenties = arrayOf(
- "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety "
+ "Twenty ",
+ "Thirty ",
+ "Forty ",
+ "Fifty ",
+ "Sixty ",
+ "Seventy ",
+ "Eighty ",
+ "Ninety ",
)
fun numberToWords(num: Int): String {
diff --git a/src/main/kotlin/g0201_0300/s0274_h_index/Solution.kt b/src/main/kotlin/g0201_0300/s0274_h_index/Solution.kt
index 1088cce50..5075bfd1f 100644
--- a/src/main/kotlin/g0201_0300/s0274_h_index/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0274_h_index/Solution.kt
@@ -1,6 +1,7 @@
package g0201_0300.s0274_h_index
-// #Medium #Array #Sorting #Counting_Sort #2022_11_04_Time_291_ms_(45.45%)_Space_34.7_MB_(100.00%)
+// #Medium #Array #Sorting #Counting_Sort #Top_Interview_150_Array/String
+// #2022_11_04_Time_291_ms_(45.45%)_Space_34.7_MB_(100.00%)
class Solution {
fun hIndex(citations: IntArray): Int {
diff --git a/src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt b/src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt
index 7c0d1e86c..b0dccb88b 100644
--- a/src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0279_perfect_squares
-// #Medium #Top_Interview_Questions #Dynamic_Programming #Math #Breadth_First_Search
-// #Dynamic_Programming_I_Day_21 #2022_11_03_Time_176_ms_(98.80%)_Space_33.3_MB_(98.80%)
+// #Medium #Dynamic_Programming #Math #Breadth_First_Search #Dynamic_Programming_I_Day_21
+// #2022_11_03_Time_176_ms_(98.80%)_Space_33.3_MB_(98.80%)
@Suppress("NAME_SHADOWING")
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0282_expression_add_operators/Solution.kt b/src/main/kotlin/g0201_0300/s0282_expression_add_operators/Solution.kt
index 9bf6514f8..f5c97835f 100644
--- a/src/main/kotlin/g0201_0300/s0282_expression_add_operators/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0282_expression_add_operators/Solution.kt
@@ -24,7 +24,7 @@ class Solution {
`val`: Int,
mul: Int,
preOp: Char,
- join: Int
+ join: Int,
) {
var j = j
arr[j++] = list[i]
diff --git a/src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt b/src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt
index aa3cf71a9..fe0fa1220 100644
--- a/src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt
@@ -1,8 +1,8 @@
package g0201_0300.s0283_move_zeroes
-// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Two_Pointers
+// #Easy #Top_100_Liked_Questions #Array #Two_Pointers #LeetCode_75_Two_Pointers
// #Algorithm_I_Day_3_Two_Pointers #Programming_Skills_I_Day_6_Array #Udemy_Arrays
-// #2022_09_10_Time_516_ms_(79.07%)_Space_64.2_MB_(36.71%)
+// #Big_O_Time_O(n)_Space_O(1) #2022_09_10_Time_516_ms_(79.07%)_Space_64.2_MB_(36.71%)
class Solution {
fun moveZeroes(nums: IntArray) {
diff --git a/src/main/kotlin/g0201_0300/s0287_find_the_duplicate_number/Solution.kt b/src/main/kotlin/g0201_0300/s0287_find_the_duplicate_number/Solution.kt
index ed574d8f6..45d569873 100644
--- a/src/main/kotlin/g0201_0300/s0287_find_the_duplicate_number/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0287_find_the_duplicate_number/Solution.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0287_find_the_duplicate_number
-// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Binary_Search #Two_Pointers
-// #Bit_Manipulation #Binary_Search_II_Day_5
+// #Medium #Top_100_Liked_Questions #Array #Binary_Search #Two_Pointers #Bit_Manipulation
+// #Binary_Search_II_Day_5 #Big_O_Time_O(n)_Space_O(n)
// #2022_09_10_Time_656_ms_(66.21%)_Space_78.6_MB_(66.89%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0289_game_of_life/Solution.kt b/src/main/kotlin/g0201_0300/s0289_game_of_life/Solution.kt
index 3ac14e378..4195012f4 100644
--- a/src/main/kotlin/g0201_0300/s0289_game_of_life/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0289_game_of_life/Solution.kt
@@ -1,13 +1,19 @@
package g0201_0300.s0289_game_of_life
-// #Medium #Top_Interview_Questions #Array #Matrix #Simulation
+// #Medium #Array #Matrix #Simulation #Top_Interview_150_Matrix
// #2022_11_04_Time_174_ms_(96.97%)_Space_34.2_MB_(93.94%)
class Solution {
companion object {
var dim: Array = arrayOf(
- intArrayOf(1, 0), intArrayOf(0, 1), intArrayOf(-1, 0), intArrayOf(0, -1),
- intArrayOf(1, 1), intArrayOf(1, -1), intArrayOf(-1, 1), intArrayOf(-1, -1)
+ intArrayOf(1, 0),
+ intArrayOf(0, 1),
+ intArrayOf(-1, 0),
+ intArrayOf(0, -1),
+ intArrayOf(1, 1),
+ intArrayOf(1, -1),
+ intArrayOf(-1, 1),
+ intArrayOf(-1, -1),
)
}
@@ -41,7 +47,7 @@ class Solution {
}
private fun compute(board: Array, r: Int, c: Int): Int {
- var ret: Int = 0
+ var ret = 0
for (arr in dim) {
val row = arr[0] + r
val col = arr[1] + c
diff --git a/src/main/kotlin/g0201_0300/s0290_word_pattern/Solution.kt b/src/main/kotlin/g0201_0300/s0290_word_pattern/Solution.kt
index 997e9c0ca..5cb1f5b6d 100644
--- a/src/main/kotlin/g0201_0300/s0290_word_pattern/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0290_word_pattern/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0290_word_pattern
-// #Easy #String #Hash_Table #Data_Structure_II_Day_7_String
+// #Easy #String #Hash_Table #Data_Structure_II_Day_7_String #Top_Interview_150_Hashmap
// #2022_11_04_Time_177_ms_(89.55%)_Space_35.2_MB_(95.52%)
class Solution {
diff --git a/src/main/kotlin/g0201_0300/s0292_nim_game/Solution.kt b/src/main/kotlin/g0201_0300/s0292_nim_game/Solution.kt
index 352565c3d..1c5528b91 100644
--- a/src/main/kotlin/g0201_0300/s0292_nim_game/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0292_nim_game/Solution.kt
@@ -4,9 +4,6 @@ package g0201_0300.s0292_nim_game
class Solution {
fun canWinNim(n: Int): Boolean {
- if (n % 4 == 0) {
- return false
- }
- return true
+ return n % 4 != 0
}
}
diff --git a/src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/MedianFinder.kt b/src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/MedianFinder.kt
index d7213de1c..acd7bc13e 100644
--- a/src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/MedianFinder.kt
+++ b/src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/MedianFinder.kt
@@ -1,7 +1,8 @@
package g0201_0300.s0295_find_median_from_data_stream
-// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Sorting #Two_Pointers #Design
-// #Heap_Priority_Queue #Data_Stream #2022_09_11_Time_2289_ms_(33.60%)_Space_153.3_MB_(5.74%)
+// #Hard #Top_100_Liked_Questions #Sorting #Two_Pointers #Design #Heap_Priority_Queue #Data_Stream
+// #Top_Interview_150_Heap #Big_O_Time_O(n*log_n)_Space_O(n)
+// #2022_09_11_Time_2289_ms_(33.60%)_Space_153.3_MB_(5.74%)
import java.util.PriorityQueue
diff --git a/src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/readme.md b/src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/readme.md
index 9b3899f22..3928225f2 100644
--- a/src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/readme.md
+++ b/src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/readme.md
@@ -15,11 +15,21 @@ Implement the MedianFinder class:
**Example 1:**
-**Input** ["MedianFinder", "addNum", "addNum", "findMedian", "addNum", "findMedian"] [[], [1], [2], [], [3], []]
+**Input**
+
+ ["MedianFinder", "addNum", "addNum", "findMedian", "addNum", "findMedian"]
+ [[], [1], [2], [], [3], []]
**Output:** [null, null, null, 1.5, null, 2.0]
-**Explanation:** MedianFinder medianFinder = new MedianFinder(); medianFinder.addNum(1); // arr = [1] medianFinder.addNum(2); // arr = [1, 2] medianFinder.findMedian(); // return 1.5 (i.e., (1 + 2) / 2) medianFinder.addNum(3); // arr[1, 2, 3] medianFinder.findMedian(); // return 2.0
+**Explanation:**
+
+ MedianFinder medianFinder = new MedianFinder();
+ medianFinder.addNum(1); // arr = [1]
+ medianFinder.addNum(2); // arr = [1, 2]
+ medianFinder.findMedian(); // return 1.5 (i.e., (1 + 2) / 2)
+ medianFinder.addNum(3); // arr[1, 2, 3]
+ medianFinder.findMedian(); // return 2.0
**Constraints:**
diff --git a/src/main/kotlin/g0201_0300/s0297_serialize_and_deserialize_binary_tree/Codec.kt b/src/main/kotlin/g0201_0300/s0297_serialize_and_deserialize_binary_tree/Codec.kt
index 77b87fe4b..c8477a619 100644
--- a/src/main/kotlin/g0201_0300/s0297_serialize_and_deserialize_binary_tree/Codec.kt
+++ b/src/main/kotlin/g0201_0300/s0297_serialize_and_deserialize_binary_tree/Codec.kt
@@ -1,7 +1,7 @@
package g0201_0300.s0297_serialize_and_deserialize_binary_tree
-// #Hard #Top_Interview_Questions #String #Depth_First_Search #Breadth_First_Search #Tree
-// #Binary_Tree #Design #Data_Structure_II_Day_18_Tree #Udemy_Tree_Stack_Queue
+// #Hard #String #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree #Design
+// #Data_Structure_II_Day_18_Tree #Udemy_Tree_Stack_Queue
// #2022_11_06_Time_475_ms_(78.85%)_Space_50.3_MB_(64.42%)
import com_github_leetcode.TreeNode
@@ -50,7 +50,7 @@ class Codec {
return null
}
val root = TreeNode(
- data.substring(offset, offset + 3).toInt(16) - BASE_OFFSET
+ data.substring(offset, offset + 3).toInt(16) - BASE_OFFSET,
)
offset += 3
root.left = deserialize(data)
diff --git a/src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt b/src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt
index b004c1a3d..adf0f5b81 100644
--- a/src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0300_longest_increasing_subsequence/Solution.kt
@@ -1,8 +1,8 @@
package g0201_0300.s0300_longest_increasing_subsequence
-// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
-// #Binary_Search #Algorithm_II_Day_16_Dynamic_Programming #Binary_Search_II_Day_3
-// #Dynamic_Programming_I_Day_18 #Udemy_Dynamic_Programming
+// #Medium #Top_100_Liked_Questions #Array #Dynamic_Programming #Binary_Search
+// #Algorithm_II_Day_16_Dynamic_Programming #Binary_Search_II_Day_3 #Dynamic_Programming_I_Day_18
+// #Udemy_Dynamic_Programming #Top_Interview_150_1D_DP #Big_O_Time_O(n*log_n)_Space_O(n)
// #2022_09_11_Time_318_ms_(82.28%)_Space_39.2_MB_(82.77%)
class Solution {
diff --git a/src/main/kotlin/g0301_0400/s0303_range_sum_query_immutable/NumArray.kt b/src/main/kotlin/g0301_0400/s0303_range_sum_query_immutable/NumArray.kt
index b1ef0486e..47f22ac76 100644
--- a/src/main/kotlin/g0301_0400/s0303_range_sum_query_immutable/NumArray.kt
+++ b/src/main/kotlin/g0301_0400/s0303_range_sum_query_immutable/NumArray.kt
@@ -20,7 +20,9 @@ class NumArray(nums: IntArray) {
fun sumRange(i: Int, j: Int): Int {
return if (i == 0) {
sums[j]
- } else sums[j] - sums[i - 1]
+ } else {
+ sums[j] - sums[i - 1]
+ }
}
}
diff --git a/src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt b/src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt
index 6ab2c31de..8dcb63a00 100644
--- a/src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt
+++ b/src/main/kotlin/g0301_0400/s0304_range_sum_query_2d_immutable/NumMatrix.kt
@@ -5,14 +5,14 @@ package g0301_0400.s0304_range_sum_query_2d_immutable
// #2022_11_07_Time_1373_ms_(85.71%)_Space_129.1_MB_(75.00%)
class NumMatrix(matrix: Array) {
- private val M = matrix.size
- private val N = if (M > 0) matrix[0].size else 0
+ private val m = matrix.size
+ private val n = if (m > 0) matrix[0].size else 0
- var array = Array (M + 1) { IntArray(N + 1) }
+ var array = Array (m + 1) { IntArray(n + 1) }
init {
- for (i in 1..M) {
- for (j in 1..N) {
+ for (i in 1..m) {
+ for (j in 1..n) {
array[i][j] = matrix[i - 1][j - 1] + array[i][j - 1] + array[i - 1][j] - array[i - 1][j - 1]
}
}
diff --git a/src/main/kotlin/g0301_0400/s0310_minimum_height_trees/Solution.kt b/src/main/kotlin/g0301_0400/s0310_minimum_height_trees/Solution.kt
index a527c5590..eec550d73 100644
--- a/src/main/kotlin/g0301_0400/s0310_minimum_height_trees/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0310_minimum_height_trees/Solution.kt
@@ -18,7 +18,7 @@ class Solution {
while (queue.isNotEmpty()) {
val size = queue.size
val newLeaves = mutableListOf()
- for (_sz in 0 until size) {
+ for (sz in 0 until size) {
val cur = queue.removeFirst()
newLeaves.add(cur)
for (next in graph[cur]) {
diff --git a/src/main/kotlin/g0301_0400/s0312_burst_balloons/Solution.kt b/src/main/kotlin/g0301_0400/s0312_burst_balloons/Solution.kt
index 4f3dd5cc9..17239d91a 100644
--- a/src/main/kotlin/g0301_0400/s0312_burst_balloons/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0312_burst_balloons/Solution.kt
@@ -18,7 +18,7 @@ class Solution {
while (ei < nums.size) {
val l = if (si - 1 == -1) 1 else nums[si - 1]
val r = if (ei + 1 == nums.size) 1 else nums[ei + 1]
- var maxAns = -1e7.toInt()
+ var maxAns = (-1e7).toInt()
for (cut in si..ei) {
val leftAns = if (si == cut) 0 else dp[si][cut - 1]
val rightAns = if (ei == cut) 0 else dp[cut + 1][ei]
diff --git a/src/main/kotlin/g0301_0400/s0315_count_of_smaller_numbers_after_self/Solution.kt b/src/main/kotlin/g0301_0400/s0315_count_of_smaller_numbers_after_self/Solution.kt
index 4aec89112..6c1e44999 100644
--- a/src/main/kotlin/g0301_0400/s0315_count_of_smaller_numbers_after_self/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0315_count_of_smaller_numbers_after_self/Solution.kt
@@ -1,8 +1,7 @@
package g0301_0400.s0315_count_of_smaller_numbers_after_self
-// #Hard #Top_Interview_Questions #Array #Binary_Search #Ordered_Set #Divide_and_Conquer
-// #Segment_Tree #Binary_Indexed_Tree #Merge_Sort
-// #2022_11_10_Time_1282_ms_(88.46%)_Space_109.8_MB_(46.15%)
+// #Hard #Array #Binary_Search #Ordered_Set #Divide_and_Conquer #Segment_Tree #Binary_Indexed_Tree
+// #Merge_Sort #2022_11_10_Time_1282_ms_(88.46%)_Space_109.8_MB_(46.15%)
import java.util.LinkedList
diff --git a/src/main/kotlin/g0301_0400/s0319_bulb_switcher/Solution.kt b/src/main/kotlin/g0301_0400/s0319_bulb_switcher/Solution.kt
index 61ca64fba..37cddcb44 100644
--- a/src/main/kotlin/g0301_0400/s0319_bulb_switcher/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0319_bulb_switcher/Solution.kt
@@ -6,6 +6,8 @@ class Solution {
fun bulbSwitch(n: Int): Int {
return if (n < 2) {
n
- } else Math.sqrt(n.toDouble()).toInt()
+ } else {
+ Math.sqrt(n.toDouble()).toInt()
+ }
}
}
diff --git a/src/main/kotlin/g0301_0400/s0321_create_maximum_number/Solution.kt b/src/main/kotlin/g0301_0400/s0321_create_maximum_number/Solution.kt
index 3c45e9295..016a08afa 100644
--- a/src/main/kotlin/g0301_0400/s0321_create_maximum_number/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0321_create_maximum_number/Solution.kt
@@ -87,6 +87,8 @@ class Solution {
}
return if (equal && merge[k - 1] > res[k - 1]) {
merge
- } else res
+ } else {
+ res
+ }
}
}
diff --git a/src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt b/src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt
index 75b3a145a..5cad29afe 100644
--- a/src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0322_coin_change/Solution.kt
@@ -1,8 +1,9 @@
package g0301_0400.s0322_coin_change
-// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
-// #Breadth_First_Search #Algorithm_II_Day_18_Dynamic_Programming #Dynamic_Programming_I_Day_20
-// #Level_2_Day_12_Dynamic_Programming #2022_09_11_Time_332_ms_(50.68%)_Space_37.6_MB_(79.93%)
+// #Medium #Top_100_Liked_Questions #Array #Dynamic_Programming #Breadth_First_Search
+// #Algorithm_II_Day_18_Dynamic_Programming #Dynamic_Programming_I_Day_20
+// #Level_2_Day_12_Dynamic_Programming #Top_Interview_150_1D_DP #Big_O_Time_O(m*n)_Space_O(amount)
+// #2022_09_11_Time_332_ms_(50.68%)_Space_37.6_MB_(79.93%)
class Solution {
fun coinChange(coins: IntArray, amount: Int): Int {
diff --git a/src/main/kotlin/g0301_0400/s0324_wiggle_sort_ii/Solution.kt b/src/main/kotlin/g0301_0400/s0324_wiggle_sort_ii/Solution.kt
index ed8ed5e7e..4fc6c6728 100644
--- a/src/main/kotlin/g0301_0400/s0324_wiggle_sort_ii/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0324_wiggle_sort_ii/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0324_wiggle_sort_ii
-// #Medium #Top_Interview_Questions #Array #Sorting #Divide_and_Conquer #Quickselect
+// #Medium #Array #Sorting #Divide_and_Conquer #Quickselect
// #2022_11_12_Time_545_ms_(57.14%)_Space_57.1_MB_(57.14%)
class Solution {
diff --git a/src/main/kotlin/g0301_0400/s0326_power_of_three/Solution.kt b/src/main/kotlin/g0301_0400/s0326_power_of_three/Solution.kt
index 7b3e70bfc..1afedef0b 100644
--- a/src/main/kotlin/g0301_0400/s0326_power_of_three/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0326_power_of_three/Solution.kt
@@ -1,7 +1,6 @@
package g0301_0400.s0326_power_of_three
-// #Easy #Top_Interview_Questions #Math #Recursion
-// #2022_11_12_Time_413_ms_(76.12%)_Space_40.4_MB_(47.76%)
+// #Easy #Math #Recursion #2022_11_12_Time_413_ms_(76.12%)_Space_40.4_MB_(47.76%)
class Solution {
fun isPowerOfThree(n: Int): Boolean {
diff --git a/src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt b/src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt
index 43e6d1f32..b14003274 100644
--- a/src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0328_odd_even_linked_list
-// #Medium #Top_Interview_Questions #Linked_List #Level_2_Day_4_Linked_List #Udemy_Linked_List
+// #Medium #Linked_List #LeetCode_75_LinkedList #Level_2_Day_4_Linked_List #Udemy_Linked_List
// #2022_11_12_Time_216_ms_(86.96%)_Space_36.7_MB_(85.22%)
import com_github_leetcode.ListNode
diff --git a/src/main/kotlin/g0301_0400/s0329_longest_increasing_path_in_a_matrix/Solution.kt b/src/main/kotlin/g0301_0400/s0329_longest_increasing_path_in_a_matrix/Solution.kt
index c86227386..fcb9b2ab3 100644
--- a/src/main/kotlin/g0301_0400/s0329_longest_increasing_path_in_a_matrix/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0329_longest_increasing_path_in_a_matrix/Solution.kt
@@ -1,7 +1,7 @@
package g0301_0400.s0329_longest_increasing_path_in_a_matrix
-// #Hard #Top_Interview_Questions #Dynamic_Programming #Depth_First_Search #Breadth_First_Search
-// #Graph #Memoization #Topological_Sort #2022_11_12_Time_322_ms_(92.65%)_Space_39.2_MB_(100.00%)
+// #Hard #Dynamic_Programming #Depth_First_Search #Breadth_First_Search #Graph #Memoization
+// #Topological_Sort #2022_11_12_Time_322_ms_(92.65%)_Space_39.2_MB_(100.00%)
class Solution {
fun longestIncreasingPath(matrix: Array): Int {
diff --git a/src/main/kotlin/g0301_0400/s0334_increasing_triplet_subsequence/Solution.kt b/src/main/kotlin/g0301_0400/s0334_increasing_triplet_subsequence/Solution.kt
index 170b1fae5..1864d9fb6 100644
--- a/src/main/kotlin/g0301_0400/s0334_increasing_triplet_subsequence/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0334_increasing_triplet_subsequence/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0334_increasing_triplet_subsequence
-// #Medium #Top_Interview_Questions #Array #Greedy #Data_Structure_II_Day_5_Array
+// #Medium #Array #Greedy #LeetCode_75_Array/String #Data_Structure_II_Day_5_Array
// #2022_11_15_Time_672_ms_(60.61%)_Space_128.6_MB_(5.23%)
class Solution {
diff --git a/src/main/kotlin/g0301_0400/s0336_palindrome_pairs/Solution.kt b/src/main/kotlin/g0301_0400/s0336_palindrome_pairs/Solution.kt
index 63202c3fc..faa9fae6c 100644
--- a/src/main/kotlin/g0301_0400/s0336_palindrome_pairs/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0336_palindrome_pairs/Solution.kt
@@ -21,11 +21,13 @@ class Solution {
val curWord = words[idxCurWord]
val lenW = curWord.length
for (idxCh in curWord.indices) {
- if (cur!!.index >= 0 && cur.index != idxCurWord && isPalindrome(curWord, idxCh, lenW - 1))
+ if (cur!!.index >= 0 && cur.index != idxCurWord && isPalindrome(curWord, idxCh, lenW - 1)) {
res.add(listOf(idxCurWord, cur.index))
+ }
cur = cur.children[curWord[idxCh] - 'a']
- if (cur == null)
+ if (cur == null) {
return
+ }
}
for (idxPalin in cur!!.panlinIndicies) {
if (idxPalin == idxCurWord) continue
@@ -37,10 +39,12 @@ class Solution {
var cur: TrieNode? = root
for (idx in word.indices.reversed()) {
val idxCh = word[idx] - 'a'
- if (cur!!.children[idxCh] == null)
+ if (cur!!.children[idxCh] == null) {
cur.children[idxCh] = TrieNode()
- if (isPalindrome(word, 0, idx))
+ }
+ if (isPalindrome(word, 0, idx)) {
cur.panlinIndicies.add(index)
+ }
cur = cur.children[idxCh]
}
cur!!.panlinIndicies.add(index)
@@ -51,8 +55,9 @@ class Solution {
var lo = lo
var hi = hi
while (lo < hi) {
- if (word[lo] != word[hi])
+ if (word[lo] != word[hi]) {
return false
+ }
++lo
--hi
}
@@ -62,6 +67,6 @@ class Solution {
private data class TrieNode(
val children: Array = Array(26) { null },
var index: Int = -1,
- val panlinIndicies: MutableList = mutableListOf()
+ val panlinIndicies: MutableList = mutableListOf(),
)
}
diff --git a/src/main/kotlin/g0301_0400/s0338_counting_bits/Solution.kt b/src/main/kotlin/g0301_0400/s0338_counting_bits/Solution.kt
index 0d58a8bde..c0e3d42ac 100644
--- a/src/main/kotlin/g0301_0400/s0338_counting_bits/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0338_counting_bits/Solution.kt
@@ -1,6 +1,7 @@
package g0301_0400.s0338_counting_bits
-// #Easy #Top_100_Liked_Questions #Dynamic_Programming #Bit_Manipulation #Udemy_Bit_Manipulation
+// #Easy #Dynamic_Programming #Bit_Manipulation #LeetCode_75_Bit_Manipulation
+// #Udemy_Bit_Manipulation #Big_O_Time_O(num)_Space_O(num)
// #2022_09_27_Time_186_ms_(99.26%)_Space_38.8_MB_(89.71%)
class Solution {
diff --git a/src/main/kotlin/g0301_0400/s0341_flatten_nested_list_iterator/NestedIterator.kt b/src/main/kotlin/g0301_0400/s0341_flatten_nested_list_iterator/NestedIterator.kt
index f75cde0b7..4c504f948 100644
--- a/src/main/kotlin/g0301_0400/s0341_flatten_nested_list_iterator/NestedIterator.kt
+++ b/src/main/kotlin/g0301_0400/s0341_flatten_nested_list_iterator/NestedIterator.kt
@@ -1,7 +1,7 @@
package g0301_0400.s0341_flatten_nested_list_iterator
-// #Medium #Top_Interview_Questions #Depth_First_Search #Tree #Stack #Design #Queue #Iterator
-// #Programming_Skills_II_Day_18 #2022_11_25_Time_210_ms_(100.00%)_Space_37.6_MB_(100.00%)
+// #Medium #Depth_First_Search #Tree #Stack #Design #Queue #Iterator #Programming_Skills_II_Day_18
+// #2022_11_25_Time_210_ms_(100.00%)_Space_37.6_MB_(100.00%)
import com_github_leetcode.NestedInteger
diff --git a/src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt b/src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt
index a6fc4e02c..1cf3db3c4 100644
--- a/src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt
@@ -1,7 +1,7 @@
package g0301_0400.s0344_reverse_string
-// #Easy #Top_Interview_Questions #String #Two_Pointers #Recursion #Algorithm_I_Day_4_Two_Pointers
-// #Udemy_Strings #2022_11_18_Time_445_ms_(69.75%)_Space_61.9_MB_(33.77%)
+// #Easy #String #Two_Pointers #Recursion #Algorithm_I_Day_4_Two_Pointers #Udemy_Strings
+// #2022_11_18_Time_445_ms_(69.75%)_Space_61.9_MB_(33.77%)
class Solution {
fun reverseString(s: CharArray) {
diff --git a/src/main/kotlin/g0301_0400/s0345_reverse_vowels_of_a_string/Solution.kt b/src/main/kotlin/g0301_0400/s0345_reverse_vowels_of_a_string/Solution.kt
index 68e6ec3ad..945eeb7c3 100644
--- a/src/main/kotlin/g0301_0400/s0345_reverse_vowels_of_a_string/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0345_reverse_vowels_of_a_string/Solution.kt
@@ -1,6 +1,7 @@
package g0301_0400.s0345_reverse_vowels_of_a_string
-// #Easy #String #Two_Pointers #2022_11_18_Time_349_ms_(80.63%)_Space_42.2_MB_(76.91%)
+// #Easy #String #Two_Pointers #LeetCode_75_Array/String
+// #2022_11_18_Time_349_ms_(80.63%)_Space_42.2_MB_(76.91%)
class Solution {
private fun isVowel(c: Char): Boolean {
diff --git a/src/main/kotlin/g0301_0400/s0347_top_k_frequent_elements/Solution.kt b/src/main/kotlin/g0301_0400/s0347_top_k_frequent_elements/Solution.kt
index 1523bc77d..640748faf 100644
--- a/src/main/kotlin/g0301_0400/s0347_top_k_frequent_elements/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0347_top_k_frequent_elements/Solution.kt
@@ -1,9 +1,8 @@
package g0301_0400.s0347_top_k_frequent_elements
-// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Sorting
-// #Heap_Priority_Queue #Counting #Divide_and_Conquer #Quickselect #Bucket_Sort
-// #Data_Structure_II_Day_20_Heap_Priority_Queue
-// #2022_09_11_Time_268_ms_(99.74%)_Space_42_MB_(87.93%)
+// #Medium #Top_100_Liked_Questions #Array #Hash_Table #Sorting #Heap_Priority_Queue #Counting
+// #Divide_and_Conquer #Quickselect #Bucket_Sort #Data_Structure_II_Day_20_Heap_Priority_Queue
+// #Big_O_Time_O(n*log(n))_Space_O(k) #2022_09_11_Time_268_ms_(99.74%)_Space_42_MB_(87.93%)
import java.util.PriorityQueue
import java.util.Queue
diff --git a/src/main/kotlin/g0301_0400/s0350_intersection_of_two_arrays_ii/Solution.kt b/src/main/kotlin/g0301_0400/s0350_intersection_of_two_arrays_ii/Solution.kt
index 54fbdff81..b20e42499 100644
--- a/src/main/kotlin/g0301_0400/s0350_intersection_of_two_arrays_ii/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0350_intersection_of_two_arrays_ii/Solution.kt
@@ -1,8 +1,7 @@
package g0301_0400.s0350_intersection_of_two_arrays_ii
-// #Easy #Top_Interview_Questions #Array #Hash_Table #Sorting #Binary_Search #Two_Pointers
-// #Data_Structure_I_Day_3_Array #Binary_Search_I_Day_10
-// #2022_11_18_Time_321_ms_(73.37%)_Space_38.4_MB_(62.81%)
+// #Easy #Array #Hash_Table #Sorting #Binary_Search #Two_Pointers #Data_Structure_I_Day_3_Array
+// #Binary_Search_I_Day_10 #2022_11_18_Time_321_ms_(73.37%)_Space_38.4_MB_(62.81%)
class Solution {
fun intersect(nums1: IntArray, nums2: IntArray): IntArray {
@@ -12,7 +11,7 @@ class Solution {
}
var s = MutableList(0) { 0 }
for (i in 0 until nums2.size) {
- if (a.getOrDefault(nums2[i], 0)> 0) {
+ if (a.getOrDefault(nums2[i], 0) > 0) {
s.add(nums2[i])
a[nums2[i]] = a.getValue(nums2[i]) - 1
}
diff --git a/src/main/kotlin/g0301_0400/s0354_russian_doll_envelopes/Solution.kt b/src/main/kotlin/g0301_0400/s0354_russian_doll_envelopes/Solution.kt
index 7c642037d..34046a506 100644
--- a/src/main/kotlin/g0301_0400/s0354_russian_doll_envelopes/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0354_russian_doll_envelopes/Solution.kt
@@ -7,7 +7,11 @@ class Solution {
fun maxEnvelopes(envelopes: Array): Int {
envelopes.sortWith { a: IntArray, b: IntArray ->
if (a[0] != b[0]
- ) a[0] - b[0] else b[1] - a[1]
+ ) {
+ a[0] - b[0]
+ } else {
+ b[1] - a[1]
+ }
}
val tails = IntArray(envelopes.size)
var size = 0
diff --git a/src/main/kotlin/g0301_0400/s0365_water_and_jug_problem/Solution.kt b/src/main/kotlin/g0301_0400/s0365_water_and_jug_problem/Solution.kt
index 660a49477..3c8e55049 100644
--- a/src/main/kotlin/g0301_0400/s0365_water_and_jug_problem/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0365_water_and_jug_problem/Solution.kt
@@ -8,7 +8,9 @@ class Solution {
private fun gcd(n1: Int, n2: Int): Int {
return if (n2 == 0) {
n1
- } else gcd(n2, n1 % n2)
+ } else {
+ gcd(n2, n1 % n2)
+ }
}
fun canMeasureWater(jug1Capacity: Int, jug2Capacity: Int, targetCapacity: Int): Boolean {
diff --git a/src/main/kotlin/g0301_0400/s0371_sum_of_two_integers/Solution.kt b/src/main/kotlin/g0301_0400/s0371_sum_of_two_integers/Solution.kt
index b06a213ec..2b0a363fb 100644
--- a/src/main/kotlin/g0301_0400/s0371_sum_of_two_integers/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0371_sum_of_two_integers/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0371_sum_of_two_integers
-// #Medium #Top_Interview_Questions #Math #Bit_Manipulation #Udemy_Bit_Manipulation
+// #Medium #Math #Bit_Manipulation #Udemy_Bit_Manipulation
// #2022_11_22_Time_129_ms_(95.45%)_Space_32.9_MB_(90.91%)
@Suppress("NAME_SHADOWING")
diff --git a/src/main/kotlin/g0301_0400/s0372_super_pow/Solution.kt b/src/main/kotlin/g0301_0400/s0372_super_pow/Solution.kt
index 85dddd326..d69aec6a5 100644
--- a/src/main/kotlin/g0301_0400/s0372_super_pow/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0372_super_pow/Solution.kt
@@ -11,7 +11,9 @@ class Solution {
// Cycle has started
// cycle starts at phi with length phi
exp(a % MOD, phi + arrMod)
- } else exp(a % MOD, arrMod)
+ } else {
+ exp(a % MOD, arrMod)
+ }
}
private fun phi(n: Int): Int {
diff --git a/src/main/kotlin/g0301_0400/s0373_find_k_pairs_with_smallest_sums/Solution.kt b/src/main/kotlin/g0301_0400/s0373_find_k_pairs_with_smallest_sums/Solution.kt
index 85bee3cf5..845f351a7 100644
--- a/src/main/kotlin/g0301_0400/s0373_find_k_pairs_with_smallest_sums/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0373_find_k_pairs_with_smallest_sums/Solution.kt
@@ -1,9 +1,9 @@
package g0301_0400.s0373_find_k_pairs_with_smallest_sums
-// #Medium #Array #Heap_Priority_Queue #2022_11_22_Time_1809_ms_(80.95%)_Space_119.1_MB_(66.67%)
+// #Medium #Array #Heap_Priority_Queue #Top_Interview_150_Heap
+// #2022_11_22_Time_1809_ms_(80.95%)_Space_119.1_MB_(66.67%)
import java.util.PriorityQueue
-import kotlin.collections.ArrayList
class Solution {
private class Node(index: Int, num1: Int, num2: Int) {
diff --git a/src/main/kotlin/g0301_0400/s0374_guess_number_higher_or_lower/Solution.kt b/src/main/kotlin/g0301_0400/s0374_guess_number_higher_or_lower/Solution.kt
index 3c73554aa..e4e613375 100644
--- a/src/main/kotlin/g0301_0400/s0374_guess_number_higher_or_lower/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0374_guess_number_higher_or_lower/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0374_guess_number_higher_or_lower
-// #Easy #Binary_Search #Interactive #Binary_Search_I_Day_1
+// #Easy #Binary_Search #Interactive #LeetCode_75_Binary_Search #Binary_Search_I_Day_1
// #2022_11_22_Time_134_ms_(94.19%)_Space_32.6_MB_(98.60%)
/*
diff --git a/src/main/kotlin/g0301_0400/s0378_kth_smallest_element_in_a_sorted_matrix/Solution.kt b/src/main/kotlin/g0301_0400/s0378_kth_smallest_element_in_a_sorted_matrix/Solution.kt
index 9e8dfc5d5..b5b50ca52 100644
--- a/src/main/kotlin/g0301_0400/s0378_kth_smallest_element_in_a_sorted_matrix/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0378_kth_smallest_element_in_a_sorted_matrix/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0378_kth_smallest_element_in_a_sorted_matrix
-// #Medium #Top_Interview_Questions #Array #Sorting #Binary_Search #Matrix #Heap_Priority_Queue
+// #Medium #Array #Sorting #Binary_Search #Matrix #Heap_Priority_Queue
// #2022_09_11_Time_522_ms_(59.78%)_Space_56.6_MB_(79.61%)
class Solution {
diff --git a/src/main/kotlin/g0301_0400/s0380_insert_delete_getrandom_o1/RandomizedSet.kt b/src/main/kotlin/g0301_0400/s0380_insert_delete_getrandom_o1/RandomizedSet.kt
index e9d7f4124..848bd9fc4 100644
--- a/src/main/kotlin/g0301_0400/s0380_insert_delete_getrandom_o1/RandomizedSet.kt
+++ b/src/main/kotlin/g0301_0400/s0380_insert_delete_getrandom_o1/RandomizedSet.kt
@@ -1,7 +1,7 @@
package g0301_0400.s0380_insert_delete_getrandom_o1
-// #Medium #Top_Interview_Questions #Array #Hash_Table #Math #Design #Randomized
-// #Programming_Skills_II_Day_20 #2022_11_22_Time_1326_ms_(68.23%)_Space_119.7_MB_(83.53%)
+// #Medium #Array #Hash_Table #Math #Design #Randomized #Programming_Skills_II_Day_20
+// #Top_Interview_150_Array/String #2022_11_22_Time_1326_ms_(68.23%)_Space_119.7_MB_(83.53%)
import kotlin.random.Random
diff --git a/src/main/kotlin/g0301_0400/s0381_insert_delete_getrandom_o1_duplicates_allowed/RandomizedCollection.kt b/src/main/kotlin/g0301_0400/s0381_insert_delete_getrandom_o1_duplicates_allowed/RandomizedCollection.kt
index e775e893f..574d88d2e 100644
--- a/src/main/kotlin/g0301_0400/s0381_insert_delete_getrandom_o1_duplicates_allowed/RandomizedCollection.kt
+++ b/src/main/kotlin/g0301_0400/s0381_insert_delete_getrandom_o1_duplicates_allowed/RandomizedCollection.kt
@@ -25,13 +25,15 @@ class RandomizedCollection() {
/** Removes a value from the collection. Returns true if the collection contained the specified element. */
fun remove(x: Int): Boolean {
- if (x !in m2a)
+ if (x !in m2a) {
return false
+ }
val pos = m2a[x]!!.iterator().next()
- if (m2a[x]!!.size == 1)
+ if (m2a[x]!!.size == 1) {
m2a.remove(x)
- else
+ } else {
m2a[x]!!.remove(pos)
+ }
if (pos != a2m.size - 1) {
m2a[a2m[a2m.size - 1]]!!.remove(a2m.size - 1)
m2a[a2m[a2m.size - 1]]!!.add(pos)
diff --git a/src/main/kotlin/g0301_0400/s0383_ransom_note/Solution.kt b/src/main/kotlin/g0301_0400/s0383_ransom_note/Solution.kt
index 7e2ef3b74..b2f105106 100644
--- a/src/main/kotlin/g0301_0400/s0383_ransom_note/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0383_ransom_note/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0383_ransom_note
-// #Easy #String #Hash_Table #Counting #Data_Structure_I_Day_6_String
+// #Easy #String #Hash_Table #Counting #Data_Structure_I_Day_6_String #Top_Interview_150_Hashmap
// #2022_11_24_Time_333_ms_(79.58%)_Space_45.2_MB_(75.39%)
class Solution {
diff --git a/src/main/kotlin/g0301_0400/s0384_shuffle_an_array/Solution.kt b/src/main/kotlin/g0301_0400/s0384_shuffle_an_array/Solution.kt
index 84b010158..f0fea0ae3 100644
--- a/src/main/kotlin/g0301_0400/s0384_shuffle_an_array/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0384_shuffle_an_array/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0384_shuffle_an_array
-// #Medium #Top_Interview_Questions #Array #Math #Randomized #Algorithm_II_Day_20_Others
+// #Medium #Array #Math #Randomized #Algorithm_II_Day_20_Others
// #2022_11_24_Time_940_ms_(72.09%)_Space_81.5_MB_(51.16%)
import kotlin.random.Random
diff --git a/src/main/kotlin/g0301_0400/s0387_first_unique_character_in_a_string/Solution.kt b/src/main/kotlin/g0301_0400/s0387_first_unique_character_in_a_string/Solution.kt
index 8ddff207f..9ecaa96a1 100644
--- a/src/main/kotlin/g0301_0400/s0387_first_unique_character_in_a_string/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0387_first_unique_character_in_a_string/Solution.kt
@@ -1,7 +1,7 @@
package g0301_0400.s0387_first_unique_character_in_a_string
-// #Easy #Top_Interview_Questions #String #Hash_Table #Counting #Queue
-// #Data_Structure_I_Day_6_String #2022_11_24_Time_369_ms_(82.68%)_Space_53.6_MB_(66.43%)
+// #Easy #String #Hash_Table #Counting #Queue #Data_Structure_I_Day_6_String
+// #2022_11_24_Time_369_ms_(82.68%)_Space_53.6_MB_(66.43%)
class Solution {
fun firstUniqChar(s: String): Int {
@@ -16,6 +16,8 @@ class Solution {
}
return if (ans == Int.MAX_VALUE) {
-1
- } else ans
+ } else {
+ ans
+ }
}
}
diff --git a/src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt b/src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt
index 68d83d8e4..6891814a1 100644
--- a/src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt
@@ -1,8 +1,8 @@
package g0301_0400.s0392_is_subsequence
-// #Easy #String #Dynamic_Programming #Two_Pointers #Dynamic_Programming_I_Day_19
-// #Level_1_Day_2_String #Udemy_Two_Pointers
-// #2022_11_25_Time_156_ms_(87.74%)_Space_33.9_MB_(90.11%)
+// #Easy #String #Dynamic_Programming #Two_Pointers #LeetCode_75_Two_Pointers
+// #Dynamic_Programming_I_Day_19 #Level_1_Day_2_String #Udemy_Two_Pointers
+// #Top_Interview_150_Two_Pointers #2022_11_25_Time_156_ms_(87.74%)_Space_33.9_MB_(90.11%)
class Solution {
fun isSubsequence(s: String, t: String): Boolean {
diff --git a/src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt b/src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt
index 01f76b5c3..40d7859a0 100644
--- a/src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt
@@ -1,6 +1,7 @@
package g0301_0400.s0394_decode_string
-// #Medium #Top_100_Liked_Questions #String #Stack #Recursion #Level_1_Day_14_Stack #Udemy_Strings
+// #Medium #Top_100_Liked_Questions #String #Stack #Recursion #LeetCode_75_Stack
+// #Level_1_Day_14_Stack #Udemy_Strings #Big_O_Time_O(n)_Space_O(n)
// #2022_09_27_Time_224_ms_(64.86%)_Space_34.3_MB_(84.46%)
class Solution {
diff --git a/src/main/kotlin/g0301_0400/s0395_longest_substring_with_at_least_k_repeating_characters/Solution.kt b/src/main/kotlin/g0301_0400/s0395_longest_substring_with_at_least_k_repeating_characters/Solution.kt
index db138b4fa..ec322035a 100644
--- a/src/main/kotlin/g0301_0400/s0395_longest_substring_with_at_least_k_repeating_characters/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0395_longest_substring_with_at_least_k_repeating_characters/Solution.kt
@@ -1,6 +1,6 @@
package g0301_0400.s0395_longest_substring_with_at_least_k_repeating_characters
-// #Medium #Top_Interview_Questions #String #Hash_Table #Sliding_Window #Divide_and_Conquer
+// #Medium #String #Hash_Table #Sliding_Window #Divide_and_Conquer
// #2022_11_28_Time_274_ms_(66.67%)_Space_34_MB_(100.00%)
class Solution {
diff --git a/src/main/kotlin/g0301_0400/s0398_random_pick_index/Solution.kt b/src/main/kotlin/g0301_0400/s0398_random_pick_index/Solution.kt
index b19e12634..d6481fa8f 100644
--- a/src/main/kotlin/g0301_0400/s0398_random_pick_index/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0398_random_pick_index/Solution.kt
@@ -14,7 +14,7 @@ class Solution(nums: IntArray) {
map = HashMap()
for (i in nums.indices) {
map.computeIfAbsent(
- nums[i]
+ nums[i],
) { ArrayList() }.add(i)
}
}
diff --git a/src/main/kotlin/g0301_0400/s0399_evaluate_division/Solution.kt b/src/main/kotlin/g0301_0400/s0399_evaluate_division/Solution.kt
index 3ebdb79c8..bfe0cd168 100644
--- a/src/main/kotlin/g0301_0400/s0399_evaluate_division/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0399_evaluate_division/Solution.kt
@@ -1,6 +1,7 @@
package g0301_0400.s0399_evaluate_division
// #Medium #Array #Depth_First_Search #Breadth_First_Search #Graph #Union_Find #Shortest_Path
+// #LeetCode_75_Graphs/DFS #Top_Interview_150_Graph_General
// #2022_11_29_Time_183_ms_(91.49%)_Space_34.6_MB_(95.74%)
@Suppress("kotlin:S6518")
@@ -11,7 +12,7 @@ class Solution {
fun calcEquation(
equations: List>,
values: DoubleArray,
- queries: List>
+ queries: List>,
): DoubleArray {
root = HashMap()
rate = HashMap()
@@ -41,8 +42,12 @@ class Solution {
}
val rootX = findRoot(x, x, 1.0)
val rootY = findRoot(y, y, 1.0)
- result[i] = if (rootX == rootY) (rate as HashMap).get(x)!! /
- (rate as HashMap).get(y)!! else -1.0
+ result[i] = if (rootX == rootY) {
+ (rate as HashMap).get(x)!! /
+ (rate as HashMap).get(y)!!
+ } else {
+ -1.0
+ }
}
return result
}
diff --git a/src/main/kotlin/g0301_0400/s0400_nth_digit/Solution.kt b/src/main/kotlin/g0301_0400/s0400_nth_digit/Solution.kt
index a9ecdd95d..f3d52c128 100644
--- a/src/main/kotlin/g0301_0400/s0400_nth_digit/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0400_nth_digit/Solution.kt
@@ -5,10 +5,10 @@ package g0301_0400.s0400_nth_digit
@Suppress("NAME_SHADOWING")
class Solution {
/*
- * 1. find the length of the number where the nth digit is from
- * 2. find the actual number where the nth digit is from
- * 3. find the nth digit and return
- */
+ * 1. find the length of the number where the nth digit is from
+ * 2. find the actual number where the nth digit is from
+ * 3. find the nth digit and return
+ */
fun findNthDigit(n: Int): Int {
var n = n
var len = 1
diff --git a/src/main/kotlin/g0401_0500/s0401_binary_watch/Solution.kt b/src/main/kotlin/g0401_0500/s0401_binary_watch/Solution.kt
index 607e119e3..19c1af940 100644
--- a/src/main/kotlin/g0401_0500/s0401_binary_watch/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0401_binary_watch/Solution.kt
@@ -20,7 +20,7 @@ class Solution {
turnedOn: Int,
selectedTimes: MutableList,
hour: Int,
- minutes: Int
+ minutes: Int,
) {
if (isValidTime(turnedOn, hour, minutes)) {
selectedTimes.add(getTimeString(hour, minutes))
diff --git a/src/main/kotlin/g0401_0500/s0403_frog_jump/Solution.kt b/src/main/kotlin/g0401_0500/s0403_frog_jump/Solution.kt
index efa9d5977..467658bd2 100644
--- a/src/main/kotlin/g0401_0500/s0403_frog_jump/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0403_frog_jump/Solution.kt
@@ -28,7 +28,7 @@ class Solution {
index: Int,
jumpLength: Int,
expectedVal: Int,
- rocks: Map
+ rocks: Map,
): Boolean {
// overshoot and going backwards not allowed
if (index >= stones.size || jumpLength <= 0) {
@@ -52,21 +52,21 @@ class Solution {
rocks[stones[index] + jumpLength] ?: stones.size,
jumpLength + 1,
stones[index] + jumpLength,
- rocks
+ rocks,
) ||
jump(
stones,
rocks[stones[index] + jumpLength] ?: stones.size,
jumpLength,
stones[index] + jumpLength,
- rocks
+ rocks,
) ||
jump(
stones,
rocks[stones[index] + jumpLength] ?: stones.size,
jumpLength - 1,
stones[index] + jumpLength,
- rocks
+ rocks,
)
)
}
diff --git a/src/main/kotlin/g0401_0500/s0406_queue_reconstruction_by_height/Solution.kt b/src/main/kotlin/g0401_0500/s0406_queue_reconstruction_by_height/Solution.kt
index d47a176c5..f9dd7c37c 100644
--- a/src/main/kotlin/g0401_0500/s0406_queue_reconstruction_by_height/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0406_queue_reconstruction_by_height/Solution.kt
@@ -6,7 +6,10 @@ package g0401_0500.s0406_queue_reconstruction_by_height
class Solution {
fun reconstructQueue(people: Array): Array {
return people.sortedWith(compareBy({ -it[0] }, { it[1] }))
- .fold(mutableListOf()) { output, p -> output.add(p[1], p); output }
+ .fold(mutableListOf()) { output, p ->
+ output.add(p[1], p)
+ output
+ }
.toTypedArray()
}
}
diff --git a/src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt b/src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt
index 3e5a34c66..2903de9cf 100644
--- a/src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt
@@ -11,8 +11,10 @@ class Solution {
for (c in s.toCharArray()) {
set.flip(c.code - 'A'.code)
}
- return if (set.isEmpty()) {
+ return if (set.isEmpty) {
s.length
- } else s.length - set.cardinality() + 1
+ } else {
+ s.length - set.cardinality() + 1
+ }
}
}
diff --git a/src/main/kotlin/g0401_0500/s0412_fizz_buzz/Solution.kt b/src/main/kotlin/g0401_0500/s0412_fizz_buzz/Solution.kt
index d9fed571f..a08e0f632 100644
--- a/src/main/kotlin/g0401_0500/s0412_fizz_buzz/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0412_fizz_buzz/Solution.kt
@@ -1,6 +1,6 @@
package g0401_0500.s0412_fizz_buzz
-// #Easy #Top_Interview_Questions #String #Math #Simulation #Udemy_Integers
+// #Easy #String #Math #Simulation #Udemy_Integers
// #2022_12_03_Time_307_ms_(71.81%)_Space_41.9_MB_(71.97%)
class Solution {
diff --git a/src/main/kotlin/g0401_0500/s0416_partition_equal_subset_sum/Solution.kt b/src/main/kotlin/g0401_0500/s0416_partition_equal_subset_sum/Solution.kt
index d957b8481..6d841d241 100644
--- a/src/main/kotlin/g0401_0500/s0416_partition_equal_subset_sum/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0416_partition_equal_subset_sum/Solution.kt
@@ -1,7 +1,7 @@
package g0401_0500.s0416_partition_equal_subset_sum
// #Medium #Top_100_Liked_Questions #Array #Dynamic_Programming #Level_2_Day_13_Dynamic_Programming
-// #2023_01_02_Time_204_ms_(98.82%)_Space_34.9_MB_(100.00%)
+// #Big_O_Time_O(n*sums)_Space_O(n*sums) #2023_01_02_Time_204_ms_(98.82%)_Space_34.9_MB_(100.00%)
class Solution {
fun canPartition(nums: IntArray): Boolean {
diff --git a/src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt b/src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt
index ddd0d3868..24c6c62c6 100644
--- a/src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0417_pacific_atlantic_water_flow/Solution.kt
@@ -16,12 +16,12 @@ class Solution {
row = matrix[0].size
val pacific = Array(col) {
BooleanArray(
- row
+ row,
)
}
val atlantic = Array(col) {
BooleanArray(
- row
+ row,
)
}
for (i in 0 until col) {
diff --git a/src/main/kotlin/g0401_0500/s0427_construct_quad_tree/Solution.kt b/src/main/kotlin/g0401_0500/s0427_construct_quad_tree/Solution.kt
index d41449aa8..c848369c7 100644
--- a/src/main/kotlin/g0401_0500/s0427_construct_quad_tree/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0427_construct_quad_tree/Solution.kt
@@ -1,6 +1,6 @@
package g0401_0500.s0427_construct_quad_tree
-// #Medium #Array #Tree #Matrix #Divide_and_Conquer
+// #Medium #Array #Tree #Matrix #Divide_and_Conquer #Top_Interview_150_Divide_and_Conquer
// #2022_12_08_Time_221_ms_(94.74%)_Space_36.9_MB_(94.74%)
/*
diff --git a/src/main/kotlin/g0401_0500/s0433_minimum_genetic_mutation/Solution.kt b/src/main/kotlin/g0401_0500/s0433_minimum_genetic_mutation/Solution.kt
index cb9cece30..706458393 100644
--- a/src/main/kotlin/g0401_0500/s0433_minimum_genetic_mutation/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0433_minimum_genetic_mutation/Solution.kt
@@ -1,7 +1,7 @@
package g0401_0500.s0433_minimum_genetic_mutation
// #Medium #String #Hash_Table #Breadth_First_Search #Graph_Theory_I_Day_12_Breadth_First_Search
-// #2022_12_21_Time_204_ms_(82.08%)_Space_34.5_MB_(82.08%)
+// #Top_Interview_150_Graph_BFS #2022_12_21_Time_204_ms_(82.08%)_Space_34.5_MB_(82.08%)
import java.util.LinkedList
import java.util.Queue
diff --git a/src/main/kotlin/g0401_0500/s0435_non_overlapping_intervals/Solution.kt b/src/main/kotlin/g0401_0500/s0435_non_overlapping_intervals/Solution.kt
index 3130276e5..715e0bf22 100644
--- a/src/main/kotlin/g0401_0500/s0435_non_overlapping_intervals/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0435_non_overlapping_intervals/Solution.kt
@@ -1,13 +1,17 @@
package g0401_0500.s0435_non_overlapping_intervals
-// #Medium #Array #Dynamic_Programming #Sorting #Greedy #Data_Structure_II_Day_4_Array
-// #2022_12_22_Time_1040_ms_(85.07%)_Space_117.9_MB_(82.09%)
+// #Medium #Array #Dynamic_Programming #Sorting #Greedy #LeetCode_75_Intervals
+// #Data_Structure_II_Day_4_Array #2022_12_22_Time_1040_ms_(85.07%)_Space_117.9_MB_(82.09%)
class Solution {
fun eraseOverlapIntervals(intervals: Array): Int {
intervals.sortWith { a: IntArray, b: IntArray ->
if (a[0] != b[0]
- ) a[0] - b[0] else a[1] - b[1]
+ ) {
+ a[0] - b[0]
+ } else {
+ a[1] - b[1]
+ }
}
var erasures = 0
var end = intervals[0][1]
diff --git a/src/main/kotlin/g0401_0500/s0437_path_sum_iii/Solution.kt b/src/main/kotlin/g0401_0500/s0437_path_sum_iii/Solution.kt
index 6788b2c02..29c247a12 100644
--- a/src/main/kotlin/g0401_0500/s0437_path_sum_iii/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0437_path_sum_iii/Solution.kt
@@ -1,7 +1,7 @@
package g0401_0500.s0437_path_sum_iii
-// #Medium #Top_100_Liked_Questions #Depth_First_Search #Tree #Binary_Tree #Level_2_Day_7_Tree
-// #2022_09_11_Time_403_ms_(54.12%)_Space_41.7_MB_(62.35%)
+// #Medium #Depth_First_Search #Tree #Binary_Tree #LeetCode_75_Binary_Tree/DFS #Level_2_Day_7_Tree
+// #Big_O_Time_O(n)_Space_O(n) #2022_09_11_Time_403_ms_(54.12%)_Space_41.7_MB_(62.35%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt b/src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt
index 228994eee..f5d47bc5d 100644
--- a/src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0438_find_all_anagrams_in_a_string/Solution.kt
@@ -2,7 +2,7 @@ package g0401_0500.s0438_find_all_anagrams_in_a_string
// #Medium #Top_100_Liked_Questions #String #Hash_Table #Sliding_Window
// #Algorithm_II_Day_5_Sliding_Window #Programming_Skills_II_Day_12
-// #Level_1_Day_12_Sliding_Window/Two_Pointer
+// #Level_1_Day_12_Sliding_Window/Two_Pointer #Big_O_Time_O(n+m)_Space_O(1)
// #2022_09_11_Time_561_ms_(54.68%)_Space_48.1_MB_(64.53%)
class Solution {
diff --git a/src/main/kotlin/g0401_0500/s0443_string_compression/Solution.kt b/src/main/kotlin/g0401_0500/s0443_string_compression/Solution.kt
index 92834e24b..a9ba63fbe 100644
--- a/src/main/kotlin/g0401_0500/s0443_string_compression/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0443_string_compression/Solution.kt
@@ -1,6 +1,7 @@
package g0401_0500.s0443_string_compression
-// #Medium #String #Two_Pointers #2022_12_23_Time_198_ms_(92.68%)_Space_35.4_MB_(95.12%)
+// #Medium #String #Two_Pointers #LeetCode_75_Array/String
+// #2022_12_23_Time_198_ms_(92.68%)_Space_35.4_MB_(95.12%)
class Solution {
/* This is breaking the rules, it's not in-place. */
diff --git a/src/main/kotlin/g0401_0500/s0446_arithmetic_slices_ii_subsequence/Solution.kt b/src/main/kotlin/g0401_0500/s0446_arithmetic_slices_ii_subsequence/Solution.kt
index 946a51271..347308029 100644
--- a/src/main/kotlin/g0401_0500/s0446_arithmetic_slices_ii_subsequence/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0446_arithmetic_slices_ii_subsequence/Solution.kt
@@ -16,7 +16,7 @@ class Solution {
count += length[i][j]
}
indexes.computeIfAbsent(
- arr[i].toLong()
+ arr[i].toLong(),
) { _: Long? -> ArrayList() }.add(i)
}
return count
diff --git a/src/main/kotlin/g0401_0500/s0450_delete_node_in_a_bst/Solution.kt b/src/main/kotlin/g0401_0500/s0450_delete_node_in_a_bst/Solution.kt
index bf1366d3b..0124d8601 100644
--- a/src/main/kotlin/g0401_0500/s0450_delete_node_in_a_bst/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0450_delete_node_in_a_bst/Solution.kt
@@ -1,7 +1,7 @@
package g0401_0500.s0450_delete_node_in_a_bst
-// #Medium #Tree #Binary_Tree #Binary_Search_Tree #Data_Structure_II_Day_16_Tree
-// #2022_12_25_Time_257_ms_(84.62%)_Space_38.6_MB_(92.31%)
+// #Medium #Tree #Binary_Tree #Binary_Search_Tree #LeetCode_75_Binary_Search_Tree
+// #Data_Structure_II_Day_16_Tree #2022_12_25_Time_257_ms_(84.62%)_Space_38.6_MB_(92.31%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0401_0500/s0452_minimum_number_of_arrows_to_burst_balloons/Solution.kt b/src/main/kotlin/g0401_0500/s0452_minimum_number_of_arrows_to_burst_balloons/Solution.kt
index 80b5f7eb0..8ad10566f 100644
--- a/src/main/kotlin/g0401_0500/s0452_minimum_number_of_arrows_to_burst_balloons/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0452_minimum_number_of_arrows_to_burst_balloons/Solution.kt
@@ -1,6 +1,7 @@
package g0401_0500.s0452_minimum_number_of_arrows_to_burst_balloons
-// #Medium #Array #Sorting #Greedy #2022_12_25_Time_934_ms_(100.00%)_Space_87_MB_(100.00%)
+// #Medium #Array #Sorting #Greedy #LeetCode_75_Intervals #Top_Interview_150_Intervals
+// #2022_12_25_Time_934_ms_(100.00%)_Space_87_MB_(100.00%)
class Solution {
/*
diff --git a/src/main/kotlin/g0401_0500/s0454_4sum_ii/Solution.kt b/src/main/kotlin/g0401_0500/s0454_4sum_ii/Solution.kt
index 6b96140e8..784890156 100644
--- a/src/main/kotlin/g0401_0500/s0454_4sum_ii/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0454_4sum_ii/Solution.kt
@@ -1,7 +1,6 @@
package g0401_0500.s0454_4sum_ii
-// #Medium #Top_Interview_Questions #Array #Hash_Table
-// #2022_12_26_Time_660_ms_(85.71%)_Space_48.4_MB_(82.86%)
+// #Medium #Array #Hash_Table #2022_12_26_Time_660_ms_(85.71%)_Space_48.4_MB_(82.86%)
class Solution {
fun fourSumCount(nums1: IntArray, nums2: IntArray, nums3: IntArray, nums4: IntArray): Int {
diff --git a/src/main/kotlin/g0401_0500/s0464_can_i_win/Solution.kt b/src/main/kotlin/g0401_0500/s0464_can_i_win/Solution.kt
index 0c5bff10c..2e64a3a24 100644
--- a/src/main/kotlin/g0401_0500/s0464_can_i_win/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0464_can_i_win/Solution.kt
@@ -10,7 +10,9 @@ class Solution {
}
return if (1.0 * maxChoosableInteger * (1 + maxChoosableInteger) / 2 < desiredTotal) {
false
- } else canWin(0, arrayOfNulls(1 shl maxChoosableInteger), desiredTotal, maxChoosableInteger)
+ } else {
+ canWin(0, arrayOfNulls(1 shl maxChoosableInteger), desiredTotal, maxChoosableInteger)
+ }
}
private fun canWin(state: Int, dp: Array, desiredTotal: Int, maxChoosableInteger: Int): Boolean {
diff --git a/src/main/kotlin/g0401_0500/s0475_heaters/Solution.kt b/src/main/kotlin/g0401_0500/s0475_heaters/Solution.kt
index a1d5e2930..4c24c6b6e 100644
--- a/src/main/kotlin/g0401_0500/s0475_heaters/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0475_heaters/Solution.kt
@@ -22,7 +22,7 @@ class Solution {
} else if (houses[hs] <= heaters[ht + 1]) {
res = Math.max(
res,
- Math.min(houses[hs] - heaters[ht], heaters[ht + 1] - houses[hs])
+ Math.min(houses[hs] - heaters[ht], heaters[ht + 1] - houses[hs]),
)
hs++
} else {
diff --git a/src/main/kotlin/g0401_0500/s0480_sliding_window_median/Solution.kt b/src/main/kotlin/g0401_0500/s0480_sliding_window_median/Solution.kt
index aaac37ca7..bfac89127 100644
--- a/src/main/kotlin/g0401_0500/s0480_sliding_window_median/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0480_sliding_window_median/Solution.kt
@@ -18,7 +18,11 @@ class Solution {
}
val comparator = Comparator { a: Int?, b: Int? ->
if (nums[a!!] != nums[b!!]
- ) Integer.compare(nums[a], nums[b]) else Integer.compare(a, b)
+ ) {
+ Integer.compare(nums[a], nums[b])
+ } else {
+ Integer.compare(a, b)
+ }
}
val smallNums = TreeSet(comparator.reversed())
val largeNums = TreeSet(comparator)
@@ -59,6 +63,8 @@ class Solution {
private fun getMedian(smallNums: TreeSet, largeNums: TreeSet, nums: IntArray): Double {
return if (smallNums.size == largeNums.size) {
(nums[smallNums.first()!!].toDouble() + nums[largeNums.first()!!]) / 2
- } else nums[smallNums.first()!!].toDouble()
+ } else {
+ nums[smallNums.first()!!].toDouble()
+ }
}
}
diff --git a/src/main/kotlin/g0401_0500/s0488_zuma_game/Solution.kt b/src/main/kotlin/g0401_0500/s0488_zuma_game/Solution.kt
index c9101fa80..9c30d5d7a 100644
--- a/src/main/kotlin/g0401_0500/s0488_zuma_game/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0488_zuma_game/Solution.kt
@@ -37,7 +37,7 @@ class Solution {
val sR = findMinStepDp(
removeRepeated(newS.toString()),
hand.substring(0, j) + hand.substring(j + 1, hand.length),
- dp
+ dp,
)
if (sR != -1) {
min = if (min == -1) sR + 1 else Integer.min(min, sR + 1)
@@ -61,7 +61,7 @@ class Solution {
if (count >= 3) {
return removeRepeated(
original.substring(0, i - count) +
- original.substring(i, original.length)
+ original.substring(i, original.length),
)
} else {
count = 1
diff --git a/src/main/kotlin/g0401_0500/s0491_increasing_subsequences/Solution.kt b/src/main/kotlin/g0401_0500/s0491_increasing_subsequences/Solution.kt
index 3c23c6b2d..293cd51e4 100644
--- a/src/main/kotlin/g0401_0500/s0491_increasing_subsequences/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0491_increasing_subsequences/Solution.kt
@@ -17,7 +17,7 @@ class Solution {
nums: IntArray,
start: Int,
currList: MutableList,
- answer: MutableSet>
+ answer: MutableSet>,
): Set> {
if (currList.size >= 2) {
answer.add(ArrayList(currList))
diff --git a/src/main/kotlin/g0401_0500/s0492_construct_the_rectangle/Solution.kt b/src/main/kotlin/g0401_0500/s0492_construct_the_rectangle/Solution.kt
index 7ab87937d..bc7c3b894 100644
--- a/src/main/kotlin/g0401_0500/s0492_construct_the_rectangle/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0492_construct_the_rectangle/Solution.kt
@@ -7,7 +7,7 @@ class Solution {
Algorithm:
- start with an index i from the square root all the way to 1;
- if at any time, area % i == 0 (so i is a divisor of area), then it's the closest solution.
- */
+ */
fun constructRectangle(area: Int): IntArray {
var low = Math.sqrt(area.toDouble()).toInt()
while (low > 0) {
diff --git a/src/main/kotlin/g0401_0500/s0494_target_sum/Solution.kt b/src/main/kotlin/g0401_0500/s0494_target_sum/Solution.kt
index 9bba902ce..acfd4202a 100644
--- a/src/main/kotlin/g0401_0500/s0494_target_sum/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0494_target_sum/Solution.kt
@@ -1,6 +1,6 @@
package g0401_0500.s0494_target_sum
-// #Medium #Top_100_Liked_Questions #Array #Dynamic_Programming #Backtracking
+// #Medium #Array #Dynamic_Programming #Backtracking #Big_O_Time_O(n*(sum+s))_Space_O(n*(sum+s))
// #2022_09_16_Time_308_ms_(89.61%)_Space_37.2_MB_(61.04%)
@Suppress("NAME_SHADOWING")
diff --git a/src/main/kotlin/g0401_0500/s0497_random_point_in_non_overlapping_rectangles/Solution.kt b/src/main/kotlin/g0401_0500/s0497_random_point_in_non_overlapping_rectangles/Solution.kt
index 5a17a7092..dc575ecae 100644
--- a/src/main/kotlin/g0401_0500/s0497_random_point_in_non_overlapping_rectangles/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0497_random_point_in_non_overlapping_rectangles/Solution.kt
@@ -49,7 +49,8 @@ class Solution(rects: Array) {
val bot = r[1]
val top = r[3]
return intArrayOf(
- left + random.nextInt(right - left + 1), bot + random.nextInt(top - bot + 1)
+ left + random.nextInt(right - left + 1),
+ bot + random.nextInt(top - bot + 1),
)
}
}
diff --git a/src/main/kotlin/g0501_0600/s0502_ipo/Solution.kt b/src/main/kotlin/g0501_0600/s0502_ipo/Solution.kt
index 0a1e78436..5f8098757 100644
--- a/src/main/kotlin/g0501_0600/s0502_ipo/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0502_ipo/Solution.kt
@@ -1,6 +1,6 @@
package g0501_0600.s0502_ipo
-// #Hard #Array #Sorting #Greedy #Heap_Priority_Queue
+// #Hard #Array #Sorting #Greedy #Heap_Priority_Queue #Top_Interview_150_Heap
// #2023_01_06_Time_799_ms_(54.55%)_Space_88.5_MB_(9.09%)
import java.util.PriorityQueue
@@ -12,7 +12,7 @@ class Solution {
var profitMaxHeap = PriorityQueue { d1, d2 ->
-1 * Integer.compare(
d1.profit,
- d2.profit
+ d2.profit,
)
}
@@ -23,7 +23,6 @@ class Solution {
var maxCapital = w
var currentCapital = w
for (i in 0 until k) {
-
// first fetch all tasks you can do with current capital and add those in profit max heap
while (capitalMinHeap.isNotEmpty() && currentCapital >= capitalMinHeap.peek().capital) {
profitMaxHeap.add(capitalMinHeap.poll())
diff --git a/src/main/kotlin/g0501_0600/s0513_find_bottom_left_tree_value/Solution.kt b/src/main/kotlin/g0501_0600/s0513_find_bottom_left_tree_value/Solution.kt
index a3db0e756..f73189af0 100644
--- a/src/main/kotlin/g0501_0600/s0513_find_bottom_left_tree_value/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0513_find_bottom_left_tree_value/Solution.kt
@@ -48,6 +48,8 @@ class Solution {
val a = func(root, 0)
return if (a != null && a.size > 0) {
a[0]
- } else -1
+ } else {
+ -1
+ }
}
}
diff --git a/src/main/kotlin/g0501_0600/s0514_freedom_trail/Solution.kt b/src/main/kotlin/g0501_0600/s0514_freedom_trail/Solution.kt
index 8fe12476f..88e0e0fb5 100644
--- a/src/main/kotlin/g0501_0600/s0514_freedom_trail/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0514_freedom_trail/Solution.kt
@@ -23,7 +23,7 @@ class Solution {
key: String,
j: Int,
cache: Array,
- indexs: Array?>
+ indexs: Array?>,
): Int {
if (j == key.length) {
return 0
diff --git a/src/main/kotlin/g0501_0600/s0521_longest_uncommon_subsequence_i/Solution.kt b/src/main/kotlin/g0501_0600/s0521_longest_uncommon_subsequence_i/Solution.kt
index 4668123c8..dd0f66d4b 100644
--- a/src/main/kotlin/g0501_0600/s0521_longest_uncommon_subsequence_i/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0521_longest_uncommon_subsequence_i/Solution.kt
@@ -6,6 +6,8 @@ class Solution {
fun findLUSlength(a: String, b: String): Int {
return if (a == b) {
-1
- } else a.length.coerceAtLeast(b.length)
+ } else {
+ a.length.coerceAtLeast(b.length)
+ }
}
}
diff --git a/src/main/kotlin/g0501_0600/s0529_minesweeper/Solution.kt b/src/main/kotlin/g0501_0600/s0529_minesweeper/Solution.kt
index 3e7e65a46..9d5e8e767 100644
--- a/src/main/kotlin/g0501_0600/s0529_minesweeper/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0529_minesweeper/Solution.kt
@@ -57,7 +57,7 @@ class Solution {
intArrayOf(-1, -1),
intArrayOf(-1, 1),
intArrayOf(1, -1),
- intArrayOf(1, 1)
+ intArrayOf(1, 1),
)
}
}
diff --git a/src/main/kotlin/g0501_0600/s0530_minimum_absolute_difference_in_bst/Solution.kt b/src/main/kotlin/g0501_0600/s0530_minimum_absolute_difference_in_bst/Solution.kt
index 499813396..13c1b618e 100644
--- a/src/main/kotlin/g0501_0600/s0530_minimum_absolute_difference_in_bst/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0530_minimum_absolute_difference_in_bst/Solution.kt
@@ -1,7 +1,7 @@
package g0501_0600.s0530_minimum_absolute_difference_in_bst
// #Easy #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree #Binary_Search_Tree
-// #2023_01_15_Time_209_ms_(86.96%)_Space_38.5_MB_(69.57%)
+// #Top_Interview_150_Binary_Search_Tree #2023_01_15_Time_209_ms_(86.96%)_Space_38.5_MB_(69.57%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0501_0600/s0539_minimum_time_difference/Solution.kt b/src/main/kotlin/g0501_0600/s0539_minimum_time_difference/Solution.kt
index aab0fe172..454e53952 100644
--- a/src/main/kotlin/g0501_0600/s0539_minimum_time_difference/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0539_minimum_time_difference/Solution.kt
@@ -6,7 +6,9 @@ class Solution {
fun findMinDifference(timePoints: List): Int {
return if (timePoints.size < 300) {
smallInputSize(timePoints)
- } else largeInputSize(timePoints)
+ } else {
+ largeInputSize(timePoints)
+ }
}
private fun largeInputSize(timePoints: List): Int {
diff --git a/src/main/kotlin/g0501_0600/s0543_diameter_of_binary_tree/Solution.kt b/src/main/kotlin/g0501_0600/s0543_diameter_of_binary_tree/Solution.kt
index b9e019a0f..7bd98b395 100644
--- a/src/main/kotlin/g0501_0600/s0543_diameter_of_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0543_diameter_of_binary_tree/Solution.kt
@@ -1,7 +1,8 @@
package g0501_0600.s0543_diameter_of_binary_tree
// #Easy #Top_100_Liked_Questions #Depth_First_Search #Tree #Binary_Tree #Level_2_Day_7_Tree
-// #Udemy_Tree_Stack_Queue #2022_09_11_Time_307_ms_(43.93%)_Space_37.1_MB_(67.78%)
+// #Udemy_Tree_Stack_Queue #Big_O_Time_O(n)_Space_O(n)
+// #2022_09_11_Time_307_ms_(43.93%)_Space_37.1_MB_(67.78%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0501_0600/s0546_remove_boxes/Solution.kt b/src/main/kotlin/g0501_0600/s0546_remove_boxes/Solution.kt
index 7ad012f4f..05b96eef6 100644
--- a/src/main/kotlin/g0501_0600/s0546_remove_boxes/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0546_remove_boxes/Solution.kt
@@ -12,7 +12,7 @@ class Solution {
dp = Array(n + 1) {
Array(n + 1) {
IntArray(
- n + 1
+ n + 1,
)
}
}
diff --git a/src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt b/src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt
index 917ebdc01..a40fac0cf 100644
--- a/src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0547_number_of_provinces/Solution.kt
@@ -1,6 +1,6 @@
package g0501_0600.s0547_number_of_provinces
-// #Medium #Depth_First_Search #Breadth_First_Search #Graph #Union_Find
+// #Medium #Depth_First_Search #Breadth_First_Search #Graph #Union_Find #LeetCode_75_Graphs/DFS
// #Algorithm_II_Day_6_Breadth_First_Search_Depth_First_Search
// #Graph_Theory_I_Day_8_Standard_Traversal #Level_2_Day_19_Union_Find
// #2023_01_17_Time_229_ms_(79.73%)_Space_43_MB_(66.22%)
diff --git a/src/main/kotlin/g0501_0600/s0552_student_attendance_record_ii/Solution.kt b/src/main/kotlin/g0501_0600/s0552_student_attendance_record_ii/Solution.kt
index 9c01d04ae..3aab04004 100644
--- a/src/main/kotlin/g0501_0600/s0552_student_attendance_record_ii/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0552_student_attendance_record_ii/Solution.kt
@@ -2,8 +2,6 @@ package g0501_0600.s0552_student_attendance_record_ii
// #Hard #Dynamic_Programming #2023_01_17_Time_151_ms_(100.00%)_Space_33.3_MB_(100.00%)
-import java.util.Arrays
-
@Suppress("NAME_SHADOWING")
class Solution {
fun checkRecord(n: Int): Int {
@@ -17,11 +15,11 @@ class Solution {
longArrayOf(1, 0, 0, 1, 0, 0),
longArrayOf(0, 0, 0, 1, 1, 0),
longArrayOf(0, 0, 0, 1, 0, 1),
- longArrayOf(0, 0, 0, 1, 0, 0)
+ longArrayOf(0, 0, 0, 1, 0, 0),
)
val e = quickPower(matrix, n - 1)
return (
- (Arrays.stream(e[0]).sum() + Arrays.stream(e[1]).sum() + Arrays.stream(e[3]).sum()) %
+ (e[0].sum() + e[1].sum() + e[3].sum()) %
mod
).toInt()
}
diff --git a/src/main/kotlin/g0501_0600/s0556_next_greater_element_iii/Solution.kt b/src/main/kotlin/g0501_0600/s0556_next_greater_element_iii/Solution.kt
index 5a645c3de..d28b1b83a 100644
--- a/src/main/kotlin/g0501_0600/s0556_next_greater_element_iii/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0556_next_greater_element_iii/Solution.kt
@@ -14,7 +14,7 @@ class Solution {
look for largest index l such that inp[l] > inp[k]
swap the two index
reverse from k+1 to n.length
- */
+ */
fun nextGreaterElement(n: Int): Int {
val inp = n.toString().toCharArray()
// Find k
diff --git a/src/main/kotlin/g0501_0600/s0558_logical_or_of_two_binary_grids_represented_as_quad_trees/Solution.kt b/src/main/kotlin/g0501_0600/s0558_logical_or_of_two_binary_grids_represented_as_quad_trees/Solution.kt
index 7a9990b99..a93724fc6 100644
--- a/src/main/kotlin/g0501_0600/s0558_logical_or_of_two_binary_grids_represented_as_quad_trees/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0558_logical_or_of_two_binary_grids_represented_as_quad_trees/Solution.kt
@@ -25,11 +25,11 @@ class Solution {
val bl: Node? = intersect(quadTree1.bottomLeft, quadTree2.bottomLeft)
val br: Node? = intersect(quadTree1.bottomRight, quadTree2.bottomRight)
if ((
- tl!!.isLeaf &&
- tr!!.isLeaf &&
- bl!!.isLeaf &&
- br!!.isLeaf && tl.`val` == tr.`val`
- ) && tr.`val` == bl.`val` && br.`val` == bl.`val`
+ tl!!.isLeaf &&
+ tr!!.isLeaf &&
+ bl!!.isLeaf &&
+ br!!.isLeaf && tl.`val` == tr.`val`
+ ) && tr.`val` == bl.`val` && br.`val` == bl.`val`
) {
out.isLeaf = true
out.`val` = tl.`val`
diff --git a/src/main/kotlin/g0501_0600/s0560_subarray_sum_equals_k/Solution.kt b/src/main/kotlin/g0501_0600/s0560_subarray_sum_equals_k/Solution.kt
index 4198d4088..dafffb843 100644
--- a/src/main/kotlin/g0501_0600/s0560_subarray_sum_equals_k/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0560_subarray_sum_equals_k/Solution.kt
@@ -1,7 +1,7 @@
package g0501_0600.s0560_subarray_sum_equals_k
// #Medium #Top_100_Liked_Questions #Array #Hash_Table #Prefix_Sum #Data_Structure_II_Day_5_Array
-// #2022_09_11_Time_692_ms_(53.27%)_Space_70.5_MB_(24.30%)
+// #Big_O_Time_O(n)_Space_O(n) #2022_09_11_Time_692_ms_(53.27%)_Space_70.5_MB_(24.30%)
class Solution {
fun subarraySum(nums: IntArray, k: Int): Int {
diff --git a/src/main/kotlin/g0501_0600/s0564_find_the_closest_palindrome/Solution.kt b/src/main/kotlin/g0501_0600/s0564_find_the_closest_palindrome/Solution.kt
index 73e1f83e5..7e54ca3a2 100644
--- a/src/main/kotlin/g0501_0600/s0564_find_the_closest_palindrome/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0564_find_the_closest_palindrome/Solution.kt
@@ -12,10 +12,14 @@ class Solution {
val offset = Math.pow(10.0, (n.length / 2).toDouble()).toInt()
val first =
if (isPalindrome(n)) palindromeGenerator(num + offset, n.length) else palindromeGenerator(num, n.length)
- val second = if (first < num) palindromeGenerator(num + offset, n.length) else palindromeGenerator(
- num - offset,
- n.length
- )
+ val second = if (first < num) {
+ palindromeGenerator(num + offset, n.length)
+ } else {
+ palindromeGenerator(
+ num - offset,
+ n.length,
+ )
+ }
if (first + second == 2 * num) {
return if (first < second) first.toString() else second.toString()
}
diff --git a/src/main/kotlin/g0501_0600/s0567_permutation_in_string/Solution.kt b/src/main/kotlin/g0501_0600/s0567_permutation_in_string/Solution.kt
index e1e1ecbbf..31a9b2b38 100644
--- a/src/main/kotlin/g0501_0600/s0567_permutation_in_string/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0567_permutation_in_string/Solution.kt
@@ -1,7 +1,7 @@
package g0501_0600.s0567_permutation_in_string
-// #Medium #String #Hash_Table #Two_Pointers #Sliding_Window #Algorithm_I_Day_6_Sliding_Window
-// #2023_01_23_Time_169_ms_(100.00%)_Space_35.6_MB_(85.86%)
+// #Medium #Top_100_Liked_Questions #String #Hash_Table #Two_Pointers #Sliding_Window
+// #Algorithm_I_Day_6_Sliding_Window #2023_01_23_Time_169_ms_(100.00%)_Space_35.6_MB_(85.86%)
class Solution {
fun checkInclusion(s1: String, s2: String): Boolean {
diff --git a/src/main/kotlin/g0501_0600/s0572_subtree_of_another_tree/Solution.kt b/src/main/kotlin/g0501_0600/s0572_subtree_of_another_tree/Solution.kt
index dd55f58d2..f8ff4a4b4 100644
--- a/src/main/kotlin/g0501_0600/s0572_subtree_of_another_tree/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0572_subtree_of_another_tree/Solution.kt
@@ -37,8 +37,10 @@ class Solution {
}
return if (root == null || subRoot == null) {
false
- } else isSubtreeFound(root, subRoot) ||
- isSubtree(root.left, subRoot) ||
- isSubtree(root.right, subRoot)
+ } else {
+ isSubtreeFound(root, subRoot) ||
+ isSubtree(root.left, subRoot) ||
+ isSubtree(root.right, subRoot)
+ }
}
}
diff --git a/src/main/kotlin/g0501_0600/s0576_out_of_boundary_paths/Solution.kt b/src/main/kotlin/g0501_0600/s0576_out_of_boundary_paths/Solution.kt
index 78bb40911..0c172693a 100644
--- a/src/main/kotlin/g0501_0600/s0576_out_of_boundary_paths/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0576_out_of_boundary_paths/Solution.kt
@@ -10,7 +10,7 @@ class Solution {
remainingMoves: Int,
currRow: Int,
currCol: Int,
- cache: Array>
+ cache: Array>,
): Int {
if (currRow < 0 || currRow == m || currCol < 0 || currCol == n) {
return 1
@@ -35,7 +35,7 @@ class Solution {
val cache = Array(m) {
Array(n) {
IntArray(
- maxMoves + 1
+ maxMoves + 1,
)
}
}
diff --git a/src/main/kotlin/g0501_0600/s0583_delete_operation_for_two_strings/Solution.kt b/src/main/kotlin/g0501_0600/s0583_delete_operation_for_two_strings/Solution.kt
index 2fe8f068d..5af551623 100644
--- a/src/main/kotlin/g0501_0600/s0583_delete_operation_for_two_strings/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0583_delete_operation_for_two_strings/Solution.kt
@@ -10,10 +10,14 @@ class Solution {
val dp = Array(m + 1) { IntArray(n + 1) }
for (i in 1..m) {
for (j in 1..n) {
- dp[i][j] = if (word1[i - 1] == word2[j - 1]) dp[i - 1][j - 1] + 1 else Math.max(
- dp[i - 1][j],
- dp[i][j - 1]
- )
+ dp[i][j] = if (word1[i - 1] == word2[j - 1]) {
+ dp[i - 1][j - 1] + 1
+ } else {
+ Math.max(
+ dp[i - 1][j],
+ dp[i][j - 1],
+ )
+ }
}
}
return m + n - 2 * dp[m][n]
diff --git a/src/main/kotlin/g0501_0600/s0593_valid_square/Solution.kt b/src/main/kotlin/g0501_0600/s0593_valid_square/Solution.kt
index 654d1a7f2..6bbb8f7f5 100644
--- a/src/main/kotlin/g0501_0600/s0593_valid_square/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0593_valid_square/Solution.kt
@@ -20,7 +20,9 @@ class Solution {
}
return if (distancesSquared[4] != distancesSquared[5]) {
false
- } else distancesSquared[5] == 2 * distancesSquared[0]
+ } else {
+ distancesSquared[5] == 2 * distancesSquared[0]
+ }
}
private fun getDistanceSquared(p1: IntArray, p2: IntArray): Int {
diff --git a/src/main/kotlin/g0601_0700/s0605_can_place_flowers/Solution.kt b/src/main/kotlin/g0601_0700/s0605_can_place_flowers/Solution.kt
index a93ac75e9..10cb68643 100644
--- a/src/main/kotlin/g0601_0700/s0605_can_place_flowers/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0605_can_place_flowers/Solution.kt
@@ -1,6 +1,7 @@
package g0601_0700.s0605_can_place_flowers
-// #Easy #Array #Greedy #Udemy_Arrays #2023_02_03_Time_209_ms_(85.71%)_Space_37.3_MB_(71.43%)
+// #Easy #Array #Greedy #LeetCode_75_Array/String #Udemy_Arrays
+// #2023_02_03_Time_209_ms_(85.71%)_Space_37.3_MB_(71.43%)
@Suppress("NAME_SHADOWING")
class Solution {
diff --git a/src/main/kotlin/g0601_0700/s0606_construct_string_from_binary_tree/Solution.kt b/src/main/kotlin/g0601_0700/s0606_construct_string_from_binary_tree/Solution.kt
index 34f8deb5f..00744974f 100644
--- a/src/main/kotlin/g0601_0700/s0606_construct_string_from_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0606_construct_string_from_binary_tree/Solution.kt
@@ -1,6 +1,6 @@
package g0601_0700.s0606_construct_string_from_binary_tree
-// #Easy #String #Depth_First_Search #Tree #Binary_Tree
+// #Medium #String #Depth_First_Search #Tree #Binary_Tree
// #2023_02_03_Time_187_ms_(100.00%)_Space_38.8_MB_(90.91%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0601_0700/s0617_merge_two_binary_trees/Solution.kt b/src/main/kotlin/g0601_0700/s0617_merge_two_binary_trees/Solution.kt
index 02c427601..313bd4675 100644
--- a/src/main/kotlin/g0601_0700/s0617_merge_two_binary_trees/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0617_merge_two_binary_trees/Solution.kt
@@ -23,10 +23,12 @@ class Solution {
}
return if (root2 == null) {
root1
- } else TreeNode(
- root1.`val` + root2.`val`,
- mergeTrees(root1.left, root2.left),
- mergeTrees(root1.right, root2.right)
- )
+ } else {
+ TreeNode(
+ root1.`val` + root2.`val`,
+ mergeTrees(root1.left, root2.left),
+ mergeTrees(root1.right, root2.right),
+ )
+ }
}
}
diff --git a/src/main/kotlin/g0601_0700/s0620_not_boring_movies/script.sql b/src/main/kotlin/g0601_0700/s0620_not_boring_movies/script.sql
index fa4a301df..3d77c150c 100644
--- a/src/main/kotlin/g0601_0700/s0620_not_boring_movies/script.sql
+++ b/src/main/kotlin/g0601_0700/s0620_not_boring_movies/script.sql
@@ -1,7 +1,6 @@
# Write your MySQL query statement below
-# #Easy #Database #2023_02_06_Time_305_ms_(59.80%)_Space_0B_(100.00%)
-select id, movie, description, rating from Cinema
-WHERE mod(id,2) = 1
-and
-description not LIKE '%boring%'
-order by rating DESC;
+# #Easy #Database #2025_04_23_Time_259_ms_(64.69%)_Space_0.0_MB_(100.00%)
+SELECT id, movie, description, rating
+FROM Cinema
+WHERE description != 'boring' AND id % 2 != 0
+ORDER BY rating DESC;
diff --git a/src/main/kotlin/g0601_0700/s0622_design_circular_queue/MyCircularQueue.kt b/src/main/kotlin/g0601_0700/s0622_design_circular_queue/MyCircularQueue.kt
index 8ba4033f7..9fcebccff 100644
--- a/src/main/kotlin/g0601_0700/s0622_design_circular_queue/MyCircularQueue.kt
+++ b/src/main/kotlin/g0601_0700/s0622_design_circular_queue/MyCircularQueue.kt
@@ -40,13 +40,17 @@ class MyCircularQueue(private val maxSize: Int) {
fun Rear(): Int {
return if (size == 0) {
-1
- } else dumyHead.right!!.`val`
+ } else {
+ dumyHead.right!!.`val`
+ }
}
fun Front(): Int {
return if (size == 0) {
-1
- } else dumyHead.left!!.`val`
+ } else {
+ dumyHead.left!!.`val`
+ }
}
fun isEmpty(): Boolean {
diff --git a/src/main/kotlin/g0601_0700/s0637_average_of_levels_in_binary_tree/Solution.kt b/src/main/kotlin/g0601_0700/s0637_average_of_levels_in_binary_tree/Solution.kt
index 783349aca..b505c6b43 100644
--- a/src/main/kotlin/g0601_0700/s0637_average_of_levels_in_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0637_average_of_levels_in_binary_tree/Solution.kt
@@ -1,7 +1,7 @@
package g0601_0700.s0637_average_of_levels_in_binary_tree
// #Easy #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree
-// #2023_02_10_Time_249_ms_(100.00%)_Space_39.5_MB_(72.73%)
+// #Top_Interview_150_Binary_Tree_BFS #2023_02_10_Time_249_ms_(100.00%)_Space_39.5_MB_(72.73%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0601_0700/s0638_shopping_offers/Solution.kt b/src/main/kotlin/g0601_0700/s0638_shopping_offers/Solution.kt
index 77e8ddfe5..5f626ef65 100644
--- a/src/main/kotlin/g0601_0700/s0638_shopping_offers/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0638_shopping_offers/Solution.kt
@@ -7,7 +7,7 @@ class Solution {
fun shoppingOffers(
price: List,
special: List>,
- needs: List
+ needs: List,
): Int {
val map: MutableMap, Int> = HashMap()
shoppingOffersUtil(price, special, needs, map)
@@ -18,7 +18,7 @@ class Solution {
price: List,
special: List>,
needs: List,
- map: MutableMap, Int>
+ map: MutableMap, Int>,
): Int {
if (map.containsKey(needs)) {
return map[needs]!!
@@ -32,9 +32,9 @@ class Solution {
price,
special,
updatedNeeds(needs, special[i]),
- map
+ map,
),
- ans
+ ans,
)
}
}
diff --git a/src/main/kotlin/g0601_0700/s0641_design_circular_deque/MyCircularDeque.kt b/src/main/kotlin/g0601_0700/s0641_design_circular_deque/MyCircularDeque.kt
index 053bd4da8..f32cdd7aa 100644
--- a/src/main/kotlin/g0601_0700/s0641_design_circular_deque/MyCircularDeque.kt
+++ b/src/main/kotlin/g0601_0700/s0641_design_circular_deque/MyCircularDeque.kt
@@ -58,13 +58,17 @@ class MyCircularDeque(k: Int) {
fun getFront(): Int {
return if (size == 0) {
-1
- } else data[(front - 1 + data.size) % data.size]
+ } else {
+ data[(front - 1 + data.size) % data.size]
+ }
}
fun getRear(): Int {
return if (size == 0) {
-1
- } else data[(rear + 1) % data.size]
+ } else {
+ data[(rear + 1) % data.size]
+ }
}
fun isEmpty(): Boolean {
diff --git a/src/main/kotlin/g0601_0700/s0643_maximum_average_subarray_i/Solution.kt b/src/main/kotlin/g0601_0700/s0643_maximum_average_subarray_i/Solution.kt
index f97b8fa20..f516650b9 100644
--- a/src/main/kotlin/g0601_0700/s0643_maximum_average_subarray_i/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0643_maximum_average_subarray_i/Solution.kt
@@ -1,6 +1,7 @@
package g0601_0700.s0643_maximum_average_subarray_i
-// #Easy #Array #Sliding_Window #2023_02_11_Time_494_ms_(98.65%)_Space_45.8_MB_(95.95%)
+// #Easy #Array #Sliding_Window #LeetCode_75_Sliding_Window
+// #2023_02_11_Time_494_ms_(98.65%)_Space_45.8_MB_(95.95%)
class Solution {
fun findMaxAverage(nums: IntArray, k: Int): Double {
diff --git a/src/main/kotlin/g0601_0700/s0647_palindromic_substrings/Solution.kt b/src/main/kotlin/g0601_0700/s0647_palindromic_substrings/Solution.kt
index 769550508..b952abfb5 100644
--- a/src/main/kotlin/g0601_0700/s0647_palindromic_substrings/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0647_palindromic_substrings/Solution.kt
@@ -1,6 +1,6 @@
package g0601_0700.s0647_palindromic_substrings
-// #Medium #Top_100_Liked_Questions #String #Dynamic_Programming
+// #Medium #String #Dynamic_Programming #Big_O_Time_O(n^2)_Space_O(n)
// #2022_09_11_Time_266_ms_(67.83%)_Space_34_MB_(93.91%)
class Solution {
diff --git a/src/main/kotlin/g0601_0700/s0649_dota2_senate/Solution.kt b/src/main/kotlin/g0601_0700/s0649_dota2_senate/Solution.kt
index 57c1a6b72..f84de5caf 100644
--- a/src/main/kotlin/g0601_0700/s0649_dota2_senate/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0649_dota2_senate/Solution.kt
@@ -1,6 +1,7 @@
package g0601_0700.s0649_dota2_senate
-// #Medium #String #Greedy #Queue #2023_02_12_Time_217_ms_(100.00%)_Space_36.1_MB_(100.00%)
+// #Medium #String #Greedy #Queue #LeetCode_75_Queue
+// #2023_02_12_Time_217_ms_(100.00%)_Space_36.1_MB_(100.00%)
class Solution {
fun predictPartyVictory(senate: String): String {
diff --git a/src/main/kotlin/g0601_0700/s0655_print_binary_tree/Solution.kt b/src/main/kotlin/g0601_0700/s0655_print_binary_tree/Solution.kt
index 3813b15c9..0b7902a63 100644
--- a/src/main/kotlin/g0601_0700/s0655_print_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0655_print_binary_tree/Solution.kt
@@ -39,7 +39,7 @@ class Solution {
row: Int,
totalRows: Int,
i: Int,
- j: Int
+ j: Int,
) {
if (row == totalRows || root == null) {
return
@@ -52,6 +52,8 @@ class Solution {
private fun getHeight(root: TreeNode?): Int {
return if (root == null) {
0
- } else 1 + getHeight(root.left).coerceAtLeast(getHeight(root.right))
+ } else {
+ 1 + getHeight(root.left).coerceAtLeast(getHeight(root.right))
+ }
}
}
diff --git a/src/main/kotlin/g0601_0700/s0675_cut_off_trees_for_golf_event/Solution.kt b/src/main/kotlin/g0601_0700/s0675_cut_off_trees_for_golf_event/Solution.kt
index ca1177466..1c1db9a14 100644
--- a/src/main/kotlin/g0601_0700/s0675_cut_off_trees_for_golf_event/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0675_cut_off_trees_for_golf_event/Solution.kt
@@ -36,7 +36,7 @@ class Solution {
val dirs = arrayOf(intArrayOf(0, 1), intArrayOf(0, -1), intArrayOf(1, 0), intArrayOf(-1, 0))
val visited = Array(forest.size) {
BooleanArray(
- forest[0].size
+ forest[0].size,
)
}
val q: Queue = LinkedList()
diff --git a/src/main/kotlin/g0601_0700/s0679_24_game/Solution.kt b/src/main/kotlin/g0601_0700/s0679_24_game/Solution.kt
index accc2edf6..cc612a47f 100644
--- a/src/main/kotlin/g0601_0700/s0679_24_game/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0679_24_game/Solution.kt
@@ -2,11 +2,10 @@ package g0601_0700.s0679_24_game
// #Hard #Array #Math #Backtracking #2023_02_16_Time_175_ms_(100.00%)_Space_34.7_MB_(100.00%)
-import java.util.Arrays
import kotlin.math.abs
class Solution {
- private fun backtrack(list: DoubleArray, n: Int): Boolean {
+ private fun backtrack(list: Array, n: Int): Boolean {
if (n == 1) {
return abs(list[0] - 24) < EPS
}
@@ -51,7 +50,7 @@ class Solution {
}
fun judgePoint24(nums: IntArray): Boolean {
- val a = Arrays.stream(nums).asDoubleStream().toArray()
+ val a = nums.map { it.toDouble() }.toTypedArray()
return backtrack(a, a.size)
}
diff --git a/src/main/kotlin/g0601_0700/s0684_redundant_connection/Solution.kt b/src/main/kotlin/g0601_0700/s0684_redundant_connection/Solution.kt
index ac207ae6b..753c7229a 100644
--- a/src/main/kotlin/g0601_0700/s0684_redundant_connection/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0684_redundant_connection/Solution.kt
@@ -29,6 +29,8 @@ class Solution {
private fun find(x: Int): Int {
return if (par[x] == x) {
x
- } else find(par[x])
+ } else {
+ find(par[x])
+ }
}
}
diff --git a/src/main/kotlin/g0601_0700/s0685_redundant_connection_ii/Solution.kt b/src/main/kotlin/g0601_0700/s0685_redundant_connection_ii/Solution.kt
index 748a19060..a6f40fc50 100644
--- a/src/main/kotlin/g0601_0700/s0685_redundant_connection_ii/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0685_redundant_connection_ii/Solution.kt
@@ -48,6 +48,8 @@ class Solution {
private fun find(x: Int): Int {
return if (par[x] == x) {
x
- } else find(par[x])
+ } else {
+ find(par[x])
+ }
}
}
diff --git a/src/main/kotlin/g0601_0700/s0688_knight_probability_in_chessboard/Solution.kt b/src/main/kotlin/g0601_0700/s0688_knight_probability_in_chessboard/Solution.kt
index aa3e33e28..8b5b86500 100644
--- a/src/main/kotlin/g0601_0700/s0688_knight_probability_in_chessboard/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0688_knight_probability_in_chessboard/Solution.kt
@@ -11,14 +11,14 @@ class Solution {
intArrayOf(2, -1),
intArrayOf(2, 1),
intArrayOf(1, -2),
- intArrayOf(-1, -2)
+ intArrayOf(-1, -2),
)
private lateinit var probabilityGiven: Array>
fun knightProbability(n: Int, k: Int, row: Int, column: Int): Double {
probabilityGiven = Array(n) {
Array(n) {
DoubleArray(
- k + 1
+ k + 1,
)
}
}
diff --git a/src/main/kotlin/g0601_0700/s0691_stickers_to_spell_word/Solution.kt b/src/main/kotlin/g0601_0700/s0691_stickers_to_spell_word/Solution.kt
index c2df26149..e48b079ca 100644
--- a/src/main/kotlin/g0601_0700/s0691_stickers_to_spell_word/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0691_stickers_to_spell_word/Solution.kt
@@ -24,7 +24,9 @@ class Solution {
val res = dp(0, target)
return if (res > target.length) {
-1
- } else res
+ } else {
+ res
+ }
}
private fun dp(bits: Int, target: String): Int {
diff --git a/src/main/kotlin/g0601_0700/s0692_top_k_frequent_words/Solution.kt b/src/main/kotlin/g0601_0700/s0692_top_k_frequent_words/Solution.kt
index bbfc9393f..43f680df4 100644
--- a/src/main/kotlin/g0601_0700/s0692_top_k_frequent_words/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0692_top_k_frequent_words/Solution.kt
@@ -21,7 +21,7 @@ class Solution {
} else {
key.compareTo(key1, ignoreCase = true)
}
- }
+ },
)
sortedset.addAll(map.entries)
val result: MutableList = ArrayList()
diff --git a/src/main/kotlin/g0601_0700/s0695_max_area_of_island/Solution.kt b/src/main/kotlin/g0601_0700/s0695_max_area_of_island/Solution.kt
index 0e49f6304..5b350bdd9 100644
--- a/src/main/kotlin/g0601_0700/s0695_max_area_of_island/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0695_max_area_of_island/Solution.kt
@@ -3,7 +3,7 @@ package g0601_0700.s0695_max_area_of_island
// #Medium #Array #Depth_First_Search #Breadth_First_Search #Matrix #Union_Find
// #Algorithm_I_Day_7_Breadth_First_Search_Depth_First_Search
// #Graph_Theory_I_Day_2_Matrix_Related_Problems
-// #2023_02_22_Time_324_ms_(24.06%)_Space_47.2_MB_(21.92%)
+// #2024_05_09_Time_181_ms_(93.83%)_Space_38.9_MB_(77.78%)
@Suppress("NAME_SHADOWING")
class Solution {
diff --git a/src/main/kotlin/g0601_0700/s0700_search_in_a_binary_search_tree/Solution.kt b/src/main/kotlin/g0601_0700/s0700_search_in_a_binary_search_tree/Solution.kt
index a44a7396a..f7d148b0a 100644
--- a/src/main/kotlin/g0601_0700/s0700_search_in_a_binary_search_tree/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0700_search_in_a_binary_search_tree/Solution.kt
@@ -1,7 +1,7 @@
package g0601_0700.s0700_search_in_a_binary_search_tree
-// #Easy #Tree #Binary_Tree #Binary_Search_Tree #Data_Structure_I_Day_13_Tree
-// #2023_02_22_Time_251_ms_(88.31%)_Space_51_MB_(7.79%)
+// #Easy #Tree #Binary_Tree #Binary_Search_Tree #LeetCode_75_Binary_Search_Tree
+// #Data_Structure_I_Day_13_Tree #2023_02_22_Time_251_ms_(88.31%)_Space_51_MB_(7.79%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt b/src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt
index 0e780f7b8..1606f2977 100644
--- a/src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt
@@ -18,7 +18,7 @@ import com_github_leetcode.TreeNode
class Solution {
fun insertIntoBST(
root: TreeNode?,
- value: Int
+ value: Int,
): TreeNode? {
if (root == null) {
return TreeNode(value)
diff --git a/src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt b/src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt
index 800374d94..de87c3a22 100644
--- a/src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt
@@ -1,7 +1,7 @@
package g0701_0800.s0704_binary_search
-// #Easy #Array #Binary_Search #Algorithm_I_Day_1_Binary_Search #Binary_Search_I_Day_1
-// #Level_1_Day_7_Binary_Search #Udemy_Binary_Search
+// #Easy #Top_100_Liked_Questions #Array #Binary_Search #Algorithm_I_Day_1_Binary_Search
+// #Binary_Search_I_Day_1 #Level_1_Day_7_Binary_Search #Udemy_Binary_Search
// #2023_02_23_Time_261_ms_(77.91%)_Space_38.7_MB_(34.19%)
class Solution {
diff --git a/src/main/kotlin/g0701_0800/s0710_random_pick_with_blacklist/Solution.kt b/src/main/kotlin/g0701_0800/s0710_random_pick_with_blacklist/Solution.kt
index 9ec9bd4d6..bdd4ae820 100644
--- a/src/main/kotlin/g0701_0800/s0710_random_pick_with_blacklist/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0710_random_pick_with_blacklist/Solution.kt
@@ -31,7 +31,9 @@ class Solution(n: Int, blacklist: IntArray) {
val `val`: Int = Random.nextInt(upperLimit)
return if (map.containsKey(`val`)) {
map[`val`]!!
- } else `val`
+ } else {
+ `val`
+ }
}
}
diff --git a/src/main/kotlin/g0701_0800/s0714_best_time_to_buy_and_sell_stock_with_transaction_fee/Solution.kt b/src/main/kotlin/g0701_0800/s0714_best_time_to_buy_and_sell_stock_with_transaction_fee/Solution.kt
index aaac9e3e1..f133b3b18 100644
--- a/src/main/kotlin/g0701_0800/s0714_best_time_to_buy_and_sell_stock_with_transaction_fee/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0714_best_time_to_buy_and_sell_stock_with_transaction_fee/Solution.kt
@@ -1,7 +1,7 @@
package g0701_0800.s0714_best_time_to_buy_and_sell_stock_with_transaction_fee
-// #Medium #Array #Dynamic_Programming #Greedy #Dynamic_Programming_I_Day_8
-// #2023_02_25_Time_417_ms_(90.91%)_Space_46.1_MB_(75.00%)
+// #Medium #Array #Dynamic_Programming #Greedy #LeetCode_75_DP/Multidimensional
+// #Dynamic_Programming_I_Day_8 #2023_02_25_Time_417_ms_(90.91%)_Space_46.1_MB_(75.00%)
class Solution {
fun maxProfit(prices: IntArray, fee: Int): Int {
diff --git a/src/main/kotlin/g0701_0800/s0724_find_pivot_index/Solution.kt b/src/main/kotlin/g0701_0800/s0724_find_pivot_index/Solution.kt
index 39ed15750..343d48ea5 100644
--- a/src/main/kotlin/g0701_0800/s0724_find_pivot_index/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0724_find_pivot_index/Solution.kt
@@ -1,6 +1,6 @@
package g0701_0800.s0724_find_pivot_index
-// #Easy #Array #Prefix_Sum #Level_1_Day_1_Prefix_Sum
+// #Easy #Array #Prefix_Sum #LeetCode_75_Prefix_Sum #Level_1_Day_1_Prefix_Sum
// #2023_02_28_Time_255_ms_(88.92%)_Space_38.7_MB_(93.26%)
class Solution {
diff --git a/src/main/kotlin/g0701_0800/s0726_number_of_atoms/Solution.kt b/src/main/kotlin/g0701_0800/s0726_number_of_atoms/Solution.kt
index e931bf0ec..17b402641 100644
--- a/src/main/kotlin/g0701_0800/s0726_number_of_atoms/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0726_number_of_atoms/Solution.kt
@@ -7,7 +7,7 @@ class Solution {
data class Item(
var title: String = "",
var total: String = "",
- var count: Int = 0
+ var count: Int = 0,
) {
fun getT(): String {
return if (total == "") "1" else total
diff --git a/src/main/kotlin/g0701_0800/s0735_asteroid_collision/Solution.kt b/src/main/kotlin/g0701_0800/s0735_asteroid_collision/Solution.kt
index a9e7b06aa..136f8ff41 100644
--- a/src/main/kotlin/g0701_0800/s0735_asteroid_collision/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0735_asteroid_collision/Solution.kt
@@ -1,6 +1,6 @@
package g0701_0800.s0735_asteroid_collision
-// #Medium #Array #Stack #Level_2_Day_18_Stack
+// #Medium #Array #Stack #LeetCode_75_Stack #Level_2_Day_18_Stack
// #2023_03_02_Time_243_ms_(100.00%)_Space_37.9_MB_(88.46%)
import java.util.Deque
diff --git a/src/main/kotlin/g0701_0800/s0739_daily_temperatures/Solution.kt b/src/main/kotlin/g0701_0800/s0739_daily_temperatures/Solution.kt
index b00fd1980..9b11266de 100644
--- a/src/main/kotlin/g0701_0800/s0739_daily_temperatures/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0739_daily_temperatures/Solution.kt
@@ -1,6 +1,7 @@
package g0701_0800.s0739_daily_temperatures
-// #Medium #Top_100_Liked_Questions #Array #Stack #Monotonic_Stack #Programming_Skills_II_Day_6
+// #Medium #Top_100_Liked_Questions #Array #Stack #Monotonic_Stack #LeetCode_75_Monotonic_Stack
+// #Programming_Skills_II_Day_6 #Big_O_Time_O(n)_Space_O(n)
// #2022_09_13_Time_936_ms_(80.54%)_Space_79.5_MB_(63.09%)
class Solution {
diff --git a/src/main/kotlin/g0701_0800/s0741_cherry_pickup/Solution.kt b/src/main/kotlin/g0701_0800/s0741_cherry_pickup/Solution.kt
index be30563f2..67a09359c 100644
--- a/src/main/kotlin/g0701_0800/s0741_cherry_pickup/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0741_cherry_pickup/Solution.kt
@@ -8,7 +8,7 @@ class Solution {
val dp = Array(grid.size) {
Array(grid.size) {
IntArray(
- grid.size
+ grid.size,
)
}
}
diff --git a/src/main/kotlin/g0701_0800/s0746_min_cost_climbing_stairs/Solution.kt b/src/main/kotlin/g0701_0800/s0746_min_cost_climbing_stairs/Solution.kt
index 13515dc75..4af985f44 100644
--- a/src/main/kotlin/g0701_0800/s0746_min_cost_climbing_stairs/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0746_min_cost_climbing_stairs/Solution.kt
@@ -1,6 +1,6 @@
package g0701_0800.s0746_min_cost_climbing_stairs
-// #Easy #Array #Dynamic_Programming #Dynamic_Programming_I_Day_2
+// #Easy #Array #Dynamic_Programming #LeetCode_75_DP/1D #Dynamic_Programming_I_Day_2
// #Level_1_Day_11_Dynamic_Programming #2023_03_04_Time_171_ms_(96.76%)_Space_36_MB_(78.14%)
class Solution {
diff --git a/src/main/kotlin/g0701_0800/s0749_contain_virus/Solution.kt b/src/main/kotlin/g0701_0800/s0749_contain_virus/Solution.kt
index ce5ed4480..ae06bd285 100644
--- a/src/main/kotlin/g0701_0800/s0749_contain_virus/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0749_contain_virus/Solution.kt
@@ -67,7 +67,7 @@ class Solution {
islands: MutableMap>,
scores: MutableMap>,
walls: MutableMap,
- id: Int
+ id: Int,
) {
if (!visited.add(i * n + j)) {
return
@@ -84,7 +84,7 @@ class Solution {
}
if (grid[x][y] == 0) {
scores.computeIfAbsent(
- id
+ id,
) { HashSet() }.add(x * n + y)
walls[id] = walls.getOrDefault(id, 0) + 1
}
diff --git a/src/main/kotlin/g0701_0800/s0753_cracking_the_safe/Solution.kt b/src/main/kotlin/g0701_0800/s0753_cracking_the_safe/Solution.kt
index 04bde56dc..1834690f5 100644
--- a/src/main/kotlin/g0701_0800/s0753_cracking_the_safe/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0753_cracking_the_safe/Solution.kt
@@ -27,7 +27,7 @@ class Solution {
prev: Int,
visited: BooleanArray,
visitedCnt: Int,
- targetCnt: Int
+ targetCnt: Int,
) {
if (foundStr != null) {
return
diff --git a/src/main/kotlin/g0701_0800/s0757_set_intersection_size_at_least_two/Solution.kt b/src/main/kotlin/g0701_0800/s0757_set_intersection_size_at_least_two/Solution.kt
index a62ee5ea4..6d8028004 100644
--- a/src/main/kotlin/g0701_0800/s0757_set_intersection_size_at_least_two/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0757_set_intersection_size_at_least_two/Solution.kt
@@ -7,7 +7,9 @@ class Solution {
intervals.sortWith { a, b ->
if (a[1] == b[1]) {
b[0] - a[0]
- } else a[1] - b[1]
+ } else {
+ a[1] - b[1]
+ }
}
val list: MutableList = ArrayList()
list.add(intervals[0][1] - 1)
diff --git a/src/main/kotlin/g0701_0800/s0761_special_binary_string/Solution.kt b/src/main/kotlin/g0701_0800/s0761_special_binary_string/Solution.kt
index 83d7c1a5b..1fac584bf 100644
--- a/src/main/kotlin/g0701_0800/s0761_special_binary_string/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0761_special_binary_string/Solution.kt
@@ -11,7 +11,7 @@ class Solution {
}
val pq = PriorityQueue { a: String?, b: String? ->
b!!.compareTo(
- a!!
+ a!!,
)
}
var acc = 1
diff --git a/src/main/kotlin/g0701_0800/s0763_partition_labels/Solution.kt b/src/main/kotlin/g0701_0800/s0763_partition_labels/Solution.kt
index c3cd36b49..c4f9e9589 100644
--- a/src/main/kotlin/g0701_0800/s0763_partition_labels/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0763_partition_labels/Solution.kt
@@ -1,7 +1,7 @@
package g0701_0800.s0763_partition_labels
-// #Medium #Top_100_Liked_Questions #String #Hash_Table #Greedy #Two_Pointers
-// #Data_Structure_II_Day_7_String #2022_09_13_Time_235_ms_(84.75%)_Space_35.2_MB_(91.53%)
+// #Medium #String #Hash_Table #Greedy #Two_Pointers #Data_Structure_II_Day_7_String
+// #Big_O_Time_O(n)_Space_O(1) #2022_09_13_Time_235_ms_(84.75%)_Space_35.2_MB_(91.53%)
class Solution {
fun partitionLabels(s: String): List {
diff --git a/src/main/kotlin/g0701_0800/s0764_largest_plus_sign/Solution.kt b/src/main/kotlin/g0701_0800/s0764_largest_plus_sign/Solution.kt
index 38cce3b27..64cc5af00 100644
--- a/src/main/kotlin/g0701_0800/s0764_largest_plus_sign/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0764_largest_plus_sign/Solution.kt
@@ -30,7 +30,7 @@ class Solution {
val i2 = if (i == n - 1) 0 else down[i + 1][j]
down[i][j] = if (mat[i][j]) 0 else 1 + i2
val x = left[i][j].coerceAtMost(up[i][j]).coerceAtMost(
- right[i][j].coerceAtMost(down[i][j])
+ right[i][j].coerceAtMost(down[i][j]),
)
ans = ans.coerceAtLeast(x)
}
diff --git a/src/main/kotlin/g0701_0800/s0770_basic_calculator_iv/Solution.kt b/src/main/kotlin/g0701_0800/s0770_basic_calculator_iv/Solution.kt
index 8bbb7b636..3be9aba5b 100644
--- a/src/main/kotlin/g0701_0800/s0770_basic_calculator_iv/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0770_basic_calculator_iv/Solution.kt
@@ -4,9 +4,8 @@ package g0701_0800.s0770_basic_calculator_iv
// #2023_03_10_Time_222_ms_(100.00%)_Space_39.2_MB_(100.00%)
import java.util.Collections
-import java.util.Stack
-internal class Solution {
+class Solution {
internal inner class Node {
var mem: MutableMap, Int> = HashMap()
fun update(cur: List, cnt: Int) {
@@ -49,7 +48,7 @@ internal class Solution {
return ans
}
- fun evaluate(vars: Map): Node {
+ fun evaluate(vars: Map): Node {
val ans = Node()
for (cur in mem.keys) {
var cnt = mem[cur]!!
@@ -70,7 +69,7 @@ internal class Solution {
val ans: MutableList = ArrayList()
val keys: List> = ArrayList(mem.keys)
Collections.sort(
- keys
+ keys,
) { a: List, b: List ->
if (a.size != b.size) {
return@sort b.size - a.size
@@ -98,7 +97,7 @@ internal class Solution {
}
private fun make(cur: String): Node {
- val ans: Node = Node()
+ val ans = Node()
val tmp: MutableList = ArrayList()
if (Character.isDigit(cur[0])) {
ans.update(tmp, Integer.valueOf(cur))
@@ -126,10 +125,10 @@ internal class Solution {
return 0
}
- private fun helper(numS: Stack, ops: Stack): Node {
- val b = numS.pop()
- val a = numS.pop()
- val op = ops.pop()
+ private fun helper(numS: ArrayDeque, ops: ArrayDeque): Node {
+ val b = numS.removeLast()
+ val a = numS.removeLast()
+ val op = ops.removeLast()
if (op == '*') {
return a.mul(b)
} else if (op == '+') {
@@ -138,18 +137,18 @@ internal class Solution {
return a.sub(b)
}
- fun basicCalculatorIV(expression: String?, evalvarS: Array?, evalintS: IntArray?): List {
+ fun basicCalculatorIV(expression: String, evalvars: Array, evalints: IntArray): List {
val ans: List = ArrayList()
- if (expression.isNullOrEmpty() || evalvarS == null || evalintS == null) {
+ if (expression.isEmpty()) {
return ans
}
- val vars: MutableMap = HashMap()
- for (i in evalvarS.indices) {
- vars[evalvarS[i]] = evalintS[i]
+ val vars: MutableMap = HashMap()
+ for (i in evalvars.indices) {
+ vars[evalvars[i]] = evalints[i]
}
val n = expression.length
- val numS = Stack()
- val ops = Stack()
+ val numS = ArrayDeque()
+ val ops = ArrayDeque()
var i = 0
while (i < n) {
val a = expression[i]
@@ -162,12 +161,12 @@ internal class Solution {
} else if (a == '(') {
ops.add(a)
} else if (a == ')') {
- while (ops.peek() != '(') {
+ while (ops.last() != '(') {
numS.add(helper(numS, ops))
}
- ops.pop()
+ ops.removeLast()
} else if (a == '+' || a == '-' || a == '*') {
- while (ops.isNotEmpty() && getPriority(ops.peek()) >= getPriority(a)) {
+ while (ops.isNotEmpty() && getPriority(ops.last()) >= getPriority(a)) {
numS.add(helper(numS, ops))
}
ops.add(a)
@@ -177,6 +176,6 @@ internal class Solution {
while (ops.isNotEmpty()) {
numS.add(helper(numS, ops))
}
- return numS.peek().evaluate(vars).toList()
+ return numS.last().evaluate(vars).toList()
}
}
diff --git a/src/main/kotlin/g0701_0800/s0778_swim_in_rising_water/Solution.kt b/src/main/kotlin/g0701_0800/s0778_swim_in_rising_water/Solution.kt
index 616382bc3..13c2711f1 100644
--- a/src/main/kotlin/g0701_0800/s0778_swim_in_rising_water/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0778_swim_in_rising_water/Solution.kt
@@ -43,7 +43,7 @@ class Solution {
// boolean array to keep track of visited cells
val visited = Array(grid.size) {
BooleanArray(
- grid[0].size
+ grid[0].size,
)
}
// we start from top left corner
diff --git a/src/main/kotlin/g0701_0800/s0790_domino_and_tromino_tiling/Solution.kt b/src/main/kotlin/g0701_0800/s0790_domino_and_tromino_tiling/Solution.kt
index c92141bac..9ee2c9281 100644
--- a/src/main/kotlin/g0701_0800/s0790_domino_and_tromino_tiling/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0790_domino_and_tromino_tiling/Solution.kt
@@ -1,6 +1,7 @@
package g0701_0800.s0790_domino_and_tromino_tiling
-// #Medium #Dynamic_Programming #2023_03_13_Time_116_ms_(100.00%)_Space_32.6_MB_(100.00%)
+// #Medium #Dynamic_Programming #LeetCode_75_DP/1D
+// #2023_03_13_Time_116_ms_(100.00%)_Space_32.6_MB_(100.00%)
class Solution {
fun numTilings(n: Int): Int {
diff --git a/src/main/kotlin/g0701_0800/s0794_valid_tic_tac_toe_state/Solution.kt b/src/main/kotlin/g0701_0800/s0794_valid_tic_tac_toe_state/Solution.kt
index b8f7192d4..0018c9afa 100644
--- a/src/main/kotlin/g0701_0800/s0794_valid_tic_tac_toe_state/Solution.kt
+++ b/src/main/kotlin/g0701_0800/s0794_valid_tic_tac_toe_state/Solution.kt
@@ -59,6 +59,8 @@ class Solution {
}
return if (sum == 0 && !xWin) {
true
- } else sum == 1 && !oWin
+ } else {
+ sum == 1 && !oWin
+ }
}
}
diff --git a/src/main/kotlin/g0801_0900/s0804_unique_morse_code_words/Solution.kt b/src/main/kotlin/g0801_0900/s0804_unique_morse_code_words/Solution.kt
index ab9e5f6df..9c0461420 100644
--- a/src/main/kotlin/g0801_0900/s0804_unique_morse_code_words/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0804_unique_morse_code_words/Solution.kt
@@ -7,7 +7,7 @@ class Solution {
val morse = arrayOf(
".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..",
"--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-",
- "-.--", "--.."
+ "-.--", "--..",
)
val set: MutableSet = HashSet()
for (word in words) {
diff --git a/src/main/kotlin/g0801_0900/s0808_soup_servings/Solution.kt b/src/main/kotlin/g0801_0900/s0808_soup_servings/Solution.kt
index fd6e96585..702caecc1 100644
--- a/src/main/kotlin/g0801_0900/s0808_soup_servings/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0808_soup_servings/Solution.kt
@@ -14,7 +14,9 @@ class Solution {
n = n / 25 + if (n % 25 > 0) 1 else 0
return if (n >= 500) {
1.0
- } else find(n, n, Array(n + 1) { arrayOfNulls(n + 1) })
+ } else {
+ find(n, n, Array(n + 1) { arrayOfNulls(n + 1) })
+ }
}
private fun find(a: Int, b: Int, mem: Array>): Double {
diff --git a/src/main/kotlin/g0801_0900/s0811_subdomain_visit_count/Solution.kt b/src/main/kotlin/g0801_0900/s0811_subdomain_visit_count/Solution.kt
index 168ec55c0..42b081348 100644
--- a/src/main/kotlin/g0801_0900/s0811_subdomain_visit_count/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0811_subdomain_visit_count/Solution.kt
@@ -8,7 +8,7 @@ class Solution {
val fmap: MutableMap = HashMap()
for (s in d) {
var rep = 0
- var i: Int = 0
+ var i = 0
while (i < s.length) {
val c = s[i]
rep = if (c in '0'..'9') {
diff --git a/src/main/kotlin/g0801_0900/s0814_binary_tree_pruning/Solution.kt b/src/main/kotlin/g0801_0900/s0814_binary_tree_pruning/Solution.kt
index 4ef05901a..8effe1189 100644
--- a/src/main/kotlin/g0801_0900/s0814_binary_tree_pruning/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0814_binary_tree_pruning/Solution.kt
@@ -24,6 +24,8 @@ class Solution {
root.right = pruneTree(root.right)
return if (root.left == null && root.right == null && root.`val` == 0) {
null
- } else root
+ } else {
+ root
+ }
}
}
diff --git a/src/main/kotlin/g0801_0900/s0815_bus_routes/Solution.kt b/src/main/kotlin/g0801_0900/s0815_bus_routes/Solution.kt
index fbfd72dc3..481bcfb29 100644
--- a/src/main/kotlin/g0801_0900/s0815_bus_routes/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0815_bus_routes/Solution.kt
@@ -44,7 +44,7 @@ class Solution {
target: Int,
queue: Queue,
targetRoutes: MutableSet,
- taken: BooleanArray
+ taken: BooleanArray,
): Array?> {
val len = routes.size
val graph: Array?> = arrayOfNulls(len)
diff --git a/src/main/kotlin/g0801_0900/s0816_ambiguous_coordinates/Solution.kt b/src/main/kotlin/g0801_0900/s0816_ambiguous_coordinates/Solution.kt
index b8f4ebc1f..33966452a 100644
--- a/src/main/kotlin/g0801_0900/s0816_ambiguous_coordinates/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0816_ambiguous_coordinates/Solution.kt
@@ -34,7 +34,7 @@ class Solution {
dp1Idx,
commaPos,
sc.size - 2,
- dp2Idx
+ dp2Idx,
)
}
}
@@ -60,7 +60,7 @@ class Solution {
dp1Idx: Int,
start2Idx: Int,
last2Idx: Int,
- dp2Idx: Int
+ dp2Idx: Int,
) {
sb.setLength(0)
sb.append('(')
diff --git a/src/main/kotlin/g0801_0900/s0835_image_overlap/Solution.kt b/src/main/kotlin/g0801_0900/s0835_image_overlap/Solution.kt
index 0cc7aa037..9ec4325ff 100644
--- a/src/main/kotlin/g0801_0900/s0835_image_overlap/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0835_image_overlap/Solution.kt
@@ -15,7 +15,7 @@ class Solution {
for (i in -1 * veti until n) {
curOverLapping += if (hori < 0) {
Integer.bitCount(
- bits1[i] shl -1 * hori and bits2[i - -1 * veti]
+ bits1[i] shl -1 * hori and bits2[i - -1 * veti],
)
} else {
Integer.bitCount(bits1[i] shr hori and bits2[i - -1 * veti])
diff --git a/src/main/kotlin/g0801_0900/s0840_magic_squares_in_grid/Solution.kt b/src/main/kotlin/g0801_0900/s0840_magic_squares_in_grid/Solution.kt
index 5e0b0ad4c..62ecf2357 100644
--- a/src/main/kotlin/g0801_0900/s0840_magic_squares_in_grid/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0840_magic_squares_in_grid/Solution.kt
@@ -16,8 +16,8 @@ class Solution {
sum == grid[i][j + 1] + grid[i + 1][j + 1] + grid[i + 2][j + 1] && sum == grid[i][j + 2] +
grid[i + 1][j + 2] + grid[i + 2][j + 2] && sum == grid[i][j] + grid[i + 1][j + 1] +
grid[i + 2][j + 2] && sum == grid[i][j + 2] + grid[i + 1][j + 1] + grid[i + 2][j] && set.add(
- grid[i][j]
- ) &&
+ grid[i][j],
+ ) &&
isLegit(grid[i][j]) &&
set.add(grid[i][j + 1]) &&
isLegit(grid[i][j + 1]) &&
diff --git a/src/main/kotlin/g0801_0900/s0841_keys_and_rooms/Solution.kt b/src/main/kotlin/g0801_0900/s0841_keys_and_rooms/Solution.kt
index 3e958de0d..e9242395a 100644
--- a/src/main/kotlin/g0801_0900/s0841_keys_and_rooms/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0841_keys_and_rooms/Solution.kt
@@ -1,7 +1,8 @@
package g0801_0900.s0841_keys_and_rooms
-// #Medium #Depth_First_Search #Breadth_First_Search #Graph #Data_Structure_II_Day_19_Graph
-// #Graph_Theory_I_Day_7_Standard_Traversal #2023_03_28_Time_189_ms_(69.23%)_Space_35.5_MB_(97.44%)
+// #Medium #Depth_First_Search #Breadth_First_Search #Graph #LeetCode_75_Graphs/DFS
+// #Data_Structure_II_Day_19_Graph #Graph_Theory_I_Day_7_Standard_Traversal
+// #2023_03_28_Time_189_ms_(69.23%)_Space_35.5_MB_(97.44%)
import java.util.TreeSet
diff --git a/src/main/kotlin/g0801_0900/s0847_shortest_path_visiting_all_nodes/Solution.kt b/src/main/kotlin/g0801_0900/s0847_shortest_path_visiting_all_nodes/Solution.kt
index 0316762ab..29fe1ab00 100644
--- a/src/main/kotlin/g0801_0900/s0847_shortest_path_visiting_all_nodes/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0847_shortest_path_visiting_all_nodes/Solution.kt
@@ -18,7 +18,7 @@ class Solution {
var steps = 0
val visited = Array(graph.size) {
BooleanArray(
- target + 1
+ target + 1,
)
}
while (q.isNotEmpty()) {
diff --git a/src/main/kotlin/g0801_0900/s0850_rectangle_area_ii/Solution.kt b/src/main/kotlin/g0801_0900/s0850_rectangle_area_ii/Solution.kt
index 1f8a43ffb..7bf4e7c6d 100644
--- a/src/main/kotlin/g0801_0900/s0850_rectangle_area_ii/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0850_rectangle_area_ii/Solution.kt
@@ -40,9 +40,9 @@ class Solution {
rectangle[0].coerceAtLeast(cur[0]),
rectangle[1],
rectangle[2].coerceAtMost(cur[2]),
- cur[1]
+ cur[1],
),
- memo
+ memo,
)
}
if (rectangle[3] > cur[3]) {
@@ -52,9 +52,9 @@ class Solution {
rectangle[0].coerceAtLeast(cur[0]),
cur[3],
rectangle[2].coerceAtMost(cur[2]),
- rectangle[3]
+ rectangle[3],
),
- memo
+ memo,
)
}
}
diff --git a/src/main/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/Solution.kt b/src/main/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/Solution.kt
index c2f35678b..4e33d5865 100644
--- a/src/main/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/Solution.kt
@@ -1,6 +1,6 @@
package g0801_0900.s0852_peak_index_in_a_mountain_array
-// #Easy #Array #Binary_Search #Binary_Search_I_Day_2
+// #Medium #Array #Binary_Search #Binary_Search_I_Day_2
// #2023_03_30_Time_433_ms_(94.29%)_Space_49.4_MB_(100.00%)
class Solution {
diff --git a/src/main/kotlin/g0801_0900/s0855_exam_room/ExamRoom.kt b/src/main/kotlin/g0801_0900/s0855_exam_room/ExamRoom.kt
index 370625712..4c6fddf1a 100644
--- a/src/main/kotlin/g0801_0900/s0855_exam_room/ExamRoom.kt
+++ b/src/main/kotlin/g0801_0900/s0855_exam_room/ExamRoom.kt
@@ -50,7 +50,7 @@ class ExamRoom() {
var maxAtLeft: Node? = null
var cur = tail.pre
while (cur !== head && cur!!.pre !== head) {
- val pre = cur!!.pre
+ val pre = cur.pre
val at = (cur.`val` + pre!!.`val`) / 2
val distance = at - pre.`val`
if (distance >= max) {
@@ -65,7 +65,9 @@ class ExamRoom() {
}
return if (right > max) {
Node(n - 1, map).insert(tail.pre)
- } else Node(maxAt, map).insert(maxAtLeft)
+ } else {
+ Node(maxAt, map).insert(maxAtLeft)
+ }
}
fun leave(p: Int) {
diff --git a/src/main/kotlin/g0801_0900/s0865_smallest_subtree_with_all_the_deepest_nodes/Solution.kt b/src/main/kotlin/g0801_0900/s0865_smallest_subtree_with_all_the_deepest_nodes/Solution.kt
index 0752d0c5f..77080f88b 100644
--- a/src/main/kotlin/g0801_0900/s0865_smallest_subtree_with_all_the_deepest_nodes/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0865_smallest_subtree_with_all_the_deepest_nodes/Solution.kt
@@ -43,7 +43,9 @@ class Solution {
val rightLca: TreeNode? = lca(root.right, left, right)
return if (leftLca != null && rightLca != null) {
root
- } else leftLca ?: rightLca
+ } else {
+ leftLca ?: rightLca
+ }
}
private fun deep(root: TreeNode?, level: Int) {
diff --git a/src/main/kotlin/g0801_0900/s0867_transpose_matrix/Solution.kt b/src/main/kotlin/g0801_0900/s0867_transpose_matrix/Solution.kt
index 2da2ac852..123cc0711 100644
--- a/src/main/kotlin/g0801_0900/s0867_transpose_matrix/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0867_transpose_matrix/Solution.kt
@@ -6,7 +6,7 @@ class Solution {
fun transpose(input: Array): Array {
val output = Array(input[0].size) {
IntArray(
- input.size
+ input.size,
)
}
var i = 0
diff --git a/src/main/kotlin/g0801_0900/s0872_leaf_similar_trees/Solution.kt b/src/main/kotlin/g0801_0900/s0872_leaf_similar_trees/Solution.kt
index c037f8e55..09ca4e21f 100644
--- a/src/main/kotlin/g0801_0900/s0872_leaf_similar_trees/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0872_leaf_similar_trees/Solution.kt
@@ -1,6 +1,6 @@
package g0801_0900.s0872_leaf_similar_trees
-// #Easy #Depth_First_Search #Tree #Binary_Tree
+// #Easy #Depth_First_Search #Tree #Binary_Tree #LeetCode_75_Binary_Tree/DFS
// #2023_04_08_Time_140_ms_(100.00%)_Space_33.9_MB_(64.29%)
import com_github_leetcode.TreeNode
diff --git a/src/main/kotlin/g0801_0900/s0874_walking_robot_simulation/Solution.kt b/src/main/kotlin/g0801_0900/s0874_walking_robot_simulation/Solution.kt
index e4d1f11d5..78cac9403 100644
--- a/src/main/kotlin/g0801_0900/s0874_walking_robot_simulation/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0874_walking_robot_simulation/Solution.kt
@@ -52,7 +52,7 @@ class Solution {
override fun turnRight(): Direction {
return NORTH
}
- };
+ }, ;
abstract fun turnLeft(): Direction
abstract fun turnRight(): Direction
diff --git a/src/main/kotlin/g0801_0900/s0875_koko_eating_bananas/Solution.kt b/src/main/kotlin/g0801_0900/s0875_koko_eating_bananas/Solution.kt
index 3dd1fa5d3..e99262332 100644
--- a/src/main/kotlin/g0801_0900/s0875_koko_eating_bananas/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0875_koko_eating_bananas/Solution.kt
@@ -1,6 +1,6 @@
package g0801_0900.s0875_koko_eating_bananas
-// #Medium #Array #Binary_Search #Binary_Search_II_Day_4
+// #Medium #Array #Binary_Search #LeetCode_75_Binary_Search #Binary_Search_II_Day_4
// #2023_04_08_Time_267_ms_(93.85%)_Space_37.7_MB_(96.62%)
class Solution {
diff --git a/src/main/kotlin/g0801_0900/s0881_boats_to_save_people/Solution.kt b/src/main/kotlin/g0801_0900/s0881_boats_to_save_people/Solution.kt
index 52ca14bb2..754d9848f 100644
--- a/src/main/kotlin/g0801_0900/s0881_boats_to_save_people/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0881_boats_to_save_people/Solution.kt
@@ -21,6 +21,8 @@ class Solution {
}
return if (i == j) {
boats + 1
- } else boats
+ } else {
+ boats
+ }
}
}
diff --git a/src/main/kotlin/g0801_0900/s0882_reachable_nodes_in_subdivided_graph/Solution.kt b/src/main/kotlin/g0801_0900/s0882_reachable_nodes_in_subdivided_graph/Solution.kt
index 09e3ddff3..3dfa22912 100644
--- a/src/main/kotlin/g0801_0900/s0882_reachable_nodes_in_subdivided_graph/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0882_reachable_nodes_in_subdivided_graph/Solution.kt
@@ -30,7 +30,7 @@ class Solution {
if (cNodeDist <= maxMoves) pQueue.add(intArrayOf(cNode, cNodeDist))
} else {
res += (weight - (maxMoves - minDis[cNode]).coerceAtMost(weight)).coerceAtMost(
- (maxMoves - dist).coerceAtMost(weight)
+ (maxMoves - dist).coerceAtMost(weight),
)
}
}
diff --git a/src/main/kotlin/g0801_0900/s0889_construct_binary_tree_from_preorder_and_postorder_traversal/Solution.kt b/src/main/kotlin/g0801_0900/s0889_construct_binary_tree_from_preorder_and_postorder_traversal/Solution.kt
index 22d30ee29..3c2e64fdb 100644
--- a/src/main/kotlin/g0801_0900/s0889_construct_binary_tree_from_preorder_and_postorder_traversal/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0889_construct_binary_tree_from_preorder_and_postorder_traversal/Solution.kt
@@ -19,7 +19,9 @@ class Solution {
fun constructFromPrePost(preorder: IntArray, postorder: IntArray): TreeNode? {
return if (preorder.isEmpty() || preorder.size != postorder.size) {
null
- } else buildTree(preorder, 0, preorder.size - 1, postorder, 0, postorder.size - 1)
+ } else {
+ buildTree(preorder, 0, preorder.size - 1, postorder, 0, postorder.size - 1)
+ }
}
private fun buildTree(
@@ -28,7 +30,7 @@ class Solution {
preEnd: Int,
postorder: IntArray,
postStart: Int,
- postEnd: Int
+ postEnd: Int,
): TreeNode? {
if (preStart > preEnd || postStart > postEnd) {
return null
@@ -51,7 +53,7 @@ class Solution {
preStart + offset - postStart + 1,
postorder,
postStart,
- offset
+ offset,
)
root.right = buildTree(
preorder,
@@ -59,7 +61,7 @@ class Solution {
preEnd,
postorder,
offset + 1,
- postEnd - 1
+ postEnd - 1,
)
return root
}
diff --git a/src/main/kotlin/g0801_0900/s0891_sum_of_subsequence_widths/Solution.kt b/src/main/kotlin/g0801_0900/s0891_sum_of_subsequence_widths/Solution.kt
index 73d669b77..9827e7181 100644
--- a/src/main/kotlin/g0801_0900/s0891_sum_of_subsequence_widths/Solution.kt
+++ b/src/main/kotlin/g0801_0900/s0891_sum_of_subsequence_widths/Solution.kt
@@ -26,7 +26,7 @@ class Solution {
+ nums[1]*(pow[1]-1) + nums[2]*(pow[2]-1) + .... + nums[5]*(pow[5]-1)
(-1)*A[i]*(pow[l-1-i]-1) + A[i]*(pow[i]-1)
- */
+ */
fun sumSubseqWidths(nums: IntArray): Int {
val mod = 1000000007
nums.sort()
diff --git a/src/main/kotlin/g0901_1000/s0901_online_stock_span/StockSpanner.kt b/src/main/kotlin/g0901_1000/s0901_online_stock_span/StockSpanner.kt
index a8021efe0..8c533a98d 100644
--- a/src/main/kotlin/g0901_1000/s0901_online_stock_span/StockSpanner.kt
+++ b/src/main/kotlin/g0901_1000/s0901_online_stock_span/StockSpanner.kt
@@ -1,6 +1,6 @@
package g0901_1000.s0901_online_stock_span
-// #Medium #Stack #Design #Monotonic_Stack #Data_Stream
+// #Medium #Stack #Design #Monotonic_Stack #Data_Stream #LeetCode_75_Monotonic_Stack
// #2023_04_13_Time_641_ms_(75.00%)_Space_66.5_MB_(10.71%)
import java.util.Deque
diff --git a/src/main/kotlin/g0901_1000/s0907_sum_of_subarray_minimums/Solution.kt b/src/main/kotlin/g0901_1000/s0907_sum_of_subarray_minimums/Solution.kt
index a4c7d7610..c95033cce 100644
--- a/src/main/kotlin/g0901_1000/s0907_sum_of_subarray_minimums/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0907_sum_of_subarray_minimums/Solution.kt
@@ -10,7 +10,9 @@ class Solution {
}
return if (arr[start] < arr[i]) {
0
- } else (1 + right[start] + calculateRight(i, start + right[start] + 1, right, arr, len)) % MOD
+ } else {
+ (1 + right[start] + calculateRight(i, start + right[start] + 1, right, arr, len)) % MOD
+ }
}
private fun calculateLeft(i: Int, start: Int, left: IntArray, arr: IntArray, len: Int): Int {
@@ -19,7 +21,9 @@ class Solution {
}
return if (arr[start] <= arr[i]) {
0
- } else (1 + left[start] + calculateLeft(i, start - left[start] - 1, left, arr, len)) % MOD
+ } else {
+ (1 + left[start] + calculateLeft(i, start - left[start] - 1, left, arr, len)) % MOD
+ }
}
fun sumSubarrayMins(arr: IntArray): Int {
diff --git a/src/main/kotlin/g0901_1000/s0908_smallest_range_i/Solution.kt b/src/main/kotlin/g0901_1000/s0908_smallest_range_i/Solution.kt
index c44f05fb0..8d34c5cbe 100644
--- a/src/main/kotlin/g0901_1000/s0908_smallest_range_i/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0908_smallest_range_i/Solution.kt
@@ -12,6 +12,8 @@ class Solution {
}
return if (min + k >= max - k) {
0
- } else max - k - (min + k)
+ } else {
+ max - k - (min + k)
+ }
}
}
diff --git a/src/main/kotlin/g0901_1000/s0909_snakes_and_ladders/Solution.kt b/src/main/kotlin/g0901_1000/s0909_snakes_and_ladders/Solution.kt
index 0cd13107d..ef102684a 100644
--- a/src/main/kotlin/g0901_1000/s0909_snakes_and_ladders/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0909_snakes_and_ladders/Solution.kt
@@ -1,6 +1,6 @@
package g0901_1000.s0909_snakes_and_ladders
-// #Medium #Array #Breadth_First_Search #Matrix
+// #Medium #Array #Breadth_First_Search #Matrix #Top_Interview_150_Graph_BFS
// #2023_04_15_Time_203_ms_(100.00%)_Space_36_MB_(100.00%)
import java.util.LinkedList
diff --git a/src/main/kotlin/g0901_1000/s0913_cat_and_mouse/Solution.kt b/src/main/kotlin/g0901_1000/s0913_cat_and_mouse/Solution.kt
index b050450ca..a759d0f7a 100644
--- a/src/main/kotlin/g0901_1000/s0913_cat_and_mouse/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0913_cat_and_mouse/Solution.kt
@@ -12,14 +12,14 @@ class Solution {
val states = Array(n) {
Array(n) {
IntArray(
- 2
+ 2,
)
}
}
val degree = Array(n) {
Array(n) {
IntArray(
- 2
+ 2,
)
}
}
diff --git a/src/main/kotlin/g0901_1000/s0914_x_of_a_kind_in_a_deck_of_cards/Solution.kt b/src/main/kotlin/g0901_1000/s0914_x_of_a_kind_in_a_deck_of_cards/Solution.kt
index 0a81bafd3..04d5a2e55 100644
--- a/src/main/kotlin/g0901_1000/s0914_x_of_a_kind_in_a_deck_of_cards/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0914_x_of_a_kind_in_a_deck_of_cards/Solution.kt
@@ -23,6 +23,8 @@ class Solution {
private fun gcd(a: Int, b: Int): Int {
return if (b == 0) {
a
- } else gcd(b, a % b)
+ } else {
+ gcd(b, a % b)
+ }
}
}
diff --git a/src/main/kotlin/g0901_1000/s0918_maximum_sum_circular_subarray/Solution.kt b/src/main/kotlin/g0901_1000/s0918_maximum_sum_circular_subarray/Solution.kt
index 47f4a970f..964cf728d 100644
--- a/src/main/kotlin/g0901_1000/s0918_maximum_sum_circular_subarray/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0918_maximum_sum_circular_subarray/Solution.kt
@@ -1,7 +1,8 @@
package g0901_1000.s0918_maximum_sum_circular_subarray
// #Medium #Array #Dynamic_Programming #Divide_and_Conquer #Queue #Monotonic_Queue
-// #Dynamic_Programming_I_Day_5 #2023_04_16_Time_339_ms_(86.96%)_Space_46.4_MB_(56.52%)
+// #Dynamic_Programming_I_Day_5 #Top_Interview_150_Kadane's_Algorithm
+// #2023_04_16_Time_339_ms_(86.96%)_Space_46.4_MB_(56.52%)
class Solution {
private fun kadane(nums: IntArray, sign: Int): Int {
diff --git a/src/main/kotlin/g0901_1000/s0933_number_of_recent_calls/RecentCounter.kt b/src/main/kotlin/g0901_1000/s0933_number_of_recent_calls/RecentCounter.kt
index 065468e58..506613e90 100644
--- a/src/main/kotlin/g0901_1000/s0933_number_of_recent_calls/RecentCounter.kt
+++ b/src/main/kotlin/g0901_1000/s0933_number_of_recent_calls/RecentCounter.kt
@@ -1,6 +1,7 @@
package g0901_1000.s0933_number_of_recent_calls
-// #Easy #Design #Queue #Data_Stream #2023_04_27_Time_476_ms_(82.50%)_Space_107.1_MB_(5.00%)
+// #Easy #Design #Queue #Data_Stream #LeetCode_75_Queue
+// #2023_04_27_Time_476_ms_(82.50%)_Space_107.1_MB_(5.00%)
import java.util.LinkedList
import java.util.Queue
diff --git a/src/main/kotlin/g0901_1000/s0934_shortest_bridge/Solution.kt b/src/main/kotlin/g0901_1000/s0934_shortest_bridge/Solution.kt
index d3427b474..ac0df497d 100644
--- a/src/main/kotlin/g0901_1000/s0934_shortest_bridge/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0934_shortest_bridge/Solution.kt
@@ -14,7 +14,7 @@ class Solution {
var flag = false
val visited = Array(grid.size) {
BooleanArray(
- grid[0].size
+ grid[0].size,
)
}
var i = 0
diff --git a/src/main/kotlin/g0901_1000/s0937_reorder_data_in_log_files/Solution.kt b/src/main/kotlin/g0901_1000/s0937_reorder_data_in_log_files/Solution.kt
index 8ef5c58fc..c4643b755 100644
--- a/src/main/kotlin/g0901_1000/s0937_reorder_data_in_log_files/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0937_reorder_data_in_log_files/Solution.kt
@@ -1,6 +1,6 @@
package g0901_1000.s0937_reorder_data_in_log_files
-// #Easy #Array #String #Sorting #2023_04_28_Time_205_ms_(81.82%)_Space_44_MB_(9.09%)
+// #Medium #Array #String #Sorting #2023_04_28_Time_205_ms_(81.82%)_Space_44_MB_(9.09%)
import java.util.Collections
@@ -26,7 +26,7 @@ class Solution {
return@Comparator firstWord1.compareTo(secondWord1)
}
firstWord.compareTo(secondWord)
- }
+ },
)
val result = arrayOfNulls(digi.size + word.size)
var `in` = 0
diff --git a/src/main/kotlin/g0901_1000/s0938_range_sum_of_bst/Solution.kt b/src/main/kotlin/g0901_1000/s0938_range_sum_of_bst/Solution.kt
index badae0b4c..f69f19fb9 100644
--- a/src/main/kotlin/g0901_1000/s0938_range_sum_of_bst/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0938_range_sum_of_bst/Solution.kt
@@ -15,7 +15,7 @@ import com_github_leetcode.TreeNode
* var right: TreeNode? = null
* }
*/
-internal class Solution {
+class Solution {
fun rangeSumBST(root: TreeNode?, low: Int, high: Int): Int {
var ans = 0
if (root == null) return 0
diff --git a/src/main/kotlin/g0901_1000/s0939_minimum_area_rectangle/Solution.kt b/src/main/kotlin/g0901_1000/s0939_minimum_area_rectangle/Solution.kt
index a7f4a0421..5875a7b55 100644
--- a/src/main/kotlin/g0901_1000/s0939_minimum_area_rectangle/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0939_minimum_area_rectangle/Solution.kt
@@ -3,7 +3,6 @@ package g0901_1000.s0939_minimum_area_rectangle
// #Medium #Array #Hash_Table #Math #Sorting #Geometry
// #2023_04_29_Time_461_ms_(100.00%)_Space_74.8_MB_(20.00%)
-import java.util.Arrays
import kotlin.math.abs
class Solution {
@@ -16,13 +15,15 @@ class Solution {
map.putIfAbsent(p[0], HashSet())
map.getValue(p[0]).add(p[1])
}
- Arrays.sort(
- points
- ) { a: IntArray, b: IntArray ->
- if (a[0] == b[0]) Integer.compare(
- a[1],
- b[1]
- ) else Integer.compare(a[0], b[0])
+ points.sortWith { a: IntArray, b: IntArray ->
+ if (a[0] == b[0]) {
+ Integer.compare(
+ a[1],
+ b[1],
+ )
+ } else {
+ Integer.compare(a[0], b[0])
+ }
}
var min = Int.MAX_VALUE
for (i in 0 until points.size - 2) {
diff --git a/src/main/kotlin/g0901_1000/s0943_find_the_shortest_superstring/Solution.kt b/src/main/kotlin/g0901_1000/s0943_find_the_shortest_superstring/Solution.kt
index e7130df81..438564e8b 100644
--- a/src/main/kotlin/g0901_1000/s0943_find_the_shortest_superstring/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0943_find_the_shortest_superstring/Solution.kt
@@ -19,7 +19,7 @@ class Solution {
state: Int,
startWord: String,
map: MutableMap,
- l: Int
+ l: Int,
): String? {
val key = "$startWord|$state"
if (state == 0) {
@@ -60,7 +60,9 @@ class Solution {
if (word[i] == result[j]) {
i++
j++
- } else break
+ } else {
+ break
+ }
}
if (i == l) {
found = k
diff --git a/src/main/kotlin/g0901_1000/s0947_most_stones_removed_with_same_row_or_column/Solution.kt b/src/main/kotlin/g0901_1000/s0947_most_stones_removed_with_same_row_or_column/Solution.kt
index 1df5700ff..dbc314e4f 100644
--- a/src/main/kotlin/g0901_1000/s0947_most_stones_removed_with_same_row_or_column/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0947_most_stones_removed_with_same_row_or_column/Solution.kt
@@ -5,6 +5,7 @@ package g0901_1000.s0947_most_stones_removed_with_same_row_or_column
class Solution {
private val roots = IntArray(20002)
+
fun removeStones(stones: Array): Int {
for (stone in stones) {
init(stone[0] + 1, roots)
diff --git a/src/main/kotlin/g0901_1000/s0951_flip_equivalent_binary_trees/Solution.kt b/src/main/kotlin/g0901_1000/s0951_flip_equivalent_binary_trees/Solution.kt
index 058010d1b..f33f83f03 100644
--- a/src/main/kotlin/g0901_1000/s0951_flip_equivalent_binary_trees/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0951_flip_equivalent_binary_trees/Solution.kt
@@ -25,7 +25,9 @@ class Solution {
}
return if (root1.`val` != root2.`val`) {
false
- } else flipEquiv(root1.left, root2.left) && flipEquiv(root1.right, root2.right) ||
- flipEquiv(root1.left, root2.right) && flipEquiv(root1.right, root2.left)
+ } else {
+ flipEquiv(root1.left, root2.left) && flipEquiv(root1.right, root2.right) ||
+ flipEquiv(root1.left, root2.right) && flipEquiv(root1.right, root2.left)
+ }
}
}
diff --git a/src/main/kotlin/g0901_1000/s0954_array_of_doubled_pairs/Solution.kt b/src/main/kotlin/g0901_1000/s0954_array_of_doubled_pairs/Solution.kt
index 672dc8b48..fe9858cd8 100644
--- a/src/main/kotlin/g0901_1000/s0954_array_of_doubled_pairs/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0954_array_of_doubled_pairs/Solution.kt
@@ -3,12 +3,10 @@ package g0901_1000.s0954_array_of_doubled_pairs
// #Medium #Array #Hash_Table #Sorting #Greedy
// #2023_05_02_Time_462_ms_(100.00%)_Space_92.1_MB_(50.00%)
-import java.util.Arrays
-
class Solution {
fun canReorderDoubled(arr: IntArray): Boolean {
- val max = 0.coerceAtLeast(Arrays.stream(arr).max().asInt)
- val min = 0.coerceAtMost(Arrays.stream(arr).min().asInt)
+ val max = 0.coerceAtLeast(arr.max())
+ val min = 0.coerceAtMost(arr.min())
val positive = IntArray(max + 1)
val negative = IntArray(-min + 1)
for (a in arr) {
@@ -20,7 +18,9 @@ class Solution {
}
return if (positive[0] % 2 != 0) {
false
- } else validateFrequencies(positive, max) && validateFrequencies(negative, -min)
+ } else {
+ validateFrequencies(positive, max) && validateFrequencies(negative, -min)
+ }
}
private fun validateFrequencies(frequencies: IntArray, limit: Int): Boolean {
diff --git a/src/main/kotlin/g0901_1000/s0956_tallest_billboard/Solution.kt b/src/main/kotlin/g0901_1000/s0956_tallest_billboard/Solution.kt
index b42265b5f..7f6a6aba9 100644
--- a/src/main/kotlin/g0901_1000/s0956_tallest_billboard/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0956_tallest_billboard/Solution.kt
@@ -2,8 +2,6 @@ package g0901_1000.s0956_tallest_billboard
// #Hard #Array #Dynamic_Programming #2023_05_03_Time_182_ms_(100.00%)_Space_49.8_MB_(100.00%)
-import java.util.Arrays
-
class Solution {
fun tallestBillboard(rods: IntArray): Int {
var maxDiff = 0
@@ -11,7 +9,7 @@ class Solution {
maxDiff += rod
}
val dp = IntArray(maxDiff + 1)
- Arrays.fill(dp, -1)
+ dp.fill(-1)
dp[0] = 0
for (l in rods) {
val dpOld = IntArray(maxDiff + 1)
diff --git a/src/main/kotlin/g0901_1000/s0957_prison_cells_after_n_days/Solution.kt b/src/main/kotlin/g0901_1000/s0957_prison_cells_after_n_days/Solution.kt
index dbb6f493a..6952341c6 100644
--- a/src/main/kotlin/g0901_1000/s0957_prison_cells_after_n_days/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0957_prison_cells_after_n_days/Solution.kt
@@ -3,8 +3,6 @@ package g0901_1000.s0957_prison_cells_after_n_days
// #Medium #Array #Hash_Table #Math #Bit_Manipulation
// #2023_05_03_Time_172_ms_(100.00%)_Space_36.2_MB_(50.00%)
-import java.util.Arrays
-
@Suppress("NAME_SHADOWING")
class Solution {
fun prisonAfterNDays(cells: IntArray, n: Int): IntArray {
@@ -20,7 +18,7 @@ class Solution {
day++
n--
val next = getNextDay(prev)
- if (Arrays.equals(next, first)) {
+ if (next.contentEquals(first)) {
period = day - 1
n %= period
}
diff --git a/src/main/kotlin/g0901_1000/s0963_minimum_area_rectangle_ii/Solution.kt b/src/main/kotlin/g0901_1000/s0963_minimum_area_rectangle_ii/Solution.kt
index 67571e90b..f3a867946 100644
--- a/src/main/kotlin/g0901_1000/s0963_minimum_area_rectangle_ii/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0963_minimum_area_rectangle_ii/Solution.kt
@@ -47,7 +47,7 @@ class Solution {
val second = points[j]
val third = points[k]
return abs(
- first[0] * (second[1] - third[1]) + second[0] * (third[1] - first[1]) + third[0] * (first[1] - second[1])
+ first[0] * (second[1] - third[1]) + second[0] * (third[1] - first[1]) + third[0] * (first[1] - second[1]),
).toDouble()
}
}
diff --git a/src/main/kotlin/g0901_1000/s0964_least_operators_to_express_number/Solution.kt b/src/main/kotlin/g0901_1000/s0964_least_operators_to_express_number/Solution.kt
index 97a45f410..430421362 100644
--- a/src/main/kotlin/g0901_1000/s0964_least_operators_to_express_number/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0964_least_operators_to_express_number/Solution.kt
@@ -9,7 +9,9 @@ class Solution {
this.x = x
return if (x == target) {
0
- } else dfs(0, target.toLong()) - 1
+ } else {
+ dfs(0, target.toLong()) - 1
+ }
}
// ax^0 + bx^1 + cx^2 +....
diff --git a/src/main/kotlin/g0901_1000/s0966_vowel_spellchecker/Solution.kt b/src/main/kotlin/g0901_1000/s0966_vowel_spellchecker/Solution.kt
index 57cdeb436..7af1c2517 100644
--- a/src/main/kotlin/g0901_1000/s0966_vowel_spellchecker/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0966_vowel_spellchecker/Solution.kt
@@ -29,7 +29,9 @@ class Solution {
word = removeVowels(word)
return if (vowelErrors!!.containsKey(word)) {
vowelErrors!![word]
- } else ""
+ } else {
+ ""
+ }
}
fun spellchecker(wordlist: Array, queries: Array): Array {
diff --git a/src/main/kotlin/g0901_1000/s0968_binary_tree_cameras/Solution.kt b/src/main/kotlin/g0901_1000/s0968_binary_tree_cameras/Solution.kt
index de45dacdc..16c656aa2 100644
--- a/src/main/kotlin/g0901_1000/s0968_binary_tree_cameras/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0968_binary_tree_cameras/Solution.kt
@@ -46,7 +46,9 @@ class Solution {
return if (leftChildState == 0 || rightChildState == 0) {
// gets covered by the children
1
- } else -1
+ } else {
+ -1
+ }
// needs a camera
}
}
diff --git a/src/main/kotlin/g0901_1000/s0977_squares_of_a_sorted_array/Solution.kt b/src/main/kotlin/g0901_1000/s0977_squares_of_a_sorted_array/Solution.kt
index da313e838..95cced5a0 100644
--- a/src/main/kotlin/g0901_1000/s0977_squares_of_a_sorted_array/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0977_squares_of_a_sorted_array/Solution.kt
@@ -1,7 +1,7 @@
package g0901_1000.s0977_squares_of_a_sorted_array
// #Easy #Array #Sorting #Two_Pointers #Algorithm_I_Day_2_Two_Pointers #Udemy_Two_Pointers
-// #2023_05_08_Time_375_ms_(18.43%)_Space_78.9_MB_(12.90%)
+// #2023_10_02_Time_271_ms_(77.17%)_Space_41_MB_(61.94%)
import kotlin.math.abs
diff --git a/src/main/kotlin/g0901_1000/s0981_time_based_key_value_store/TimeMap.kt b/src/main/kotlin/g0901_1000/s0981_time_based_key_value_store/TimeMap.kt
index 17dbc11d0..ad2b74a25 100644
--- a/src/main/kotlin/g0901_1000/s0981_time_based_key_value_store/TimeMap.kt
+++ b/src/main/kotlin/g0901_1000/s0981_time_based_key_value_store/TimeMap.kt
@@ -1,7 +1,7 @@
package g0901_1000.s0981_time_based_key_value_store
// #Medium #String #Hash_Table #Binary_Search #Design #Binary_Search_II_Day_16
-// #2023_05_09_Time_1555_ms_(10.00%)_Space_268.7_MB_(5.00%)
+// #2023_10_02_Time_1011_ms_(65.56%)_Space_141.1_MB_(30.00%)
import java.util.TreeMap
diff --git a/src/main/kotlin/g0901_1000/s0983_minimum_cost_for_tickets/Solution.kt b/src/main/kotlin/g0901_1000/s0983_minimum_cost_for_tickets/Solution.kt
index f36b9606a..165771331 100644
--- a/src/main/kotlin/g0901_1000/s0983_minimum_cost_for_tickets/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0983_minimum_cost_for_tickets/Solution.kt
@@ -13,9 +13,9 @@ class Solution {
getNext(
days,
i,
- days[i] + 6
- )
- ]
+ days[i] + 6,
+ ),
+ ],
).coerceAtMost(costs[2] + memo[getNext(days, i, days[i] + 29)])
}
return memo[0]
diff --git a/src/main/kotlin/g0901_1000/s0987_vertical_order_traversal_of_a_binary_tree/Solution.kt b/src/main/kotlin/g0901_1000/s0987_vertical_order_traversal_of_a_binary_tree/Solution.kt
index d60165072..522de8906 100644
--- a/src/main/kotlin/g0901_1000/s0987_vertical_order_traversal_of_a_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0987_vertical_order_traversal_of_a_binary_tree/Solution.kt
@@ -40,7 +40,8 @@ class Solution {
return
}
map.putIfAbsent(
- c, PriorityQueue { a: Node, b: Node -> if (a.row != b.row) a.row - b.row else a.`val` - b.`val` }
+ c,
+ PriorityQueue { a: Node, b: Node -> if (a.row != b.row) a.row - b.row else a.`val` - b.`val` },
)
map.getValue(c).add(Node(r, cur.`val`))
helper(cur.left, map, r + 1, c - 1)
diff --git a/src/main/kotlin/g0901_1000/s0989_add_to_array_form_of_integer/Solution.kt b/src/main/kotlin/g0901_1000/s0989_add_to_array_form_of_integer/Solution.kt
index d5ab2e95d..7ce338a92 100644
--- a/src/main/kotlin/g0901_1000/s0989_add_to_array_form_of_integer/Solution.kt
+++ b/src/main/kotlin/g0901_1000/s0989_add_to_array_form_of_integer/Solution.kt
@@ -5,9 +5,9 @@ package g0901_1000.s0989_add_to_array_form_of_integer
@Suppress("NAME_SHADOWING")
class Solution {
- fun addToArrayForm(num: IntArray, k: Int): List {
+ fun addToArrayForm(num: IntArray, k: Int): List {
var k = k
- val result = ArrayList