diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 000000000..f711b60c1
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,28 @@
+# Use the latest 2.1 version of CircleCI pipeline process engine.
+# See: https://circleci.com/docs/configuration-reference
+version: 2.1
+
+# Define a job to be invoked later in a workflow.
+# See: https://circleci.com/docs/configuration-reference/#jobs
+jobs:
+ build-linux:
+ # 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:21.0.2
+ # Add steps to the job
+ # See: https://circleci.com/docs/configuration-reference/#steps
+ steps:
+ - checkout
+ - run:
+ name: "Build gradle"
+ command: chmod +x gradlew && ./gradlew clean build
+ - store_test_results:
+ path: build/test-results/test
+
+# Orchestrate jobs using workflows
+# See: https://circleci.com/docs/configuration-reference/#workflows
+workflows:
+ build-linux-workflow:
+ jobs:
+ - build-linux
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
new file mode 100644
index 000000000..9ccc8fc42
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,92 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ "main" ]
+ pull_request:
+ branches: [ "main" ]
+ schedule:
+ - cron: '18 1 * * 2'
+
+permissions: read-all
+jobs:
+ analyze:
+ name: Analyze
+ # 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
+
+ strategy:
+ fail-fast: false
+ matrix:
+ 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@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@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.
+
+ # 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, 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@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
+
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
+
+ # - run: |
+ # echo "Run, Build Application using script"
+ # ./location_of_script_within_repo/buildscript.sh
+
+ - name: Perform CodeQL Analysis
+ 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..14691806c 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,4 +1,4 @@
-# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
+# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Kotlin CI
@@ -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'
+ distribution: 'corretto'
+ 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'
+ distribution: 'corretto'
+ java-version: '17'
cache: 'gradle'
- name: Build with Gradle
run: ./gradlew test --no-daemon
@@ -62,15 +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'
+ distribution: 'corretto'
+ 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 58d79e766..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: '23 11 * * 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@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
- 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@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27
- 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 c4265db11..4d0a990eb 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.10)
+[](https://central.sonatype.com/artifact/com.github.javadev/leetcode-in-kotlin/1.39)
[ ](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,27 +8,27 @@
[](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.10
+ 1.39
...
```
-Gradle:
+Gradle configuration:
```groovy
-implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
+implementation 'com.github.javadev:leetcode-in-kotlin:1.39'
```
> ["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)
@@ -40,6 +40,7 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
* [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)
@@ -55,13 +56,14 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 2
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 3
@@ -69,44 +71,49 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 0066 |[Plus One](src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt)| Easy | Top_Interview_Questions, Array, Math | 148 | 98.75
#### Day 4
| | | | | |
|-|-|-|-|-|-
-| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation | 390 | 56.25
+| 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 5
| | | | | |
|-|-|-|-|-|-
-| 0067 |[Add Binary](src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt)| Easy | String, Math, Bit_Manipulation, Simulation | 327 | 32.67
+| 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 6
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 7
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 8
| | | | | |
|-|-|-|-|-|-
-| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_Interview_Questions, Array, Matrix, Simulation | 224 | 62.50
+| 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 9
| | | | | |
|-|-|-|-|-|-
-| 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 | 278 | 75.00
+| 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 10
@@ -119,13 +126,14 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 12
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 13
@@ -133,52 +141,57 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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 14
| | | | | |
|-|-|-|-|-|-
| 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
+| 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) | 123 | 90.70
#### Day 15
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 2 | 87.63
| 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 16
| | | | | |
|-|-|-|-|-|-
-| 0061 |[Rotate List](src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt)| Medium | Two_Pointers, Linked_List | 193 | 92.16
+| 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 17
| | | | | |
|-|-|-|-|-|-
+| 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 18
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 19
| | | | | |
|-|-|-|-|-|-
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
### Graph Theory I
@@ -186,61 +199,79 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 3 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
+| 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 4 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
+| 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 5 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
+| 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 6 Matrix Related Problems
| | | | | |
|-|-|-|-|-|-
+| 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 7 Standard Traversal
| | | | | |
|-|-|-|-|-|-
+| 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 8 Standard Traversal
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 9 Standard Traversal
| | | | | |
|-|-|-|-|-|-
+| 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 10 Standard Traversal
| | | | | |
|-|-|-|-|-|-
+| 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 11 Breadth First Search
| | | | | |
|-|-|-|-|-|-
+| 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 12 Breadth First Search
@@ -248,17 +279,23 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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 13 Graph Theory
| | | | | |
|-|-|-|-|-|-
+| 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 14 Graph Theory
| | | | | |
|-|-|-|-|-|-
+| 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
### SQL I
@@ -267,6 +304,7 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
@@ -274,6 +312,7 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
+| 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
@@ -281,11 +320,16 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
+| 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 4 Union and Select
| | | | | |
|-|-|-|-|-|-
+| 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
@@ -294,6 +338,8 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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 6 Union
@@ -306,6 +352,9 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
+| 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 8 Function
@@ -313,17 +362,25 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.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 9 Control of Flow
| | | | | |
|-|-|-|-|-|-
+| 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 10 Where
| | | | | |
|-|-|-|-|-|-
| 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
### Level 1
@@ -331,33 +388,35 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 0724 |[Find Pivot Index](src/main/kotlin/g0701_0800/s0724_find_pivot_index/Solution.kt)| Easy | Array, Prefix_Sum | 255 | 88.92
+| 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 2 String
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 3 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
+| 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 4 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 5 Greedy
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 6 Tree
@@ -365,7 +424,7 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 7 Binary Search
@@ -378,52 +437,56 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 9 Graph/BFS/DFS
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 10 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 11 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 12 Sliding Window/Two Pointer
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 13 Hashmap
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 2 | 98.77
| 0299 |[Bulls and Cows](src/main/kotlin/g0201_0300/s0299_bulls_and_cows/Solution.kt)| Medium | String, Hash_Table, Counting | 254 | 84.82
#### Day 14 Stack
| | | | | |
|-|-|-|-|-|-
-| 0394 |[Decode String](src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Stack, Recursion | 224 | 64.86
+| 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 15 Heap
| | | | | |
|-|-|-|-|-|-
+| 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
### Level 2
@@ -433,69 +496,71 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 2 String
| | | | | |
|-|-|-|-|-|-
-| 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
+| 0014 |[Longest Common Prefix](src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt)| Easy | Top_Interview_Questions, String, Big_O_Time_O(n\*m)_Space_O(m) | 154 | 89.70
+| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation | 165 | 96.72
#### Day 3 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 4 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 5 Greedy
| | | | | |
|-|-|-|-|-|-
+| 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 6 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 7 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | Top_100_Liked_Questions, Depth_First_Search, Tree, Binary_Tree, LeetCode_75_Binary_Tree/DFS, Big_O_Time_O(n)_Space_O(n) | 403 | 54.12
#### Day 8 Binary Search
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 9 Binary Search Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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_100_Liked_Questions, 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 10 Graph/BFS/DFS
| | | | | |
|-|-|-|-|-|-
-| 0994 |[Rotting Oranges](src/main/kotlin/g0901_1000/s0994_rotting_oranges/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix | 308 | 57.93
+| 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 11 Graph/BFS/DFS
@@ -503,70 +568,73 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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 12 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 13 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 14 Sliding Window/Two Pointer
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 3 | 99.17
+| 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
#### Day 15 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 16 Design
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 17 Interval
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 18 Stack
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 19 Union Find
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 20 Brute Force/Backtracking
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
### Udemy
@@ -574,27 +642,27 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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, Big_O_Time_O(log10(x))_Space_O(1) | 149 | 77.89
+| 0009 |[Palindrome Number](src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt)| Easy | Math, Big_O_Time_O(log10(x))_Space_O(1) | 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 | 264 | 52.98
+| 0050 |[Pow(x, n)](src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt)| Medium | Top_Interview_Questions, Math, Recursion | 172 | 38.68
#### Udemy Strings
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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_Interview_Questions, String, Big_O_Time_O(n\*m)_Space_O(m) | 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 | 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
+| 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 | 3 | 99.17
+| 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) | 8 | 96.61
+| 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
#### Udemy Binary Search
@@ -602,86 +670,93 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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
#### Udemy Arrays
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 2 | 98.77
| 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
+| 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 | 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
+| 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 | 345 | 100.00
+| 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, Top_Interview_Questions, Array, Heap_Priority_Queue, Sliding_Window, Queue, Monotonic_Queue | 1059 | 86.14
+| 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
#### Udemy Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers | 156 | 87.74
+| 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
-| 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
+| 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
#### Udemy Famous Algorithm
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Udemy Sorting Algorithms
| | | | | |
|-|-|-|-|-|-
+| 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
#### Udemy 2D Arrays/Matrix
| | | | | |
|-|-|-|-|-|-
| 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
-| 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
+| 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
#### Udemy Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 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
-| 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
+| 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) | 123 | 90.70
+| 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
#### Udemy Tree Stack Queue
@@ -689,35 +764,39 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 | 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
-| 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
-| 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
+| 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_100_Liked_Questions, 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 | 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
+| 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 | 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
+| 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, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree | 386 | 45.21
+| 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
#### Udemy Trie and Heap
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Udemy Graph
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
@@ -726,31 +805,31 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 | 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
+| 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 | 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
+| 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
#### Udemy Backtracking/Recursion
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Udemy Bit Manipulation
@@ -760,15 +839,283 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| 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
-| 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
+| 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
#### Udemy Design
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
+
+### Top Interview 150
+
+#### Top Interview 150 Array/String
+
+| | | | | |
+|-|-|-|-|-|-
+| 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_Interview_Questions, String, Hash_Table, Math, Big_O_Time_O(n)_Space_O(1) | 211 | 83.47
+| 0012 |[Integer to Roman](src/main/kotlin/g0001_0100/s0012_integer_to_roman/Solution.kt)| Medium | String, Hash_Table, Math, Big_O_Time_O(1)_Space_O(1) | 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_Interview_Questions, String, Big_O_Time_O(n\*m)_Space_O(m) | 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, Big_O_Time_O(n)_Space_O(n) | 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
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Sliding Window
+
+| | | | | |
+|-|-|-|-|-|-
+| 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 | 3 | 99.17
+| 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
+
+#### Top Interview 150 Matrix
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Hashmap
+
+| | | | | |
+|-|-|-|-|-|-
+| 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 | 2 | 98.77
+| 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
+
+#### Top Interview 150 Intervals
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Stack
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Linked List
+
+| | | | | |
+|-|-|-|-|-|-
+| 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 | 2 | 87.63
+| 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) | 123 | 90.70
+| 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
+
+#### Top Interview 150 Binary Tree General
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Binary Tree BFS
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Binary Search Tree
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Graph General
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Graph BFS
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Trie
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Backtracking
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Divide and Conquer
+
+| | | | | |
+|-|-|-|-|-|-
+| 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_100_Liked_Questions, 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
+
+#### Top Interview 150 Kadane's Algorithm
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Binary Search
+
+| | | | | |
+|-|-|-|-|-|-
+| 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 | 2 | 99.23
+
+#### Top Interview 150 Heap
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Bit Manipulation
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Math
+
+| | | | | |
+|-|-|-|-|-|-
+| 0009 |[Palindrome Number](src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt)| Easy | Math, Big_O_Time_O(log10(x))_Space_O(1) | 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
+
+#### Top Interview 150 1D DP
+
+| | | | | |
+|-|-|-|-|-|-
+| 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
+
+#### Top Interview 150 Multidimensional DP
+
+| | | | | |
+|-|-|-|-|-|-
+| 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) | 8 | 96.61
+| 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
### Data Structure I
@@ -777,64 +1124,64 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 2 Array
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 2 | 98.77
+| 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 3 Array
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 4 Array
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 5 Array
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 6 String
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | Top_Interview_Questions, String, Hash_Table, Sorting | 251 | 87.65
+| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | String, Hash_Table, Sorting | 251 | 87.65
#### Day 7 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 8 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 9 Stack Queue
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 10 Tree
@@ -842,38 +1189,38 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 11 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 12 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 13 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 14 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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)| Easy | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 404 | 75.59
+| 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
### Data Structure II
@@ -881,16 +1228,16 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 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
+| 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
@@ -898,23 +1245,23 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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, 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
+| 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 | 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
+| 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
@@ -928,103 +1275,109 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 0763 |[Partition Labels](src/main/kotlin/g0701_0800/s0763_partition_labels/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Greedy, Two_Pointers, Big_O_Time_O(n)_Space_O(1) | 235 | 84.75
#### Day 8 String
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
| 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
+| 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) | 8 | 96.61
#### Day 10 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 2 | 87.63
+| 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 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 13 Linked List
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 15 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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_100_Liked_Questions, 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 16 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 257 | 84.62
+| 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 17 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 18 Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 19 Graph
| | | | | |
|-|-|-|-|-|-
+| 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 20 Heap Priority Queue
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 21 Heap Priority Queue
| | | | | |
|-|-|-|-|-|-
| 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
@@ -1034,46 +1387,49 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
|-|-|-|-|-|-
| 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
+| 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 2 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 3 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 4 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 0344 |[Reverse String](src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers, Recursion | 445 | 69.75
+| 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 5 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 6 Sliding Window
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 | 3 | 99.17
| 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
#### Day 7 Breadth First Search Depth First 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
+| 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 8 Breadth First Search Depth First Search
@@ -1087,28 +1443,29 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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 | 308 | 57.93
+| 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 10 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 11 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 12 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 13 Bit Manipulation
@@ -1123,7 +1480,7 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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
### Algorithm II
@@ -1131,35 +1488,37 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 2 Binary Search
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 3 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 4 Two Pointers
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 5 Sliding Window
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
@@ -1167,8 +1526,8 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
@@ -1181,79 +1540,81 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
+| 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
#### Day 9 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 10 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 11 Recursion Backtracking
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 12 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 13 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 14 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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) | 8 | 96.61
| 0413 |[Arithmetic Slices](src/main/kotlin/g0401_0500/s0413_arithmetic_slices/Solution.kt)| Medium | Array, Dynamic_Programming | 156 | 100.00
#### Day 15 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 16 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 18 Dynamic Programming
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 19 Bit Manipulation
@@ -1266,7 +1627,7 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
-| 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
+| 0384 |[Shuffle an Array](src/main/kotlin/g0301_0400/s0384_shuffle_an_array/Solution.kt)| Medium | Array, Math, Randomized | 940 | 72.09
#### Day 21 Others
@@ -1282,74 +1643,83 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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 2
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 3
| | | | | |
|-|-|-|-|-|-
| 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 4
| | | | | |
|-|-|-|-|-|-
-| 0069 |[Sqrt(x)](src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt)| Easy | Top_Interview_Questions, Math, Binary_Search | 153 | 95.75
+| 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 5
| | | | | |
|-|-|-|-|-|-
| 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
+| 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
#### Day 6
| | | | | |
|-|-|-|-|-|-
| 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
| | | | | |
|-|-|-|-|-|-
| 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 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
+| 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 9
| | | | | |
|-|-|-|-|-|-
+| 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 10
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 11
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 12
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
### Binary Search II
@@ -1365,65 +1735,77 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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 3
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 4
| | | | | |
|-|-|-|-|-|-
+| 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 5
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 6
| | | | | |
|-|-|-|-|-|-
+| 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 7
| | | | | |
|-|-|-|-|-|-
+| 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 8
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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 9
| | | | | |
|-|-|-|-|-|-
+| 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)| |||
+| 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 | 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
+| 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
@@ -1436,36 +1818,50 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
+| 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
### Dynamic Programming I
@@ -1474,44 +1870,50 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
@@ -1519,89 +1921,91 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
| 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
+| 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
| | | | | |
|-|-|-|-|-|-
| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 0118 |[Pascal's Triangle](src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt)| Easy | Top_Interview_Questions, Array, Dynamic_Programming | 277 | 33.22
+| 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
| | | | | |
|-|-|-|-|-|-
+| 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
| | | | | |
|-|-|-|-|-|-
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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) | 8 | 96.61
| 0516 |[Longest Palindromic Subsequence](src/main/kotlin/g0501_0600/s0516_longest_palindromic_subsequence/Solution.kt)| Medium | String, Dynamic_Programming | 243 | 87.50
#### Day 18
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 21
@@ -1610,7 +2014,7 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
|-|-|-|-|-|-
| 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
+| 0279 |[Perfect Squares](src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt)| Medium | Top_100_Liked_Questions, Dynamic_Programming, Math, Breadth_First_Search | 176 | 98.80
### Programming Skills I
@@ -1618,23 +2022,31 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
+| 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
#### Day 2 Operator
| | | | | |
|-|-|-|-|-|-
| 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
#### Day 3 Conditional Statements
| | | | | |
|-|-|-|-|-|-
+| 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
#### Day 4 Loop
| | | | | |
|-|-|-|-|-|-
+| 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
#### Day 5 Function
@@ -1642,23 +2054,29 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
|-|-|-|-|-|-
| 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
#### Day 6 Array
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 7 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
#### Day 8 String
| | | | | |
|-|-|-|-|-|-
+| 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
#### Day 9 String
@@ -1666,615 +2084,34 @@ implementation 'com.github.javadev:leetcode-in-kotlin:1.10'
| | | | | |
|-|-|-|-|-|-
| 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
#### Day 10 Linked List and Tree
| | | | | |
|-|-|-|-|-|-
-| 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
+| 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
#### Day 11 Containers and Libraries
| | | | | |
|-|-|-|-|-|-
+| 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
+| 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
#### Day 12 Class and Object
| | | | | |
|-|-|-|-|-|-
+| 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
-## Algorithms
-
-| # | Title | Difficulty | Tag | Time, ms | Time, %
-|------|----------------|-------------|-------------|----------|---------
-| 1143 |[Longest Common Subsequence](src/main/kotlin/g1101_1200/s1143_longest_common_subsequence/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming, Algorithm_II_Day_17_Dynamic_Programming, Dynamic_Programming_I_Day_19, Udemy_Dynamic_Programming | 307 | 38.36
-| 0994 |[Rotting Oranges](src/main/kotlin/g0901_1000/s0994_rotting_oranges/Solution.kt)| Medium | Array, Breadth_First_Search, Matrix, Algorithm_I_Day_9_Breadth_First_Search_Depth_First_Search, Level_2_Day_10_Graph/BFS/DFS | 308 | 57.93
-| 0864 |[Shortest Path to Get All Keys](src/main/kotlin/g0801_0900/s0864_shortest_path_to_get_all_keys/Solution.kt)| Hard | Breadth_First_Search, Bit_Manipulation | 176 | 100.00
-| 0763 |[Partition Labels](src/main/kotlin/g0701_0800/s0763_partition_labels/Solution.kt)| Medium | Top_100_Liked_Questions, String, Hash_Table, Greedy, Two_Pointers, Data_Structure_II_Day_7_String | 235 | 84.75
-| 0739 |[Daily Temperatures](src/main/kotlin/g0701_0800/s0739_daily_temperatures/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Stack, Monotonic_Stack, Programming_Skills_II_Day_6 | 936 | 80.54
-| 0725 |[Split Linked List in Parts](src/main/kotlin/g0701_0800/s0725_split_linked_list_in_parts/Solution.kt)| Medium | Linked_List | 162 | 95.00
-| 0724 |[Find Pivot Index](src/main/kotlin/g0701_0800/s0724_find_pivot_index/Solution.kt)| Easy | Array, Prefix_Sum, Level_1_Day_1_Prefix_Sum | 255 | 88.92
-| 0722 |[Remove Comments](src/main/kotlin/g0701_0800/s0722_remove_comments/Solution.kt)| Medium | Array, String | 164 | 100.00
-| 0721 |[Accounts Merge](src/main/kotlin/g0701_0800/s0721_accounts_merge/Solution.kt)| Medium | Array, String, Depth_First_Search, Breadth_First_Search, Union_Find | 364 | 100.00
-| 0720 |[Longest Word in Dictionary](src/main/kotlin/g0701_0800/s0720_longest_word_in_dictionary/Solution.kt)| Medium | Array, String, Hash_Table, Sorting, Trie | 209 | 100.00
-| 0719 |[Find K-th Smallest Pair Distance](src/main/kotlin/g0701_0800/s0719_find_k_th_smallest_pair_distance/Solution.kt)| Hard | Array, Sorting, Binary_Search, Two_Pointers | 172 | 100.00
-| 0718 |[Maximum Length of Repeated Subarray](src/main/kotlin/g0701_0800/s0718_maximum_length_of_repeated_subarray/Solution.kt)| Medium | Array, Dynamic_Programming, Binary_Search, Sliding_Window, Hash_Function, Rolling_Hash | 270 | 91.43
-| 0717 |[1-bit and 2-bit Characters](src/main/kotlin/g0701_0800/s0717_1_bit_and_2_bit_characters/Solution.kt)| Easy | Array | 165 | 100.00
-| 0715 |[Range Module](src/main/kotlin/g0701_0800/s0715_range_module/RangeModule.kt)| Hard | Design, Ordered_Set, Segment_Tree | 638 | 58.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, Dynamic_Programming_I_Day_8 | 417 | 90.91
-| 0713 |[Subarray Product Less Than K](src/main/kotlin/g0701_0800/s0713_subarray_product_less_than_k/Solution.kt)| Medium | Array, Sliding_Window, Algorithm_II_Day_5_Sliding_Window, Programming_Skills_II_Day_12, Udemy_Arrays | 336 | 92.11
-| 0712 |[Minimum ASCII Delete Sum for Two Strings](src/main/kotlin/g0701_0800/s0712_minimum_ascii_delete_sum_for_two_strings/Solution.kt)| Medium | String, Dynamic_Programming | 176 | 100.00
-| 0710 |[Random Pick with Blacklist](src/main/kotlin/g0701_0800/s0710_random_pick_with_blacklist/Solution.kt)| Hard | Hash_Table, Math, Sorting, Binary_Search, Randomized | 632 | 100.00
-| 0709 |[To Lower Case](src/main/kotlin/g0701_0800/s0709_to_lower_case/Solution.kt)| Easy | String, Programming_Skills_I_Day_9_String | 142 | 98.68
-| 0707 |[Design Linked List](src/main/kotlin/g0701_0800/s0707_design_linked_list/MyLinkedList.kt)| Medium | Design, Linked_List, Data_Structure_II_Day_12_Linked_List, Programming_Skills_II_Day_19, Udemy_Linked_List | 243 | 100.00
-| 0706 |[Design HashMap](src/main/kotlin/g0701_0800/s0706_design_hashmap/MyHashMap.kt)| Easy | Array, Hash_Table, Design, Linked_List, Hash_Function, Data_Structure_II_Day_2_Array | 405 | 92.11
-| 0705 |[Design HashSet](src/main/kotlin/g0701_0800/s0705_design_hashset/MyHashSet.kt)| Easy | Array, Hash_Table, Design, Linked_List, Hash_Function | 385 | 75.61
-| 0704 |[Binary Search](src/main/kotlin/g0701_0800/s0704_binary_search/Solution.kt)| Easy | Array, Binary_Search, Algorithm_I_Day_1_Binary_Search, Binary_Search_I_Day_1, Level_1_Day_7_Binary_Search, Udemy_Binary_Search | 261 | 77.91
-| 0703 |[Kth Largest Element in a Stream](src/main/kotlin/g0701_0800/s0703_kth_largest_element_in_a_stream/KthLargest.kt)| Easy | Tree, Binary_Tree, Design, Heap_Priority_Queue, Binary_Search_Tree, Data_Stream | 286 | 95.45
-| 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, Data_Structure_I_Day_13_Tree, Udemy_Tree_Stack_Queue | 311 | 79.03
-| 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, Data_Structure_I_Day_13_Tree | 251 | 88.31
-| 0699 |[Falling Squares](src/main/kotlin/g0601_0700/s0699_falling_squares/Solution.kt)| Hard | Array, Ordered_Set, Segment_Tree | 293 | 100.00
-| 0698 |[Partition to K Equal Sum Subsets](src/main/kotlin/g0601_0700/s0698_partition_to_k_equal_sum_subsets/Solution.kt)| Medium | Array, Dynamic_Programming, Bit_Manipulation, Backtracking, Bitmask, Memoization | 191 | 100.00
-| 0697 |[Degree of an Array](src/main/kotlin/g0601_0700/s0697_degree_of_an_array/Solution.kt)| Easy | Array, Hash_Table, Udemy_Arrays | 289 | 84.62
-| 0696 |[Count Binary Substrings](src/main/kotlin/g0601_0700/s0696_count_binary_substrings/Solution.kt)| Easy | String, Two_Pointers | 222 | 100.00
-| 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, Algorithm_I_Day_7_Breadth_First_Search_Depth_First_Search, Graph_Theory_I_Day_2_Matrix_Related_Problems | 324 | 24.06
-| 0693 |[Binary Number with Alternating Bits](src/main/kotlin/g0601_0700/s0693_binary_number_with_alternating_bits/Solution.kt)| Easy | Bit_Manipulation | 129 | 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, Level_1_Day_15_Heap | 239 | 81.10
-| 0691 |[Stickers to Spell Word](src/main/kotlin/g0601_0700/s0691_stickers_to_spell_word/Solution.kt)| Hard | Array, String, Dynamic_Programming, Bit_Manipulation, Backtracking, Bitmask | 249 | 100.00
-| 0690 |[Employee Importance](src/main/kotlin/g0601_0700/s0690_employee_importance/Solution.kt)| Medium | Hash_Table, Depth_First_Search, Breadth_First_Search | 255 | 100.00
-| 0689 |[Maximum Sum of 3 Non-Overlapping Subarrays](src/main/kotlin/g0601_0700/s0689_maximum_sum_of_3_non_overlapping_subarrays/Solution.kt)| Hard | Array, Dynamic_Programming | 248 | 100.00
-| 0688 |[Knight Probability in Chessboard](src/main/kotlin/g0601_0700/s0688_knight_probability_in_chessboard/Solution.kt)| Medium | Dynamic_Programming | 144 | 100.00
-| 0687 |[Longest Univalue Path](src/main/kotlin/g0601_0700/s0687_longest_univalue_path/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree | 303 | 100.00
-| 0686 |[Repeated String Match](src/main/kotlin/g0601_0700/s0686_repeated_string_match/Solution.kt)| Medium | String, String_Matching | 164 | 100.00
-| 0685 |[Redundant Connection II](src/main/kotlin/g0601_0700/s0685_redundant_connection_ii/Solution.kt)| Hard | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 176 | 100.00
-| 0684 |[Redundant Connection](src/main/kotlin/g0601_0700/s0684_redundant_connection/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Union_Find | 181 | 88.24
-| 0682 |[Baseball Game](src/main/kotlin/g0601_0700/s0682_baseball_game/Solution.kt)| Easy | Array, Stack, Simulation | 159 | 100.00
-| 0680 |[Valid Palindrome II](src/main/kotlin/g0601_0700/s0680_valid_palindrome_ii/Solution.kt)| Easy | String, Greedy, Two_Pointers | 296 | 79.17
-| 0679 |[24 Game](src/main/kotlin/g0601_0700/s0679_24_game/Solution.kt)| Hard | Array, Math, Backtracking | 175 | 100.00
-| 0678 |[Valid Parenthesis String](src/main/kotlin/g0601_0700/s0678_valid_parenthesis_string/Solution.kt)| Medium | String, Dynamic_Programming, Greedy, Stack | 133 | 100.00
-| 0677 |[Map Sum Pairs](src/main/kotlin/g0601_0700/s0677_map_sum_pairs/MapSum.kt)| Medium | String, Hash_Table, Design, Trie | 197 | 80.00
-| 0676 |[Implement Magic Dictionary](src/main/kotlin/g0601_0700/s0676_implement_magic_dictionary/MagicDictionary.kt)| Medium | String, Hash_Table, Design, Trie | 256 | 100.00
-| 0675 |[Cut Off Trees for Golf Event](src/main/kotlin/g0601_0700/s0675_cut_off_trees_for_golf_event/Solution.kt)| Hard | Array, Breadth_First_Search, Matrix, Heap_Priority_Queue | 777 | 100.00
-| 0674 |[Longest Continuous Increasing Subsequence](src/main/kotlin/g0601_0700/s0674_longest_continuous_increasing_subsequence/Solution.kt)| Easy | Array | 201 | 84.21
-| 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, Algorithm_II_Day_16_Dynamic_Programming | 226 | 91.67
-| 0672 |[Bulb Switcher II](src/main/kotlin/g0601_0700/s0672_bulb_switcher_ii/Solution.kt)| Medium | Math, Depth_First_Search, Breadth_First_Search, Bit_Manipulation | 131 | 100.00
-| 0671 |[Second Minimum Node In a Binary Tree](src/main/kotlin/g0601_0700/s0671_second_minimum_node_in_a_binary_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree | 128 | 100.00
-| 0670 |[Maximum Swap](src/main/kotlin/g0601_0700/s0670_maximum_swap/Solution.kt)| Medium | Math, Greedy | 143 | 100.00
-| 0669 |[Trim a Binary Search Tree](src/main/kotlin/g0601_0700/s0669_trim_a_binary_search_tree/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 195 | 100.00
-| 0668 |[Kth Smallest Number in Multiplication Table](src/main/kotlin/g0601_0700/s0668_kth_smallest_number_in_multiplication_table/Solution.kt)| Hard | Math, Binary_Search | 151 | 100.00
-| 0667 |[Beautiful Arrangement II](src/main/kotlin/g0601_0700/s0667_beautiful_arrangement_ii/Solution.kt)| Medium | Array, Math | 175 | 100.00
-| 0665 |[Non-decreasing Array](src/main/kotlin/g0601_0700/s0665_non_decreasing_array/Solution.kt)| Medium | Array | 256 | 85.71
-| 0664 |[Strange Printer](src/main/kotlin/g0601_0700/s0664_strange_printer/Solution.kt)| Hard | String, Dynamic_Programming | 196 | 100.00
-| 0662 |[Maximum Width of Binary Tree](src/main/kotlin/g0601_0700/s0662_maximum_width_of_binary_tree/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 189 | 75.00
-| 0661 |[Image Smoother](src/main/kotlin/g0601_0700/s0661_image_smoother/Solution.kt)| Easy | Array, Matrix | 352 | 100.00
-| 0659 |[Split Array into Consecutive Subsequences](src/main/kotlin/g0601_0700/s0659_split_array_into_consecutive_subsequences/Solution.kt)| Medium | Array, Hash_Table, Greedy, Heap_Priority_Queue | 352 | 100.00
-| 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, Binary_Search_II_Day_2 | 375 | 95.16
-| 0657 |[Robot Return to Origin](src/main/kotlin/g0601_0700/s0657_robot_return_to_origin/Solution.kt)| Easy | String, Simulation | 186 | 100.00
-| 0655 |[Print Binary Tree](src/main/kotlin/g0601_0700/s0655_print_binary_tree/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 176 | 100.00
-| 0654 |[Maximum Binary Tree](src/main/kotlin/g0601_0700/s0654_maximum_binary_tree/Solution.kt)| Medium | Array, Tree, Binary_Tree, Stack, Monotonic_Stack, Divide_and_Conquer | 271 | 90.00
-| 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, Data_Structure_I_Day_14_Tree | 231 | 96.08
-| 0652 |[Find Duplicate Subtrees](src/main/kotlin/g0601_0700/s0652_find_duplicate_subtrees/Solution.kt)| Medium | Hash_Table, Depth_First_Search, Tree, Binary_Tree | 266 | 76.00
-| 0650 |[2 Keys Keyboard](src/main/kotlin/g0601_0700/s0650_2_keys_keyboard/Solution.kt)| Medium | Dynamic_Programming, Math | 115 | 100.00
-| 0649 |[Dota2 Senate](src/main/kotlin/g0601_0700/s0649_dota2_senate/Solution.kt)| Medium | String, Greedy, Queue | 217 | 100.00
-| 0648 |[Replace Words](src/main/kotlin/g0601_0700/s0648_replace_words/Solution.kt)| Medium | Array, String, Hash_Table, Trie | 392 | 100.00
-| 0647 |[Palindromic Substrings](src/main/kotlin/g0601_0700/s0647_palindromic_substrings/Solution.kt)| Medium | Top_100_Liked_Questions, String, Dynamic_Programming | 266 | 67.83
-| 0646 |[Maximum Length of Pair Chain](src/main/kotlin/g0601_0700/s0646_maximum_length_of_pair_chain/Solution.kt)| Medium | Array, Dynamic_Programming, Sorting, Greedy | 249 | 100.00
-| 0645 |[Set Mismatch](src/main/kotlin/g0601_0700/s0645_set_mismatch/Solution.kt)| Easy | Array, Hash_Table, Sorting, Bit_Manipulation | 246 | 88.46
-| 0643 |[Maximum Average Subarray I](src/main/kotlin/g0601_0700/s0643_maximum_average_subarray_i/Solution.kt)| Easy | Array, Sliding_Window | 494 | 98.65
-| 0641 |[Design Circular Deque](src/main/kotlin/g0601_0700/s0641_design_circular_deque/MyCircularDeque.kt)| Medium | Array, Design, Linked_List, Queue | 232 | 100.00
-| 0640 |[Solve the Equation](src/main/kotlin/g0601_0700/s0640_solve_the_equation/Solution.kt)| Medium | String, Math, Simulation | 170 | 66.67
-| 0639 |[Decode Ways II](src/main/kotlin/g0601_0700/s0639_decode_ways_ii/Solution.kt)| Hard | String, Dynamic_Programming | 259 | 100.00
-| 0638 |[Shopping Offers](src/main/kotlin/g0601_0700/s0638_shopping_offers/Solution.kt)| Medium | Array, Dynamic_Programming, Bit_Manipulation, Backtracking, Bitmask, Memoization | 195 | 100.00
-| 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
-| 0636 |[Exclusive Time of Functions](src/main/kotlin/g0601_0700/s0636_exclusive_time_of_functions/Solution.kt)| Medium | Array, Stack | 270 | 80.00
-| 0633 |[Sum of Square Numbers](src/main/kotlin/g0601_0700/s0633_sum_of_square_numbers/Solution.kt)| Medium | Math, Binary_Search, Two_Pointers, Binary_Search_I_Day_10 | 126 | 100.00
-| 0632 |[Smallest Range Covering Elements from K Lists](src/main/kotlin/g0601_0700/s0632_smallest_range_covering_elements_from_k_lists/Solution.kt)| Hard | Array, Hash_Table, Sorting, Greedy, Heap_Priority_Queue, Sliding_Window | 399 | 83.33
-| 0630 |[Course Schedule III](src/main/kotlin/g0601_0700/s0630_course_schedule_iii/Solution.kt)| Hard | Array, Greedy, Heap_Priority_Queue | 536 | 100.00
-| 0629 |[K Inverse Pairs Array](src/main/kotlin/g0601_0700/s0629_k_inverse_pairs_array/Solution.kt)| Hard | Dynamic_Programming | 155 | 100.00
-| 0628 |[Maximum Product of Three Numbers](src/main/kotlin/g0601_0700/s0628_maximum_product_of_three_numbers/Solution.kt)| Easy | Array, Math, Sorting | 276 | 97.30
-| 0627 |[Swap Salary](src/main/kotlin/g0601_0700/s0627_swap_salary/script.sql)| Easy | Database, SQL_I_Day_2_Select_and_Order | 400 | 51.04
-| 0626 |[Exchange Seats](src/main/kotlin/g0601_0700/s0626_exchange_seats/script.sql)| Medium | Database | 502 | 50.56
-| 0623 |[Add One Row to Tree](src/main/kotlin/g0601_0700/s0623_add_one_row_to_tree/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 202 | 100.00
-| 0622 |[Design Circular Queue](src/main/kotlin/g0601_0700/s0622_design_circular_queue/MyCircularQueue.kt)| Medium | Array, Design, Linked_List, Queue, Programming_Skills_II_Day_20 | 234 | 92.68
-| 0621 |[Task Scheduler](src/main/kotlin/g0601_0700/s0621_task_scheduler/Solution.kt)| Medium | Array, Hash_Table, Sorting, Greedy, Heap_Priority_Queue, Counting, Level_2_Day_5_Greedy | 266 | 98.36
-| 0620 |[Not Boring Movies](src/main/kotlin/g0601_0700/s0620_not_boring_movies/script.sql)| Easy | Database | 305 | 59.80
-| 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, Algorithm_I_Day_8_Breadth_First_Search_Depth_First_Search | 243 | 72.83
-| 0611 |[Valid Triangle Number](src/main/kotlin/g0601_0700/s0611_valid_triangle_number/Solution.kt)| Medium | Array, Sorting, Greedy, Binary_Search, Two_Pointers, Binary_Search_II_Day_1 | 203 | 100.00
-| 0609 |[Find Duplicate File in System](src/main/kotlin/g0601_0700/s0609_find_duplicate_file_in_system/Solution.kt)| Medium | Array, String, Hash_Table | 426 | 100.00
-| 0608 |[Tree Node](src/main/kotlin/g0601_0700/s0608_tree_node/script.sql)| Medium | LeetCode_Curated_SQL_70, Database, SQL_I_Day_4_Union_and_Select | 794 | 48.38
-| 0607 |[Sales Person](src/main/kotlin/g0601_0700/s0607_sales_person/script.sql)| Easy | LeetCode_Curated_SQL_70, Database, SQL_I_Day_6_Union | 2142 | 44.56
-| 0606 |[Construct String from Binary Tree](src/main/kotlin/g0601_0700/s0606_construct_string_from_binary_tree/Solution.kt)| Easy | String, Depth_First_Search, Tree, Binary_Tree | 187 | 100.00
-| 0605 |[Can Place Flowers](src/main/kotlin/g0601_0700/s0605_can_place_flowers/Solution.kt)| Easy | Array, Greedy, Udemy_Arrays | 209 | 85.71
-| 0601 |[Human Traffic of Stadium](src/main/kotlin/g0601_0700/s0601_human_traffic_of_stadium/script.sql)| Hard | Database | 529 | 51.80
-| 0600 |[Non-negative Integers without Consecutive Ones](src/main/kotlin/g0501_0600/s0600_non_negative_integers_without_consecutive_ones/Solution.kt)| Hard | Dynamic_Programming | 142 | 100.00
-| 0599 |[Minimum Index Sum of Two Lists](src/main/kotlin/g0501_0600/s0599_minimum_index_sum_of_two_lists/Solution.kt)| Easy | Array, String, Hash_Table | 293 | 100.00
-| 0598 |[Range Addition II](src/main/kotlin/g0501_0600/s0598_range_addition_ii/Solution.kt)| Easy | Array, Math | 176 | 66.67
-| 0596 |[Classes More Than 5 Students](src/main/kotlin/g0501_0600/s0596_classes_more_than_5_students/script.sql)| Easy | Database | 484 | 50.92
-| 0595 |[Big Countries](src/main/kotlin/g0501_0600/s0595_big_countries/script.sql)| Easy | Database, SQL_I_Day_1_Select | 417 | 56.09
-| 0594 |[Longest Harmonious Subsequence](src/main/kotlin/g0501_0600/s0594_longest_harmonious_subsequence/Solution.kt)| Easy | Array, Hash_Table, Sorting | 331 | 100.00
-| 0593 |[Valid Square](src/main/kotlin/g0501_0600/s0593_valid_square/Solution.kt)| Medium | Math, Geometry | 161 | 83.33
-| 0592 |[Fraction Addition and Subtraction](src/main/kotlin/g0501_0600/s0592_fraction_addition_and_subtraction/Solution.kt)| Medium | String, Math, Simulation | 164 | 100.00
-| 0591 |[Tag Validator](src/main/kotlin/g0501_0600/s0591_tag_validator/Solution.kt)| Hard | String, Stack | 177 | 100.00
-| 0590 |[N-ary Tree Postorder Traversal](src/main/kotlin/g0501_0600/s0590_n_ary_tree_postorder_traversal/Solution.kt)| Easy | Depth_First_Search, Tree, Stack | 237 | 88.10
-| 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, Programming_Skills_I_Day_5_Function, Level_1_Day_6_Tree | 233 | 84.02
-| 0587 |[Erect the Fence](src/main/kotlin/g0501_0600/s0587_erect_the_fence/Solution.kt)| Hard | Array, Math, Geometry | 470 | 100.00
-| 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, SQL_I_Day_8_Function | 768 | 44.85
-| 0584 |[Find Customer Referee](src/main/kotlin/g0501_0600/s0584_find_customer_referee/script.sql)| Easy | Database, SQL_I_Day_1_Select | 779 | 43.48
-| 0583 |[Delete Operation for Two Strings](src/main/kotlin/g0501_0600/s0583_delete_operation_for_two_strings/Solution.kt)| Medium | String, Dynamic_Programming, Algorithm_II_Day_17_Dynamic_Programming | 197 | 100.00
-| 0581 |[Shortest Unsorted Continuous Subarray](src/main/kotlin/g0501_0600/s0581_shortest_unsorted_continuous_subarray/Solution.kt)| Medium | Array, Sorting, Greedy, Two_Pointers, Stack, Monotonic_Stack | 246 | 100.00
-| 0576 |[Out of Boundary Paths](src/main/kotlin/g0501_0600/s0576_out_of_boundary_paths/Solution.kt)| Medium | Dynamic_Programming | 153 | 100.00
-| 0575 |[Distribute Candies](src/main/kotlin/g0501_0600/s0575_distribute_candies/Solution.kt)| Easy | Array, Hash_Table | 538 | 76.92
-| 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, Algorithm_II_Day_7_Breadth_First_Search_Depth_First_Search | 214 | 92.39
-| 0567 |[Permutation in String](src/main/kotlin/g0501_0600/s0567_permutation_in_string/Solution.kt)| Medium | String, Hash_Table, Two_Pointers, Sliding_Window, Algorithm_I_Day_6_Sliding_Window | 169 | 100.00
-| 0566 |[Reshape the Matrix](src/main/kotlin/g0501_0600/s0566_reshape_the_matrix/Solution.kt)| Easy | Array, Matrix, Simulation, Data_Structure_I_Day_4_Array, Programming_Skills_I_Day_7_Array | 239 | 99.05
-| 0565 |[Array Nesting](src/main/kotlin/g0501_0600/s0565_array_nesting/Solution.kt)| Medium | Array, Depth_First_Search | 553 | 100.00
-| 0564 |[Find the Closest Palindrome](src/main/kotlin/g0501_0600/s0564_find_the_closest_palindrome/Solution.kt)| Hard | String, Math | 179 | 100.00
-| 0563 |[Binary Tree Tilt](src/main/kotlin/g0501_0600/s0563_binary_tree_tilt/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree | 197 | 100.00
-| 0561 |[Array Partition](src/main/kotlin/g0501_0600/s0561_array_partition_i/Solution.kt)| Easy | Array, Sorting, Greedy, Counting_Sort | 337 | 90.48
-| 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, Data_Structure_II_Day_5_Array | 692 | 53.27
-| 0559 |[Maximum Depth of N-ary Tree](src/main/kotlin/g0501_0600/s0559_maximum_depth_of_n_ary_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree | 196 | 100.00
-| 0558 |[Logical OR of Two Binary Grids Represented as Quad-Trees](src/main/kotlin/g0501_0600/s0558_logical_or_of_two_binary_grids_represented_as_quad_trees/Solution.kt)| Medium | Tree, Divide_and_Conquer | 268 | 100.00
-| 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, Algorithm_I_Day_4_Two_Pointers | 215 | 98.10
-| 0556 |[Next Greater Element III](src/main/kotlin/g0501_0600/s0556_next_greater_element_iii/Solution.kt)| Medium | String, Math, Two_Pointers, Programming_Skills_II_Day_10 | 137 | 80.00
-| 0554 |[Brick Wall](src/main/kotlin/g0501_0600/s0554_brick_wall/Solution.kt)| Medium | Array, Hash_Table | 307 | 100.00
-| 0553 |[Optimal Division](src/main/kotlin/g0501_0600/s0553_optimal_division/Solution.kt)| Medium | Array, Dynamic_Programming, Math | 154 | 100.00
-| 0552 |[Student Attendance Record II](src/main/kotlin/g0501_0600/s0552_student_attendance_record_ii/Solution.kt)| Hard | Dynamic_Programming | 151 | 100.00
-| 0551 |[Student Attendance Record I](src/main/kotlin/g0501_0600/s0551_student_attendance_record_i/Solution.kt)| Easy | String | 151 | 95.00
-| 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, Algorithm_II_Day_6_Breadth_First_Search_Depth_First_Search, Graph_Theory_I_Day_8_Standard_Traversal, Level_2_Day_19_Union_Find | 229 | 79.73
-| 0546 |[Remove Boxes](src/main/kotlin/g0501_0600/s0546_remove_boxes/Solution.kt)| Hard | Array, Dynamic_Programming, Memoization | 283 | 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, Level_2_Day_7_Tree, Udemy_Tree_Stack_Queue | 307 | 43.93
-| 0542 |[01 Matrix](src/main/kotlin/g0501_0600/s0542_01_matrix/Solution.kt)| Medium | Array, Dynamic_Programming, Breadth_First_Search, Matrix, Algorithm_I_Day_9_Breadth_First_Search_Depth_First_Search, Graph_Theory_I_Day_5_Matrix_Related_Problems | 441 | 94.06
-| 0541 |[Reverse String II](src/main/kotlin/g0501_0600/s0541_reverse_string_ii/Solution.kt)| Easy | String, Two_Pointers | 200 | 83.33
-| 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, Binary_Search_II_Day_9 | 274 | 86.67
-| 0539 |[Minimum Time Difference](src/main/kotlin/g0501_0600/s0539_minimum_time_difference/Solution.kt)| Medium | Array, String, Math, Sorting | 183 | 100.00
-| 0538 |[Convert BST to Greater Tree](src/main/kotlin/g0501_0600/s0538_convert_bst_to_greater_tree/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 252 | 77.78
-| 0537 |[Complex Number Multiplication](src/main/kotlin/g0501_0600/s0537_complex_number_multiplication/Solution.kt)| Medium | String, Math, Simulation | 171 | 75.00
-| 0535 |[Encode and Decode TinyURL](src/main/kotlin/g0501_0600/s0535_encode_and_decode_tinyurl/Codec.kt)| Medium | String, Hash_Table, Design, Hash_Function | 183 | 81.25
-| 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, Udemy_Arrays | 230 | 84.62
-| 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
-| 0529 |[Minesweeper](src/main/kotlin/g0501_0600/s0529_minesweeper/Solution.kt)| Medium | Array, Depth_First_Search, Breadth_First_Search, Matrix | 243 | 87.50
-| 0528 |[Random Pick with Weight](src/main/kotlin/g0501_0600/s0528_random_pick_with_weight/Solution.kt)| Medium | Math, Binary_Search, Prefix_Sum, Randomized, Binary_Search_II_Day_13 | 393 | 91.38
-| 0526 |[Beautiful Arrangement](src/main/kotlin/g0501_0600/s0526_beautiful_arrangement/Solution.kt)| Medium | Array, Dynamic_Programming, Bit_Manipulation, Backtracking, Bitmask | 107 | 100.00
-| 0525 |[Contiguous Array](src/main/kotlin/g0501_0600/s0525_contiguous_array/Solution.kt)| Medium | Array, Hash_Table, Prefix_Sum | 471 | 100.00
-| 0524 |[Longest Word in Dictionary through Deleting](src/main/kotlin/g0501_0600/s0524_longest_word_in_dictionary_through_deleting/Solution.kt)| Medium | Array, String, Sorting, Two_Pointers | 307 | 100.00
-| 0523 |[Continuous Subarray Sum](src/main/kotlin/g0501_0600/s0523_continuous_subarray_sum/Solution.kt)| Medium | Array, Hash_Table, Math, Prefix_Sum | 682 | 95.45
-| 0522 |[Longest Uncommon Subsequence II](src/main/kotlin/g0501_0600/s0522_longest_uncommon_subsequence_ii/Solution.kt)| Medium | Array, String, Hash_Table, Sorting, Two_Pointers | 163 | 100.00
-| 0521 |[Longest Uncommon Subsequence I](src/main/kotlin/g0501_0600/s0521_longest_uncommon_subsequence_i/Solution.kt)| Easy | String | 146 | 88.89
-| 0520 |[Detect Capital](src/main/kotlin/g0501_0600/s0520_detect_capital/Solution.kt)| Easy | String | 161 | 84.54
-| 0519 |[Random Flip Matrix](src/main/kotlin/g0501_0600/s0519_random_flip_matrix/Solution.kt)| Medium | Hash_Table, Math, Randomized, Reservoir_Sampling | 270 | 100.00
-| 0518 |[Coin Change II](src/main/kotlin/g0501_0600/s0518_coin_change_2/Solution.kt)| Medium | Array, Dynamic_Programming, Dynamic_Programming_I_Day_20 | 139 | 100.00
-| 0517 |[Super Washing Machines](src/main/kotlin/g0501_0600/s0517_super_washing_machines/Solution.kt)| Hard | Array, Greedy | 210 | 100.00
-| 0516 |[Longest Palindromic Subsequence](src/main/kotlin/g0501_0600/s0516_longest_palindromic_subsequence/Solution.kt)| Medium | String, Dynamic_Programming, Dynamic_Programming_I_Day_17 | 243 | 87.50
-| 0515 |[Find Largest Value in Each Tree Row](src/main/kotlin/g0501_0600/s0515_find_largest_value_in_each_tree_row/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 238 | 73.33
-| 0514 |[Freedom Trail](src/main/kotlin/g0501_0600/s0514_freedom_trail/Solution.kt)| Hard | String, Dynamic_Programming, Depth_First_Search, Breadth_First_Search | 182 | 100.00
-| 0513 |[Find Bottom Left Tree Value](src/main/kotlin/g0501_0600/s0513_find_bottom_left_tree_value/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree | 190 | 88.24
-| 0511 |[Game Play Analysis I](src/main/kotlin/g0501_0600/s0511_game_play_analysis_i/script.sql)| Easy | LeetCode_Curated_SQL_70, Database, SQL_I_Day_8_Function | 790 | 45.04
-| 0509 |[Fibonacci Number](src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt)| Easy | Dynamic_Programming, Math, Recursion, Memoization, Dynamic_Programming_I_Day_1, Level_1_Day_10_Dynamic_Programming, Udemy_Dynamic_Programming | 139 | 82.72
-| 0508 |[Most Frequent Subtree Sum](src/main/kotlin/g0501_0600/s0508_most_frequent_subtree_sum/Solution.kt)| Medium | Hash_Table, Depth_First_Search, Tree, Binary_Tree | 246 | 80.00
-| 0507 |[Perfect Number](src/main/kotlin/g0501_0600/s0507_perfect_number/Solution.kt)| Easy | Math | 172 | 81.82
-| 0506 |[Relative Ranks](src/main/kotlin/g0501_0600/s0506_relative_ranks/Solution.kt)| Easy | Array, Sorting, Heap_Priority_Queue | 244 | 94.23
-| 0504 |[Base 7](src/main/kotlin/g0501_0600/s0504_base_7/Solution.kt)| Easy | Math | 136 | 100.00
-| 0503 |[Next Greater Element II](src/main/kotlin/g0501_0600/s0503_next_greater_element_ii/Solution.kt)| Medium | Array, Stack, Monotonic_Stack, Programming_Skills_II_Day_10 | 331 | 92.68
-| 0502 |[IPO](src/main/kotlin/g0501_0600/s0502_ipo/Solution.kt)| Hard | Array, Sorting, Greedy, Heap_Priority_Queue | 799 | 54.55
-| 0501 |[Find Mode in Binary Search Tree](src/main/kotlin/g0501_0600/s0501_find_mode_in_binary_search_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 235 | 86.67
-| 0500 |[Keyboard Row](src/main/kotlin/g0401_0500/s0500_keyboard_row/Solution.kt)| Easy | Array, String, Hash_Table | 170 | 85.19
-| 0498 |[Diagonal Traverse](src/main/kotlin/g0401_0500/s0498_diagonal_traverse/Solution.kt)| Medium | Array, Matrix, Simulation | 430 | 61.54
-| 0497 |[Random Point in Non-overlapping Rectangles](src/main/kotlin/g0401_0500/s0497_random_point_in_non_overlapping_rectangles/Solution.kt)| Medium | Math, Binary_Search, Prefix_Sum, Ordered_Set, Randomized, Reservoir_Sampling | 759 | 100.00
-| 0496 |[Next Greater Element I](src/main/kotlin/g0401_0500/s0496_next_greater_element_i/Solution.kt)| Easy | Array, Hash_Table, Stack, Monotonic_Stack, Programming_Skills_I_Day_5_Function | 171 | 100.00
-| 0495 |[Teemo Attacking](src/main/kotlin/g0401_0500/s0495_teemo_attacking/Solution.kt)| Easy | Array, Simulation | 283 | 100.00
-| 0494 |[Target Sum](src/main/kotlin/g0401_0500/s0494_target_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Backtracking | 308 | 89.61
-| 0493 |[Reverse Pairs](src/main/kotlin/g0401_0500/s0493_reverse_pairs/Solution.kt)| Hard | Array, Binary_Search, Ordered_Set, Divide_and_Conquer, Segment_Tree, Binary_Indexed_Tree, Merge_Sort | 887 | 66.67
-| 0492 |[Construct the Rectangle](src/main/kotlin/g0401_0500/s0492_construct_the_rectangle/Solution.kt)| Easy | Math | 202 | 88.89
-| 0491 |[Non-decreasing Subsequences](src/main/kotlin/g0401_0500/s0491_increasing_subsequences/Solution.kt)| Medium | Array, Hash_Table, Bit_Manipulation, Backtracking | 499 | 100.00
-| 0488 |[Zuma Game](src/main/kotlin/g0401_0500/s0488_zuma_game/Solution.kt)| Hard | String, Dynamic_Programming, Breadth_First_Search, Memoization | 1727 | 100.00
-| 0486 |[Predict the Winner](src/main/kotlin/g0401_0500/s0486_predict_the_winner/Solution.kt)| Medium | Array, Dynamic_Programming, Math, Recursion, Game_Theory | 158 | 84.62
-| 0485 |[Max Consecutive Ones](src/main/kotlin/g0401_0500/s0485_max_consecutive_ones/Solution.kt)| Easy | Array | 272 | 88.46
-| 0483 |[Smallest Good Base](src/main/kotlin/g0401_0500/s0483_smallest_good_base/Solution.kt)| Hard | Math, Binary_Search | 164 | 100.00
-| 0482 |[License Key Formatting](src/main/kotlin/g0401_0500/s0482_license_key_formatting/Solution.kt)| Easy | String | 234 | 87.18
-| 0481 |[Magical String](src/main/kotlin/g0401_0500/s0481_magical_string/Solution.kt)| Medium | String, Two_Pointers | 124 | 100.00
-| 0480 |[Sliding Window Median](src/main/kotlin/g0401_0500/s0480_sliding_window_median/Solution.kt)| Hard | Array, Hash_Table, Heap_Priority_Queue, Sliding_Window | 409 | 100.00
-| 0479 |[Largest Palindrome Product](src/main/kotlin/g0401_0500/s0479_largest_palindrome_product/Solution.kt)| Hard | Math | 147 | 100.00
-| 0478 |[Generate Random Point in a Circle](src/main/kotlin/g0401_0500/s0478_generate_random_point_in_a_circle/Solution.kt)| Medium | Math, Geometry, Randomized, Rejection_Sampling | 862 | 100.00
-| 0477 |[Total Hamming Distance](src/main/kotlin/g0401_0500/s0477_total_hamming_distance/Solution.kt)| Medium | Array, Math, Bit_Manipulation | 298 | 100.00
-| 0476 |[Number Complement](src/main/kotlin/g0401_0500/s0476_number_complement/Solution.kt)| Easy | Bit_Manipulation | 133 | 100.00
-| 0475 |[Heaters](src/main/kotlin/g0401_0500/s0475_heaters/Solution.kt)| Medium | Array, Sorting, Binary_Search, Two_Pointers | 356 | 87.50
-| 0474 |[Ones and Zeroes](src/main/kotlin/g0401_0500/s0474_ones_and_zeroes/Solution.kt)| Medium | Array, String, Dynamic_Programming | 204 | 100.00
-| 0473 |[Matchsticks to Square](src/main/kotlin/g0401_0500/s0473_matchsticks_to_square/Solution.kt)| Medium | Array, Dynamic_Programming, Bit_Manipulation, Backtracking, Bitmask | 255 | 100.00
-| 0472 |[Concatenated Words](src/main/kotlin/g0401_0500/s0472_concatenated_words/Solution.kt)| Hard | Array, String, Dynamic_Programming, Depth_First_Search, Trie | 484 | 100.00
-| 0470 |[Implement Rand10() Using Rand7()](src/main/kotlin/g0401_0500/s0470_implement_rand10_using_rand7/Solution.kt)| Medium | Math, Randomized, Probability_and_Statistics, Rejection_Sampling | 220 | 100.00
-| 0468 |[Validate IP Address](src/main/kotlin/g0401_0500/s0468_validate_ip_address/Solution.kt)| Medium | String | 192 | 62.50
-| 0467 |[Unique Substrings in Wraparound String](src/main/kotlin/g0401_0500/s0467_unique_substrings_in_wraparound_string/Solution.kt)| Medium | String, Dynamic_Programming | 197 | 100.00
-| 0466 |[Count The Repetitions](src/main/kotlin/g0401_0500/s0466_count_the_repetitions/Solution.kt)| Hard | String, Dynamic_Programming | 147 | 100.00
-| 0464 |[Can I Win](src/main/kotlin/g0401_0500/s0464_can_i_win/Solution.kt)| Medium | Dynamic_Programming, Math, Bit_Manipulation, Bitmask, Memoization, Game_Theory | 213 | 100.00
-| 0463 |[Island Perimeter](src/main/kotlin/g0401_0500/s0463_island_perimeter/Solution.kt)| Easy | Array, Depth_First_Search, Breadth_First_Search, Matrix | 381 | 98.04
-| 0462 |[Minimum Moves to Equal Array Elements II](src/main/kotlin/g0401_0500/s0462_minimum_moves_to_equal_array_elements_ii/Solution.kt)| Medium | Array, Math, Sorting | 210 | 100.00
-| 0461 |[Hamming Distance](src/main/kotlin/g0401_0500/s0461_hamming_distance/Solution.kt)| Easy | Bit_Manipulation, Udemy_Bit_Manipulation | 150 | 96.15
-| 0460 |[LFU Cache](src/main/kotlin/g0401_0500/s0460_lfu_cache/LFUCache.kt)| Hard | Hash_Table, Design, Linked_List, Doubly_Linked_List | 1143 | 100.00
-| 0459 |[Repeated Substring Pattern](src/main/kotlin/g0401_0500/s0459_repeated_substring_pattern/Solution.kt)| Easy | String, String_Matching, Programming_Skills_II_Day_2 | 201 | 100.00
-| 0458 |[Poor Pigs](src/main/kotlin/g0401_0500/s0458_poor_pigs/Solution.kt)| Hard | Dynamic_Programming, Math, Combinatorics | 133 | 80.00
-| 0457 |[Circular Array Loop](src/main/kotlin/g0401_0500/s0457_circular_array_loop/Solution.kt)| Medium | Array, Hash_Table, Two_Pointers | 143 | 100.00
-| 0456 |[132 Pattern](src/main/kotlin/g0401_0500/s0456_132_pattern/Solution.kt)| Medium | Array, Binary_Search, Stack, Ordered_Set, Monotonic_Stack, Udemy_Arrays | 434 | 100.00
-| 0455 |[Assign Cookies](src/main/kotlin/g0401_0500/s0455_assign_cookies/Solution.kt)| Easy | Array, Sorting, Greedy | 260 | 96.67
-| 0454 |[4Sum II](src/main/kotlin/g0401_0500/s0454_4sum_ii/Solution.kt)| Medium | Top_Interview_Questions, Array, Hash_Table | 660 | 85.71
-| 0453 |[Minimum Moves to Equal Array Elements](src/main/kotlin/g0401_0500/s0453_minimum_moves_to_equal_array_elements/Solution.kt)| Medium | Array, Math | 282 | 100.00
-| 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 | 934 | 100.00
-| 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, Data_Structure_II_Day_21_Heap_Priority_Queue | 288 | 81.72
-| 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, Data_Structure_II_Day_16_Tree | 257 | 84.62
-| 0449 |[Serialize and Deserialize BST](src/main/kotlin/g0401_0500/s0449_serialize_and_deserialize_bst/Codec.kt)| Medium | String, Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Design, Binary_Search_Tree | 233 | 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, Udemy_Arrays | 394 | 100.00
-| 0447 |[Number of Boomerangs](src/main/kotlin/g0401_0500/s0447_number_of_boomerangs/Solution.kt)| Medium | Array, Hash_Table, Math | 308 | 100.00
-| 0446 |[Arithmetic Slices II - Subsequence](src/main/kotlin/g0401_0500/s0446_arithmetic_slices_ii_subsequence/Solution.kt)| Hard | Array, Dynamic_Programming | 312 | 100.00
-| 0445 |[Add Two Numbers II](src/main/kotlin/g0401_0500/s0445_add_two_numbers_ii/Solution.kt)| Medium | Math, Stack, Linked_List, Programming_Skills_II_Day_15, Udemy_Linked_List | 240 | 82.61
-| 0443 |[String Compression](src/main/kotlin/g0401_0500/s0443_string_compression/Solution.kt)| Medium | String, Two_Pointers | 198 | 92.68
-| 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, Udemy_Arrays | 480 | 73.81
-| 0441 |[Arranging Coins](src/main/kotlin/g0401_0500/s0441_arranging_coins/Solution.kt)| Easy | Math, Binary_Search, Binary_Search_I_Day_6 | 150 | 84.21
-| 0440 |[K-th Smallest in Lexicographical Order](src/main/kotlin/g0401_0500/s0440_k_th_smallest_in_lexicographical_order/Solution.kt)| Hard | Trie | 149 | 100.00
-| 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, Algorithm_II_Day_5_Sliding_Window, Programming_Skills_II_Day_12, Level_1_Day_12_Sliding_Window/Two_Pointer | 561 | 54.68
-| 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, Level_2_Day_7_Tree | 403 | 54.12
-| 0436 |[Find Right Interval](src/main/kotlin/g0401_0500/s0436_find_right_interval/Solution.kt)| Medium | Array, Sorting, Binary_Search, Binary_Search_II_Day_11 | 333 | 100.00
-| 0435 |[Non-overlapping Intervals](src/main/kotlin/g0401_0500/s0435_non_overlapping_intervals/Solution.kt)| Medium | Array, Dynamic_Programming, Sorting, Greedy, Data_Structure_II_Day_4_Array | 1040 | 85.07
-| 0434 |[Number of Segments in a String](src/main/kotlin/g0401_0500/s0434_number_of_segments_in_a_string/Solution.kt)| Easy | String | 167 | 80.00
-| 0433 |[Minimum Genetic Mutation](src/main/kotlin/g0401_0500/s0433_minimum_genetic_mutation/Solution.kt)| Medium | String, Hash_Table, Breadth_First_Search, Graph_Theory_I_Day_12_Breadth_First_Search | 204 | 82.08
-| 0432 |[All O\`one Data Structure](src/main/kotlin/g0401_0500/s0432_all_oone_data_structure/AllOne.kt)| Hard | Hash_Table, Design, Linked_List, Doubly_Linked_List | 1200 | 100.00
-| 0430 |[Flatten a Multilevel Doubly Linked List](src/main/kotlin/g0401_0500/s0430_flatten_a_multilevel_doubly_linked_list/Solution.kt)| Medium | Depth_First_Search, Linked_List, Doubly_Linked_List | 194 | 97.44
-| 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, Programming_Skills_II_Day_9 | 278 | 75.00
-| 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
-| 0424 |[Longest Repeating Character Replacement](src/main/kotlin/g0401_0500/s0424_longest_repeating_character_replacement/Solution.kt)| Medium | String, Hash_Table, Sliding_Window, Level_1_Day_12_Sliding_Window/Two_Pointer | 288 | 84.38
-| 0423 |[Reconstruct Original Digits from English](src/main/kotlin/g0401_0500/s0423_reconstruct_original_digits_from_english/Solution.kt)| Medium | String, Hash_Table, Math | 349 | 100.00
-| 0421 |[Maximum XOR of Two Numbers in an Array](src/main/kotlin/g0401_0500/s0421_maximum_xor_of_two_numbers_in_an_array/Solution.kt)| Medium | Array, Hash_Table, Bit_Manipulation, Trie | 710 | 100.00
-| 0420 |[Strong Password Checker](src/main/kotlin/g0401_0500/s0420_strong_password_checker/Solution.kt)| Hard | String, Greedy, Heap_Priority_Queue | 157 | 80.00
-| 0419 |[Battleships in a Board](src/main/kotlin/g0401_0500/s0419_battleships_in_a_board/Solution.kt)| Medium | Array, Depth_First_Search, Matrix | 273 | 76.92
-| 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, Graph_Theory_I_Day_4_Matrix_Related_Problems, Level_2_Day_10_Graph/BFS/DFS, Udemy_Graph | 319 | 100.00
-| 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, Level_2_Day_13_Dynamic_Programming | 204 | 98.82
-| 0415 |[Add Strings](src/main/kotlin/g0401_0500/s0415_add_strings/Solution.kt)| Easy | String, Math, Simulation, Data_Structure_II_Day_6_String | 296 | 76.00
-| 0414 |[Third Maximum Number](src/main/kotlin/g0401_0500/s0414_third_maximum_number/Solution.kt)| Easy | Array, Sorting | 317 | 73.00
-| 0413 |[Arithmetic Slices](src/main/kotlin/g0401_0500/s0413_arithmetic_slices/Solution.kt)| Medium | Array, Dynamic_Programming, Algorithm_II_Day_14_Dynamic_Programming, Dynamic_Programming_I_Day_10 | 156 | 100.00
-| 0412 |[Fizz Buzz](src/main/kotlin/g0401_0500/s0412_fizz_buzz/Solution.kt)| Easy | Top_Interview_Questions, String, Math, Simulation, Udemy_Integers | 307 | 71.81
-| 0410 |[Split Array Largest Sum](src/main/kotlin/g0401_0500/s0410_split_array_largest_sum/Solution.kt)| Hard | Array, Dynamic_Programming, Greedy, Binary_Search | 165 | 100.00
-| 0409 |[Longest Palindrome](src/main/kotlin/g0401_0500/s0409_longest_palindrome/Solution.kt)| Easy | String, Hash_Table, Greedy, Data_Structure_II_Day_6_String, Level_1_Day_5_Greedy | 259 | 60.71
-| 0407 |[Trapping Rain Water II](src/main/kotlin/g0401_0500/s0407_trapping_rain_water_ii/Solution.kt)| Hard | Array, Breadth_First_Search, Matrix, Heap_Priority_Queue | 500 | 100.00
-| 0406 |[Queue Reconstruction by Height](src/main/kotlin/g0401_0500/s0406_queue_reconstruction_by_height/Solution.kt)| Medium | Array, Sorting, Greedy, Segment_Tree, Binary_Indexed_Tree | 306 | 100.00
-| 0405 |[Convert a Number to Hexadecimal](src/main/kotlin/g0401_0500/s0405_convert_a_number_to_hexadecimal/Solution.kt)| Easy | Math, Bit_Manipulation | 132 | 100.00
-| 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, Programming_Skills_I_Day_10_Linked_List_and_Tree | 173 | 86.05
-| 0403 |[Frog Jump](src/main/kotlin/g0401_0500/s0403_frog_jump/Solution.kt)| Hard | Array, Dynamic_Programming | 240 | 100.00
-| 0402 |[Remove K Digits](src/main/kotlin/g0401_0500/s0402_remove_k_digits/Solution.kt)| Medium | String, Greedy, Stack, Monotonic_Stack | 375 | 75.00
-| 0401 |[Binary Watch](src/main/kotlin/g0401_0500/s0401_binary_watch/Solution.kt)| Easy | Bit_Manipulation, Backtracking | 266 | 71.43
-| 0400 |[Nth Digit](src/main/kotlin/g0301_0400/s0400_nth_digit/Solution.kt)| Medium | Math, Binary_Search | 271 | 50.00
-| 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 | 183 | 91.49
-| 0398 |[Random Pick Index](src/main/kotlin/g0301_0400/s0398_random_pick_index/Solution.kt)| Medium | Hash_Table, Math, Randomized, Reservoir_Sampling | 1091 | 75.00
-| 0397 |[Integer Replacement](src/main/kotlin/g0301_0400/s0397_integer_replacement/Solution.kt)| Medium | Dynamic_Programming, Greedy, Bit_Manipulation, Memoization | 145 | 87.50
-| 0396 |[Rotate Function](src/main/kotlin/g0301_0400/s0396_rotate_function/Solution.kt)| Medium | Array, Dynamic_Programming, Math | 571 | 87.50
-| 0395 |[Longest Substring with At Least K Repeating Characters](src/main/kotlin/g0301_0400/s0395_longest_substring_with_at_least_k_repeating_characters/Solution.kt)| Medium | Top_Interview_Questions, String, Hash_Table, Sliding_Window, Divide_and_Conquer | 274 | 66.67
-| 0394 |[Decode String](src/main/kotlin/g0301_0400/s0394_decode_string/Solution.kt)| Medium | Top_100_Liked_Questions, String, Stack, Recursion, Level_1_Day_14_Stack, Udemy_Strings | 224 | 64.86
-| 0393 |[UTF-8 Validation](src/main/kotlin/g0301_0400/s0393_utf_8_validation/Solution.kt)| Medium | Array, Bit_Manipulation | 219 | 100.00
-| 0392 |[Is Subsequence](src/main/kotlin/g0301_0400/s0392_is_subsequence/Solution.kt)| Easy | String, Dynamic_Programming, Two_Pointers, Dynamic_Programming_I_Day_19, Level_1_Day_2_String, Udemy_Two_Pointers | 156 | 87.74
-| 0391 |[Perfect Rectangle](src/main/kotlin/g0301_0400/s0391_perfect_rectangle/Solution.kt)| Hard | Array, Line_Sweep | 897 | 100.00
-| 0390 |[Elimination Game](src/main/kotlin/g0301_0400/s0390_elimination_game/Solution.kt)| Medium | Math, Recursion | 319 | 55.56
-| 0389 |[Find the Difference](src/main/kotlin/g0301_0400/s0389_find_the_difference/Solution.kt)| Easy | String, Hash_Table, Sorting, Bit_Manipulation, Programming_Skills_I_Day_8_String, Udemy_Bit_Manipulation | 256 | 64.81
-| 0388 |[Longest Absolute File Path](src/main/kotlin/g0301_0400/s0388_longest_absolute_file_path/Solution.kt)| Medium | String, Depth_First_Search, Stack | 150 | 100.00
-| 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, Data_Structure_I_Day_6_String | 369 | 82.68
-| 0386 |[Lexicographical Numbers](src/main/kotlin/g0301_0400/s0386_lexicographical_numbers/Solution.kt)| Medium | Depth_First_Search, Trie | 463 | 83.33
-| 0385 |[Mini Parser](src/main/kotlin/g0301_0400/s0385_mini_parser/Solution.kt)| Medium | String, Depth_First_Search, Stack | 210 | 100.00
-| 0384 |[Shuffle an Array](src/main/kotlin/g0301_0400/s0384_shuffle_an_array/Solution.kt)| Medium | Top_Interview_Questions, Array, Math, Randomized, Algorithm_II_Day_20_Others | 940 | 72.09
-| 0383 |[Ransom Note](src/main/kotlin/g0301_0400/s0383_ransom_note/Solution.kt)| Easy | String, Hash_Table, Counting, Data_Structure_I_Day_6_String | 333 | 79.58
-| 0382 |[Linked List Random Node](src/main/kotlin/g0301_0400/s0382_linked_list_random_node/Solution.kt)| Medium | Math, Linked_List, Randomized, Reservoir_Sampling | 283 | 100.00
-| 0381 |[Insert Delete GetRandom O(1) - Duplicates allowed](src/main/kotlin/g0301_0400/s0381_insert_delete_getrandom_o1_duplicates_allowed/RandomizedCollection.kt)| Hard | Array, Hash_Table, Math, Design, Randomized | 1313 | 50.00
-| 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, Programming_Skills_II_Day_20 | 1326 | 68.23
-| 0378 |[Kth Smallest Element in a Sorted Matrix](src/main/kotlin/g0301_0400/s0378_kth_smallest_element_in_a_sorted_matrix/Solution.kt)| Medium | Top_Interview_Questions, Array, Sorting, Binary_Search, Matrix, Heap_Priority_Queue | 522 | 59.78
-| 0377 |[Combination Sum IV](src/main/kotlin/g0301_0400/s0377_combination_sum_iv/Solution.kt)| Medium | Array, Dynamic_Programming, Dynamic_Programming_I_Day_21 | 217 | 72.41
-| 0376 |[Wiggle Subsequence](src/main/kotlin/g0301_0400/s0376_wiggle_subsequence/Solution.kt)| Medium | Array, Dynamic_Programming, Greedy, Dynamic_Programming_I_Day_18 | 162 | 88.89
-| 0375 |[Guess Number Higher or Lower II](src/main/kotlin/g0301_0400/s0375_guess_number_higher_or_lower_ii/Solution.kt)| Medium | Dynamic_Programming, Math, Game_Theory | 235 | 75.00
-| 0374 |[Guess Number Higher or Lower](src/main/kotlin/g0301_0400/s0374_guess_number_higher_or_lower/Solution.kt)| Easy | Binary_Search, Interactive, Binary_Search_I_Day_1 | 134 | 94.19
-| 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
-| 0372 |[Super Pow](src/main/kotlin/g0301_0400/s0372_super_pow/Solution.kt)| Medium | Math, Divide_and_Conquer | 196 | 100.00
-| 0371 |[Sum of Two Integers](src/main/kotlin/g0301_0400/s0371_sum_of_two_integers/Solution.kt)| Medium | Top_Interview_Questions, Math, Bit_Manipulation, Udemy_Bit_Manipulation | 129 | 95.45
-| 0368 |[Largest Divisible Subset](src/main/kotlin/g0301_0400/s0368_largest_divisible_subset/Solution.kt)| Medium | Array, Dynamic_Programming, Math, Sorting | 412 | 73.33
-| 0367 |[Valid Perfect Square](src/main/kotlin/g0301_0400/s0367_valid_perfect_square/Solution.kt)| Easy | Math, Binary_Search, Binary_Search_I_Day_3 | 137 | 94.55
-| 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, Graph_Theory_I_Day_11_Breadth_First_Search | 130 | 100.00
-| 0363 |[Max Sum of Rectangle No Larger Than K](src/main/kotlin/g0301_0400/s0363_max_sum_of_rectangle_no_larger_than_k/Solution.kt)| Hard | Array, Dynamic_Programming, Binary_Search, Matrix, Ordered_Set | 243 | 100.00
-| 0357 |[Count Numbers with Unique Digits](src/main/kotlin/g0301_0400/s0357_count_numbers_with_unique_digits/Solution.kt)| Medium | Dynamic_Programming, Math, Backtracking | 104 | 100.00
-| 0355 |[Design Twitter](src/main/kotlin/g0301_0400/s0355_design_twitter/Twitter.kt)| Medium | Hash_Table, Design, Heap_Priority_Queue, Linked_List | 288 | 68.75
-| 0354 |[Russian Doll Envelopes](src/main/kotlin/g0301_0400/s0354_russian_doll_envelopes/Solution.kt)| Hard | Array, Dynamic_Programming, Sorting, Binary_Search | 788 | 100.00
-| 0352 |[Data Stream as Disjoint Intervals](src/main/kotlin/g0301_0400/s0352_data_stream_as_disjoint_intervals/SummaryRanges.kt)| Hard | Binary_Search, Design, Ordered_Set | 905 | 75.00
-| 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, Data_Structure_I_Day_3_Array, Binary_Search_I_Day_10 | 321 | 73.37
-| 0349 |[Intersection of Two Arrays](src/main/kotlin/g0301_0400/s0349_intersection_of_two_arrays/Solution.kt)| Easy | Array, Hash_Table, Sorting, Binary_Search, Two_Pointers | 346 | 66.99
-| 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, Data_Structure_II_Day_20_Heap_Priority_Queue | 268 | 99.74
-| 0345 |[Reverse Vowels of a String](src/main/kotlin/g0301_0400/s0345_reverse_vowels_of_a_string/Solution.kt)| Easy | String, Two_Pointers | 349 | 80.63
-| 0344 |[Reverse String](src/main/kotlin/g0301_0400/s0344_reverse_string/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers, Recursion, Algorithm_I_Day_4_Two_Pointers, Udemy_Strings | 445 | 69.75
-| 0343 |[Integer Break](src/main/kotlin/g0301_0400/s0343_integer_break/Solution.kt)| Medium | Dynamic_Programming, Math, Algorithm_II_Day_18_Dynamic_Programming, Dynamic_Programming_I_Day_21 | 218 | 63.89
-| 0342 |[Power of Four](src/main/kotlin/g0301_0400/s0342_power_of_four/Solution.kt)| Easy | Math, Bit_Manipulation, Recursion | 150 | 92.11
-| 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, Programming_Skills_II_Day_18 | 210 | 100.00
-| 0338 |[Counting Bits](src/main/kotlin/g0301_0400/s0338_counting_bits/Solution.kt)| Easy | Top_100_Liked_Questions, Dynamic_Programming, Bit_Manipulation, Udemy_Bit_Manipulation | 186 | 99.26
-| 0337 |[House Robber III](src/main/kotlin/g0301_0400/s0337_house_robber_iii/Solution.kt)| Medium | Dynamic_Programming, Depth_First_Search, Tree, Binary_Tree, Udemy_Tree_Stack_Queue | 282 | 84.62
-| 0336 |[Palindrome Pairs](src/main/kotlin/g0301_0400/s0336_palindrome_pairs/Solution.kt)| Hard | Array, String, Hash_Table, Trie | 2451 | 67.33
-| 0335 |[Self Crossing](src/main/kotlin/g0301_0400/s0335_self_crossing/Solution.kt)| Hard | Array, Math, Geometry | 477 | 100.00
-| 0334 |[Increasing Triplet Subsequence](src/main/kotlin/g0301_0400/s0334_increasing_triplet_subsequence/Solution.kt)| Medium | Top_Interview_Questions, Array, Greedy, Data_Structure_II_Day_5_Array | 672 | 60.61
-| 0332 |[Reconstruct Itinerary](src/main/kotlin/g0301_0400/s0332_reconstruct_itinerary/Solution.kt)| Hard | Depth_First_Search, Graph, Eulerian_Circuit | 240 | 93.88
-| 0331 |[Verify Preorder Serialization of a Binary Tree](src/main/kotlin/g0301_0400/s0331_verify_preorder_serialization_of_a_binary_tree/Solution.kt)| Medium | String, Tree, Binary_Tree, Stack | 335 | 70.00
-| 0330 |[Patching Array](src/main/kotlin/g0301_0400/s0330_patching_array/Solution.kt)| Hard | Array, Greedy | 201 | 100.00
-| 0329 |[Longest Increasing Path in a Matrix](src/main/kotlin/g0301_0400/s0329_longest_increasing_path_in_a_matrix/Solution.kt)| Hard | Top_Interview_Questions, Dynamic_Programming, Depth_First_Search, Breadth_First_Search, Graph, Memoization, Topological_Sort | 322 | 92.65
-| 0328 |[Odd Even Linked List](src/main/kotlin/g0301_0400/s0328_odd_even_linked_list/Solution.kt)| Medium | Top_Interview_Questions, Linked_List, Level_2_Day_4_Linked_List, Udemy_Linked_List | 216 | 86.96
-| 0327 |[Count of Range Sum](src/main/kotlin/g0301_0400/s0327_count_of_range_sum/Solution.kt)| Hard | Array, Binary_Search, Ordered_Set, Divide_and_Conquer, Segment_Tree, Binary_Indexed_Tree, Merge_Sort | 638 | 100.00
-| 0326 |[Power of Three](src/main/kotlin/g0301_0400/s0326_power_of_three/Solution.kt)| Easy | Top_Interview_Questions, Math, Recursion | 413 | 76.12
-| 0324 |[Wiggle Sort II](src/main/kotlin/g0301_0400/s0324_wiggle_sort_ii/Solution.kt)| Medium | Top_Interview_Questions, Array, Sorting, Divide_and_Conquer, Quickselect | 545 | 57.14
-| 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, Algorithm_II_Day_18_Dynamic_Programming, Dynamic_Programming_I_Day_20, Level_2_Day_12_Dynamic_Programming | 332 | 50.68
-| 0321 |[Create Maximum Number](src/main/kotlin/g0301_0400/s0321_create_maximum_number/Solution.kt)| Hard | Greedy, Stack, Monotonic_Stack | 209 | 100.00
-| 0319 |[Bulb Switcher](src/main/kotlin/g0301_0400/s0319_bulb_switcher/Solution.kt)| Medium | Math, Brainteaser | 214 | 77.78
-| 0318 |[Maximum Product of Word Lengths](src/main/kotlin/g0301_0400/s0318_maximum_product_of_word_lengths/Solution.kt)| Medium | Array, String, Bit_Manipulation | 477 | 100.00
-| 0316 |[Remove Duplicate Letters](src/main/kotlin/g0301_0400/s0316_remove_duplicate_letters/Solution.kt)| Medium | String, Greedy, Stack, Monotonic_Stack | 291 | 81.82
-| 0315 |[Count of Smaller Numbers After Self](src/main/kotlin/g0301_0400/s0315_count_of_smaller_numbers_after_self/Solution.kt)| Hard | Top_Interview_Questions, Array, Binary_Search, Ordered_Set, Divide_and_Conquer, Segment_Tree, Binary_Indexed_Tree, Merge_Sort | 1282 | 88.46
-| 0313 |[Super Ugly Number](src/main/kotlin/g0301_0400/s0313_super_ugly_number/Solution.kt)| Medium | Array, Dynamic_Programming, Math | 330 | 100.00
-| 0312 |[Burst Balloons](src/main/kotlin/g0301_0400/s0312_burst_balloons/Solution.kt)| Hard | Array, Dynamic_Programming | 210 | 100.00
-| 0310 |[Minimum Height Trees](src/main/kotlin/g0301_0400/s0310_minimum_height_trees/Solution.kt)| Medium | Depth_First_Search, Breadth_First_Search, Graph, Topological_Sort | 521 | 97.56
-| 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, Dynamic_Programming_I_Day_8 | 272 | 73.33
-| 0307 |[Range Sum Query - Mutable](src/main/kotlin/g0301_0400/s0307_range_sum_query_mutable/NumArray.kt)| Medium | Array, Design, Segment_Tree, Binary_Indexed_Tree | 1729 | 78.79
-| 0306 |[Additive Number](src/main/kotlin/g0301_0400/s0306_additive_number/Solution.kt)| Medium | String, Backtracking | 261 | 63.16
-| 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, Dynamic_Programming_I_Day_14, Programming_Skills_II_Day_13, Udemy_2D_Arrays/Matrix | 1373 | 85.71
-| 0303 |[Range Sum Query - Immutable](src/main/kotlin/g0301_0400/s0303_range_sum_query_immutable/NumArray.kt)| Easy | Array, Design, Prefix_Sum, Programming_Skills_I_Day_12_Class_and_Object | 472 | 63.64
-| 0301 |[Remove Invalid Parentheses](src/main/kotlin/g0301_0400/s0301_remove_invalid_parentheses/Solution.kt)| Hard | String, Breadth_First_Search, Backtracking | 312 | 100.00
-| 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, Algorithm_II_Day_16_Dynamic_Programming, Binary_Search_II_Day_3, Dynamic_Programming_I_Day_18, Udemy_Dynamic_Programming | 318 | 82.28
-| 0299 |[Bulls and Cows](src/main/kotlin/g0201_0300/s0299_bulls_and_cows/Solution.kt)| Medium | String, Hash_Table, Counting, Level_1_Day_13_Hashmap | 254 | 84.82
-| 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, Data_Structure_II_Day_18_Tree, Udemy_Tree_Stack_Queue | 475 | 78.85
-| 0295 |[Find Median from Data Stream](src/main/kotlin/g0201_0300/s0295_find_median_from_data_stream/MedianFinder.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Sorting, Two_Pointers, Design, Heap_Priority_Queue, Data_Stream | 2289 | 33.60
-| 0292 |[Nim Game](src/main/kotlin/g0201_0300/s0292_nim_game/Solution.kt)| Easy | Math, Game_Theory, Brainteaser | 129 | 94.29
-| 0290 |[Word Pattern](src/main/kotlin/g0201_0300/s0290_word_pattern/Solution.kt)| Easy | String, Hash_Table, Data_Structure_II_Day_7_String | 177 | 89.55
-| 0289 |[Game of Life](src/main/kotlin/g0201_0300/s0289_game_of_life/Solution.kt)| Medium | Top_Interview_Questions, Array, Matrix, Simulation | 174 | 96.97
-| 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, Binary_Search_II_Day_5 | 656 | 66.21
-| 0284 |[Peeking Iterator](src/main/kotlin/g0201_0300/s0284_peeking_iterator/PeekingIterator.kt)| Medium | Array, Design, Iterator | 286 | 62.50
-| 0283 |[Move Zeroes](src/main/kotlin/g0201_0300/s0283_move_zeroes/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Two_Pointers, Algorithm_I_Day_3_Two_Pointers, Programming_Skills_I_Day_6_Array, Udemy_Arrays | 516 | 79.07
-| 0282 |[Expression Add Operators](src/main/kotlin/g0201_0300/s0282_expression_add_operators/Solution.kt)| Hard | String, Math, Backtracking | 367 | 85.71
-| 0279 |[Perfect Squares](src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt)| Medium | Top_Interview_Questions, Dynamic_Programming, Math, Breadth_First_Search, Dynamic_Programming_I_Day_21 | 176 | 98.80
-| 0278 |[First Bad Version](src/main/kotlin/g0201_0300/s0278_first_bad_version/Solution.kt)| Easy | Binary_Search, Interactive, Algorithm_I_Day_1_Binary_Search, Binary_Search_I_Day_5, Level_1_Day_7_Binary_Search | 349 | 76.86
-| 0275 |[H-Index II](src/main/kotlin/g0201_0300/s0275_h_index_ii/Solution.kt)| Medium | Array, Binary_Search, Binary_Search_II_Day_8 | 398 | 81.82
-| 0274 |[H-Index](src/main/kotlin/g0201_0300/s0274_h_index/Solution.kt)| Medium | Array, Sorting, Counting_Sort | 291 | 45.45
-| 0273 |[Integer to English Words](src/main/kotlin/g0201_0300/s0273_integer_to_english_words/Solution.kt)| Hard | String, Math, Recursion, Udemy_Strings | 273 | 82.93
-| 0268 |[Missing Number](src/main/kotlin/g0201_0300/s0268_missing_number/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Math, Sorting, Binary_Search, Bit_Manipulation | 380 | 83.49
-| 0264 |[Ugly Number II](src/main/kotlin/g0201_0300/s0264_ugly_number_ii/Solution.kt)| Medium | Hash_Table, Dynamic_Programming, Math, Heap_Priority_Queue, Dynamic_Programming_I_Day_11 | 182 | 95.45
-| 0263 |[Ugly Number](src/main/kotlin/g0201_0300/s0263_ugly_number/Solution.kt)| Easy | Math | 243 | 64.10
-| 0262 |[Trips and Users](src/main/kotlin/g0201_0300/s0262_trips_and_users/script.sql)| Hard | Database | 577 | 63.97
-| 0260 |[Single Number III](src/main/kotlin/g0201_0300/s0260_single_number_iii/Solution.kt)| Medium | Array, Bit_Manipulation | 222 | 100.00
-| 0258 |[Add Digits](src/main/kotlin/g0201_0300/s0258_add_digits/Solution.kt)| Easy | Math, Simulation, Number_Theory | 234 | 71.64
-| 0257 |[Binary Tree Paths](src/main/kotlin/g0201_0300/s0257_binary_tree_paths/Solution.kt)| Easy | String, Depth_First_Search, Tree, Binary_Tree, Backtracking | 320 | 72.84
-| 0242 |[Valid Anagram](src/main/kotlin/g0201_0300/s0242_valid_anagram/Solution.kt)| Easy | Top_Interview_Questions, String, Hash_Table, Sorting, Data_Structure_I_Day_6_String, Programming_Skills_I_Day_11_Containers_and_Libraries, Udemy_Strings | 251 | 87.65
-| 0241 |[Different Ways to Add Parentheses](src/main/kotlin/g0201_0300/s0241_different_ways_to_add_parentheses/Solution.kt)| Medium | String, Dynamic_Programming, Math, Recursion, Memoization | 294 | 73.47
-| 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, Data_Structure_II_Day_4_Array, Binary_Search_II_Day_8 | 460 | 66.08
-| 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, Udemy_Arrays | 1059 | 86.14
-| 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, Data_Structure_II_Day_5_Array, Udemy_Arrays | 669 | 48.96
-| 0237 |[Delete Node in a Linked List](src/main/kotlin/g0201_0300/s0237_delete_node_in_a_linked_list/Solution.kt)| Easy | Top_Interview_Questions, Linked_List | 183 | 93.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, Top_Interview_Questions, Depth_First_Search, Tree, Binary_Tree, Data_Structure_II_Day_18_Tree, Udemy_Tree_Stack_Queue | 386 | 45.21
-| 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, Data_Structure_I_Day_14_Tree, Level_1_Day_8_Binary_Search_Tree | 404 | 75.59
-| 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, Level_2_Day_3_Linked_List, Udemy_Linked_List | 641 | 79.53
-| 0233 |[Number of Digit One](src/main/kotlin/g0201_0300/s0233_number_of_digit_one/Solution.kt)| Hard | Dynamic_Programming, Math, Recursion | 129 | 100.00
-| 0232 |[Implement Queue using Stacks](src/main/kotlin/g0201_0300/s0232_implement_queue_using_stacks/MyQueue.kt)| Easy | Stack, Design, Queue, Data_Structure_I_Day_9_Stack_Queue, Programming_Skills_I_Day_11_Containers_and_Libraries, Level_2_Day_16_Design | 258 | 70.86
-| 0231 |[Power of Two](src/main/kotlin/g0201_0300/s0231_power_of_two/Solution.kt)| Easy | Math, Bit_Manipulation, Recursion, Algorithm_I_Day_13_Bit_Manipulation | 161 | 86.81
-| 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, Data_Structure_II_Day_17_Tree, Level_2_Day_9_Binary_Search_Tree | 393 | 33.33
-| 0229 |[Majority Element II](src/main/kotlin/g0201_0300/s0229_majority_element_ii/Solution.kt)| Medium | Array, Hash_Table, Sorting, Counting | 408 | 71.21
-| 0228 |[Summary Ranges](src/main/kotlin/g0201_0300/s0228_summary_ranges/Solution.kt)| Easy | Array | 169 | 91.89
-| 0227 |[Basic Calculator II](src/main/kotlin/g0201_0300/s0227_basic_calculator_ii/Solution.kt)| Medium | Top_Interview_Questions, String, Math, Stack, Level_2_Day_18_Stack | 383 | 62.50
-| 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, Data_Structure_I_Day_12_Tree, Level_2_Day_6_Tree, Udemy_Tree_Stack_Queue | 233 | 54.90
-| 0225 |[Implement Stack using Queues](src/main/kotlin/g0201_0300/s0225_implement_stack_using_queues/MyStack.kt)| Easy | Stack, Design, Queue | 248 | 73.44
-| 0224 |[Basic Calculator](src/main/kotlin/g0201_0300/s0224_basic_calculator/Solution.kt)| Hard | String, Math, Stack, Recursion | 294 | 93.33
-| 0223 |[Rectangle Area](src/main/kotlin/g0201_0300/s0223_rectangle_area/Solution.kt)| Medium | Math, Geometry | 291 | 66.67
-| 0222 |[Count Complete Tree Nodes](src/main/kotlin/g0201_0300/s0222_count_complete_tree_nodes/Solution.kt)| |||
-| 0221 |[Maximal Square](src/main/kotlin/g0201_0300/s0221_maximal_square/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Matrix, Dynamic_Programming_I_Day_16 | 614 | 44.00
-| 0220 |[Contains Duplicate III](src/main/kotlin/g0201_0300/s0220_contains_duplicate_iii/Solution.kt)| Medium | Array, Sorting, Sliding_Window, Ordered_Set, Bucket_Sort | 921 | 72.22
-| 0219 |[Contains Duplicate II](src/main/kotlin/g0201_0300/s0219_contains_duplicate_ii/Solution.kt)| Easy | Array, Hash_Table, Sliding_Window | 813 | 80.46
-| 0218 |[The Skyline Problem](src/main/kotlin/g0201_0300/s0218_the_skyline_problem/Solution.kt)| Hard | Top_Interview_Questions, Array, Heap_Priority_Queue, Ordered_Set, Divide_and_Conquer, Segment_Tree, Binary_Indexed_Tree, Line_Sweep | 365 | 93.14
-| 0217 |[Contains Duplicate](src/main/kotlin/g0201_0300/s0217_contains_duplicate/Solution.kt)| Easy | Top_Interview_Questions, Array, Hash_Table, Sorting, Data_Structure_I_Day_1_Array, Programming_Skills_I_Day_11_Containers_and_Libraries, Udemy_Arrays | 719 | 73.49
-| 0216 |[Combination Sum III](src/main/kotlin/g0201_0300/s0216_combination_sum_iii/Solution.kt)| Medium | Array, Backtracking, Udemy_Backtracking/Recursion | 175 | 90.91
-| 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, Data_Structure_II_Day_20_Heap_Priority_Queue | 839 | 34.43
-| 0214 |[Shortest Palindrome](src/main/kotlin/g0201_0300/s0214_shortest_palindrome/Solution.kt)| Hard | String, Hash_Function, String_Matching, Rolling_Hash | 278 | 100.00
-| 0213 |[House Robber II](src/main/kotlin/g0201_0300/s0213_house_robber_ii/Solution.kt)| Medium | Array, Dynamic_Programming, Algorithm_II_Day_12_Dynamic_Programming, Dynamic_Programming_I_Day_3, Udemy_Dynamic_Programming | 257 | 59.62
-| 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
-| 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
-| 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, Level_2_Day_11_Graph/BFS/DFS | 266 | 96.32
-| 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, Algorithm_II_Day_5_Sliding_Window, Binary_Search_II_Day_1 | 315 | 96.73
-| 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, Level_2_Day_16_Design, Udemy_Trie_and_Heap | 689 | 61.00
-| 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 | 416 | 40.10
-| 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, Data_Structure_I_Day_8_Linked_List, Algorithm_I_Day_10_Recursion_Backtracking, Level_1_Day_3_Linked_List, Udemy_Linked_List | 279 | 45.78
-| 0205 |[Isomorphic Strings](src/main/kotlin/g0201_0300/s0205_isomorphic_strings/Solution.kt)| Easy | String, Hash_Table, Level_1_Day_2_String | 278 | 79.96
-| 0204 |[Count Primes](src/main/kotlin/g0201_0300/s0204_count_primes/Solution.kt)| Medium | Top_Interview_Questions, Array, Math, Enumeration, Number_Theory | 360 | 96.61
-| 0203 |[Remove Linked List Elements](src/main/kotlin/g0201_0300/s0203_remove_linked_list_elements/Solution.kt)| Easy | Linked_List, Recursion, Data_Structure_I_Day_7_Linked_List | 233 | 91.22
-| 0202 |[Happy Number](src/main/kotlin/g0201_0300/s0202_happy_number/Solution.kt)| 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 | 261 | 45.08
-| 0201 |[Bitwise AND of Numbers Range](src/main/kotlin/g0201_0300/s0201_bitwise_and_of_numbers_range/Solution.kt)| Medium | Bit_Manipulation, Algorithm_II_Day_19_Bit_Manipulation | 368 | 80.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, 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 | 252 | 95.41
-| 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, Data_Structure_II_Day_16_Tree, Level_2_Day_15_Tree | 194 | 92.89
-| 0198 |[House Robber](src/main/kotlin/g0101_0200/s0198_house_robber/Solution.kt)| 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 | 156 | 92.24
-| 0197 |[Rising Temperature](src/main/kotlin/g0101_0200/s0197_rising_temperature/script.sql)| Easy | Database, SQL_I_Day_6_Union | 394 | 94.15
-| 0196 |[Delete Duplicate Emails](src/main/kotlin/g0101_0200/s0196_delete_duplicate_emails/script.sql)| Easy | Database, SQL_I_Day_2_Select_and_Order | 593 | 94.17
-| 0195 |[Tenth Line](src/main/kotlin/g0101_0200/s0195_tenth_line/script.sh)| Easy | Shell | 36 | 87.50
-| 0194 |[Transpose File](src/main/kotlin/g0101_0200/s0194_transpose_file/script.sh)| Medium | Shell | 461 | 33.47
-| 0193 |[Valid Phone Numbers](src/main/kotlin/g0101_0200/s0193_valid_phone_numbers/script.sh)| Easy | Shell | 98 | 88.64
-| 0192 |[Word Frequency](src/main/kotlin/g0101_0200/s0192_word_frequency/script.sh)| Medium | Shell | 114 | 73.60
-| 0191 |[Number of 1 Bits](src/main/kotlin/g0101_0200/s0191_number_of_1_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation, Algorithm_I_Day_13_Bit_Manipulation, Programming_Skills_I_Day_2_Operator, Udemy_Bit_Manipulation | 237 | 68.44
-| 0190 |[Reverse Bits](src/main/kotlin/g0101_0200/s0190_reverse_bits/Solution.kt)| Easy | Top_Interview_Questions, Bit_Manipulation, Divide_and_Conquer, Algorithm_I_Day_14_Bit_Manipulation, Udemy_Bit_Manipulation | 198 | 81.82
-| 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, Algorithm_I_Day_2_Two_Pointers, Udemy_Arrays | 483 | 86.95
-| 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
-| 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, Data_Structure_II_Day_9_String, Udemy_Strings | 319 | 79.03
-| 0185 |[Department Top Three Salaries](src/main/kotlin/g0101_0200/s0185_department_top_three_salaries/script.sql)| Hard | Database | 757 | 87.06
-| 0184 |[Department Highest Salary](src/main/kotlin/g0101_0200/s0184_department_highest_salary/script.sql)| Medium | Database | 637 | 76.01
-| 0183 |[Customers Who Never Order](src/main/kotlin/g0101_0200/s0183_customers_who_never_order/script.sql)| Easy | Database, SQL_I_Day_1_Select | 712 | 33.67
-| 0182 |[Duplicate Emails](src/main/kotlin/g0101_0200/s0182_duplicate_emails/script.sql)| Easy | Database, SQL_I_Day_10_Where | 396 | 68.40
-| 0181 |[Employees Earning More Than Their Managers](src/main/kotlin/g0101_0200/s0181_employees_earning_more_than_their_managers/script.sql)| Easy | Database | 351 | 94.75
-| 0180 |[Consecutive Numbers](src/main/kotlin/g0101_0200/s0180_consecutive_numbers/script.sql)| Medium | Database | 695 | 38.05
-| 0179 |[Largest Number](src/main/kotlin/g0101_0200/s0179_largest_number/Solution.kt)| Medium | Top_Interview_Questions, String, Sorting, Greedy | 380 | 43.40
-| 0178 |[Rank Scores](src/main/kotlin/g0101_0200/s0178_rank_scores/script.sql)| Medium | Database | 292 | 85.14
-| 0177 |[Nth Highest Salary](src/main/kotlin/g0101_0200/s0177_nth_highest_salary/script.sql)| Medium | Database | 338 | 86.68
-| 0176 |[Second Highest Salary](src/main/kotlin/g0101_0200/s0176_second_highest_salary/script.sql)| Medium | Database, SQL_I_Day_4_Union_and_Select | 219 | 92.54
-| 0175 |[Combine Two Tables](src/main/kotlin/g0101_0200/s0175_combine_two_tables/script.sql)| Easy | Database, SQL_I_Day_5_Union | 473 | 54.97
-| 0174 |[Dungeon Game](src/main/kotlin/g0101_0200/s0174_dungeon_game/Solution.kt)| Hard | Array, Dynamic_Programming, Matrix | 300 | 66.67
-| 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, Data_Structure_II_Day_17_Tree, Programming_Skills_II_Day_16, Level_2_Day_9_Binary_Search_Tree | 563 | 46.91
-| 0172 |[Factorial Trailing Zeroes](src/main/kotlin/g0101_0200/s0172_factorial_trailing_zeroes/Solution.kt)| Medium | Top_Interview_Questions, Math, Udemy_Integers | 220 | 67.65
-| 0171 |[Excel Sheet Column Number](src/main/kotlin/g0101_0200/s0171_excel_sheet_column_number/Solution.kt)| Easy | Top_Interview_Questions, String, Math | 310 | 30.68
-| 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, Data_Structure_II_Day_1_Array, Udemy_Famous_Algorithm | 460 | 51.25
-| 0168 |[Excel Sheet Column Title](src/main/kotlin/g0101_0200/s0168_excel_sheet_column_title/Solution.kt)| Easy | String, Math | 208 | 66.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, Algorithm_I_Day_3_Two_Pointers, Binary_Search_I_Day_7 | 403 | 68.74
-| 0166 |[Fraction to Recurring Decimal](src/main/kotlin/g0101_0200/s0166_fraction_to_recurring_decimal/Solution.kt)| Medium | Top_Interview_Questions, String, Hash_Table, Math | 147 | 90.91
-| 0165 |[Compare Version Numbers](src/main/kotlin/g0101_0200/s0165_compare_version_numbers/Solution.kt)| Medium | String, Two_Pointers | 144 | 100.00
-| 0164 |[Maximum Gap](src/main/kotlin/g0101_0200/s0164_maximum_gap/Solution.kt)| Hard | Array, Sorting, Bucket_Sort, Radix_Sort | 991 | 68.00
-| 0162 |[Find Peak Element](src/main/kotlin/g0101_0200/s0162_find_peak_element/Solution.kt)| Medium | Top_Interview_Questions, Array, Binary_Search, Algorithm_II_Day_2_Binary_Search, Binary_Search_II_Day_12 | 297 | 53.85
-| 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, Data_Structure_II_Day_11_Linked_List, Udemy_Linked_List | 262 | 83.50
-| 0155 |[Min Stack](src/main/kotlin/g0101_0200/s0155_min_stack/MinStack.kt)| Easy | 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 | 331 | 84.88
-| 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, Binary_Search_II_Day_13 | 275 | 84.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, Algorithm_II_Day_2_Binary_Search, Binary_Search_I_Day_12, Udemy_Binary_Search | 262 | 60.96
-| 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, Dynamic_Programming_I_Day_6, Level_2_Day_13_Dynamic_Programming, Udemy_Dynamic_Programming | 253 | 88.42
-| 0151 |[Reverse Words in a String](src/main/kotlin/g0101_0200/s0151_reverse_words_in_a_string/Solution.kt)| Medium | String, Two_Pointers, Udemy_Strings | 206 | 98.90
-| 0150 |[Evaluate Reverse Polish Notation](src/main/kotlin/g0101_0200/s0150_evaluate_reverse_polish_notation/Solution.kt)| Medium | Top_Interview_Questions, Array, Math, Stack, Programming_Skills_II_Day_3 | 233 | 88.82
-| 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, Algorithm_II_Day_21_Others | 307 | 83.33
-| 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, Level_2_Day_4_Linked_List | 820 | 61.70
-| 0147 |[Insertion Sort List](src/main/kotlin/g0101_0200/s0147_insertion_sort_list/Solution.kt)| Medium | Sorting, Linked_List | 385 | 52.00
-| 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, Udemy_Linked_List | 1116 | 97.93
-| 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, Data_Structure_I_Day_10_Tree, Udemy_Tree_Stack_Queue | 211 | 80.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, Data_Structure_I_Day_10_Tree, Udemy_Tree_Stack_Queue | 277 | 37.90
-| 0143 |[Reorder List](src/main/kotlin/g0101_0200/s0143_reorder_list/Solution.kt)| Medium | Two_Pointers, Stack, Linked_List, Recursion, Data_Structure_II_Day_13_Linked_List, Programming_Skills_II_Day_14 | 395 | 82.26
-| 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, Data_Structure_II_Day_10_Linked_List, Level_1_Day_4_Linked_List, Udemy_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, Data_Structure_I_Day_7_Linked_List, Udemy_Linked_List | 223 | 91.85
-| 0140 |[Word Break II](src/main/kotlin/g0101_0200/s0140_word_break_ii/Solution.kt)| Hard | Top_Interview_Questions, String, Hash_Table, Dynamic_Programming, Backtracking, Trie, Memoization | 287 | 44.19
-| 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, Algorithm_II_Day_15_Dynamic_Programming, Dynamic_Programming_I_Day_9, Udemy_Dynamic_Programming | 197 | 87.17
-| 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, Programming_Skills_II_Day_14, Udemy_Linked_List | 274 | 80.58
-| 0137 |[Single Number II](src/main/kotlin/g0101_0200/s0137_single_number_ii/Solution.kt)| Medium | Array, Bit_Manipulation | 344 | 64.29
-| 0136 |[Single Number](src/main/kotlin/g0101_0200/s0136_single_number/Solution.kt)| 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 | 344 | 83.63
-| 0135 |[Candy](src/main/kotlin/g0101_0200/s0135_candy/Solution.kt)| Hard | Array, Greedy | 466 | 58.33
-| 0134 |[Gas Station](src/main/kotlin/g0101_0200/s0134_gas_station/Solution.kt)| Medium | Top_Interview_Questions, Array, Greedy | 545 | 70.18
-| 0133 |[Clone Graph](src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt)| Medium | Hash_Table, Depth_First_Search, Breadth_First_Search, Graph, Udemy_Graph | 351 | 60.91
-| 0132 |[Palindrome Partitioning II](src/main/kotlin/g0101_0200/s0132_palindrome_partitioning_ii/Solution.kt)| Hard | String, Dynamic_Programming | 290 | 100.00
-| 0131 |[Palindrome Partitioning](src/main/kotlin/g0101_0200/s0131_palindrome_partitioning/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, String, Dynamic_Programming, Backtracking | 820 | 87.27
-| 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, Algorithm_II_Day_8_Breadth_First_Search_Depth_First_Search | 355 | 84.42
-| 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
-| 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 | 460 | 97.77
-| 0127 |[Word Ladder](src/main/kotlin/g0101_0200/s0127_word_ladder/Solution.kt)| Hard | Top_Interview_Questions, String, Hash_Table, Breadth_First_Search, Graph_Theory_I_Day_12_Breadth_First_Search | 396 | 98.68
-| 0126 |[Word Ladder II](src/main/kotlin/g0101_0200/s0126_word_ladder_ii/Solution.kt)| Hard | String, Hash_Table, Breadth_First_Search, Backtracking | 418 | 51.45
-| 0125 |[Valid Palindrome](src/main/kotlin/g0101_0200/s0125_valid_palindrome/Solution.kt)| Easy | Top_Interview_Questions, String, Two_Pointers, Udemy_Two_Pointers | 353 | 52.06
-| 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, Udemy_Tree_Stack_Queue | 331 | 74.42
-| 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
-| 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, Dynamic_Programming_I_Day_7, Udemy_Arrays | 197 | 95.10
-| 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, Data_Structure_I_Day_3_Array, Dynamic_Programming_I_Day_7, Level_1_Day_5_Greedy, Udemy_Arrays | 609 | 94.06
-| 0120 |[Triangle](src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt)| Medium | Array, Dynamic_Programming, Algorithm_I_Day_12_Dynamic_Programming, Dynamic_Programming_I_Day_13, Udemy_Dynamic_Programming | 194 | 97.87
-| 0119 |[Pascal's Triangle II](src/main/kotlin/g0101_0200/s0119_pascals_triangle_ii/Solution.kt)| Easy | Array, Dynamic_Programming, Data_Structure_II_Day_3_Array, Dynamic_Programming_I_Day_12, Udemy_Dynamic_Programming | 157 | 97.27
-| 0118 |[Pascal's Triangle](src/main/kotlin/g0101_0200/s0118_pascals_triangle/Solution.kt)| Easy | Top_Interview_Questions, Array, Dynamic_Programming, Data_Structure_I_Day_4_Array, Dynamic_Programming_I_Day_12, Udemy_Dynamic_Programming | 277 | 33.22
-| 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, Algorithm_II_Day_7_Breadth_First_Search_Depth_First_Search | 199 | 94.67
-| 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, Algorithm_I_Day_8_Breadth_First_Search_Depth_First_Search | 355 | 69.02
-| 0115 |[Distinct Subsequences](src/main/kotlin/g0101_0200/s0115_distinct_subsequences/Solution.kt)| Hard | String, Dynamic_Programming | 285 | 88.89
-| 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, Udemy_Linked_List | 191 | 93.10
-| 0113 |[Path Sum II](src/main/kotlin/g0101_0200/s0113_path_sum_ii/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, Backtracking, Data_Structure_II_Day_16_Tree | 364 | 78.67
-| 0112 |[Path Sum](src/main/kotlin/g0101_0200/s0112_path_sum/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Data_Structure_I_Day_12_Tree | 322 | 36.41
-| 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, Udemy_Tree_Stack_Queue | 525 | 90.51
-| 0110 |[Balanced Binary Tree](src/main/kotlin/g0101_0200/s0110_balanced_binary_tree/Solution.kt)| Easy | Depth_First_Search, Tree, Binary_Tree, Programming_Skills_II_Day_2, Level_2_Day_6_Tree, Udemy_Tree_Stack_Queue | 310 | 63.63
-| 0109 |[Convert Sorted List to Binary Search Tree](src/main/kotlin/g0101_0200/s0109_convert_sorted_list_to_binary_search_tree/Solution.kt)| Medium | Tree, Binary_Tree, Linked_List, Binary_Search_Tree, Divide_and_Conquer | 376 | 59.26
-| 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, Data_Structure_II_Day_15_Tree, Level_2_Day_9_Binary_Search_Tree, Udemy_Tree_Stack_Queue | 334 | 35.39
-| 0107 |[Binary Tree Level Order Traversal II](src/main/kotlin/g0101_0200/s0107_binary_tree_level_order_traversal_ii/Solution.kt)| Medium | Breadth_First_Search, Tree, Binary_Tree | 204 | 98.04
-| 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 | 358 | 61.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, Data_Structure_II_Day_15_Tree | 370 | 58.31
-| 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, Data_Structure_I_Day_11_Tree, Programming_Skills_I_Day_10_Linked_List_and_Tree, Udemy_Tree_Stack_Queue | 236 | 83.39
-| 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, Data_Structure_II_Day_15_Tree, Udemy_Tree_Stack_Queue | 316 | 34.25
-| 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, Data_Structure_I_Day_11_Tree, Level_1_Day_6_Tree, Udemy_Tree_Stack_Queue | 332 | 67.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, Data_Structure_I_Day_11_Tree, Level_2_Day_15_Tree | 190 | 91.36
-| 0100 |[Same Tree](src/main/kotlin/g0001_0100/s0100_same_tree/Solution.kt)| Easy | Depth_First_Search, Breadth_First_Search, Tree, Binary_Tree, Level_2_Day_15_Tree, Udemy_Tree_Stack_Queue | 208 | 72.24
-| 0099 |[Recover Binary Search Tree](src/main/kotlin/g0001_0100/s0099_recover_binary_search_tree/Solution.kt)| Medium | Depth_First_Search, Tree, Binary_Tree, Binary_Search_Tree | 492 | 39.39
-| 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, Data_Structure_I_Day_14_Tree, Level_1_Day_8_Binary_Search_Tree, Udemy_Tree_Stack_Queue | 330 | 41.38
-| 0097 |[Interleaving String](src/main/kotlin/g0001_0100/s0097_interleaving_string/Solution.kt)| Medium | String, Dynamic_Programming | 240 | 57.50
-| 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, Dynamic_Programming_I_Day_11 | 147 | 88.52
-| 0095 |[Unique Binary Search Trees II](src/main/kotlin/g0001_0100/s0095_unique_binary_search_trees_ii/Solution.kt)| Medium | Dynamic_Programming, Tree, Binary_Tree, Backtracking, Binary_Search_Tree | 360 | 41.38
-| 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, Data_Structure_I_Day_10_Tree, Udemy_Tree_Stack_Queue | 269 | 38.80
-| 0093 |[Restore IP Addresses](src/main/kotlin/g0001_0100/s0093_restore_ip_addresses/Solution.kt)| Medium | String, Backtracking | 304 | 73.33
-| 0092 |[Reverse Linked List II](src/main/kotlin/g0001_0100/s0092_reverse_linked_list_ii/Solution.kt)| Medium | Linked_List | 191 | 82.35
-| 0091 |[Decode Ways](src/main/kotlin/g0001_0100/s0091_decode_ways/Solution.kt)| Medium | Top_Interview_Questions, String, Dynamic_Programming, Algorithm_II_Day_15_Dynamic_Programming, Dynamic_Programming_I_Day_10 | 237 | 76.88
-| 0090 |[Subsets II](src/main/kotlin/g0001_0100/s0090_subsets_ii/Solution.kt)| Medium | Array, Bit_Manipulation, Backtracking, Algorithm_II_Day_9_Recursion_Backtracking | 366 | 58.09
-| 0089 |[Gray Code](src/main/kotlin/g0001_0100/s0089_gray_code/Solution.kt)| Medium | Math, Bit_Manipulation, Backtracking | 273 | 100.00
-| 0088 |[Merge Sorted Array](src/main/kotlin/g0001_0100/s0088_merge_sorted_array/Solution.kt)| Easy | Top_Interview_Questions, Array, Sorting, Two_Pointers, Data_Structure_I_Day_2_Array | 311 | 33.40
-| 0087 |[Scramble String](src/main/kotlin/g0001_0100/s0087_scramble_string/Solution.kt)| Hard | String, Dynamic_Programming | 366 | 85.00
-| 0086 |[Partition List](src/main/kotlin/g0001_0100/s0086_partition_list/Solution.kt)| Medium | Two_Pointers, Linked_List | 172 | 94.00
-| 0085 |[Maximal Rectangle](src/main/kotlin/g0001_0100/s0085_maximal_rectangle/Solution.kt)| Hard | Array, Dynamic_Programming, Matrix, Stack, Monotonic_Stack | 463 | 55.17
-| 0084 |[Largest Rectangle in Histogram](src/main/kotlin/g0001_0100/s0084_largest_rectangle_in_histogram/Solution.kt)| Hard | Top_100_Liked_Questions, Top_Interview_Questions, Array, Stack, Monotonic_Stack | 525 | 100.00
-| 0083 |[Remove Duplicates from Sorted List](src/main/kotlin/g0001_0100/s0083_remove_duplicates_from_sorted_list/Solution.kt)| Easy | Linked_List, Data_Structure_I_Day_8_Linked_List | 274 | 77.82
-| 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, Data_Structure_II_Day_11_Linked_List, Algorithm_II_Day_3_Two_Pointers | 241 | 91.04
-| 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, Binary_Search_II_Day_12 | 352 | 42.31
-| 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, Udemy_Arrays | 357 | 44.78
-| 0079 |[Word Search](src/main/kotlin/g0001_0100/s0079_word_search/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Matrix, Backtracking, Algorithm_II_Day_11_Recursion_Backtracking | 463 | 68.49
-| 0078 |[Subsets](src/main/kotlin/g0001_0100/s0078_subsets/Solution.kt)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Bit_Manipulation, Backtracking, Algorithm_II_Day_9_Recursion_Backtracking, Udemy_Backtracking/Recursion | 191 | 97.44
-| 0077 |[Combinations](src/main/kotlin/g0001_0100/s0077_combinations/Solution.kt)| Medium | Backtracking, Algorithm_I_Day_11_Recursion_Backtracking | 244 | 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, Level_2_Day_14_Sliding_Window/Two_Pointer | 346 | 85.20
-| 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, Data_Structure_II_Day_2_Array, Udemy_Arrays | 198 | 85.66
-| 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, 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 | 290 | 40.17
-| 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, Udemy_2D_Arrays/Matrix | 255 | 100.00
-| 0072 |[Edit Distance](src/main/kotlin/g0001_0100/s0072_edit_distance/Solution.kt)| Hard | Top_100_Liked_Questions, String, Dynamic_Programming, Algorithm_II_Day_18_Dynamic_Programming, Dynamic_Programming_I_Day_19, Udemy_Dynamic_Programming | 320 | 63.53
-| 0071 |[Simplify Path](src/main/kotlin/g0001_0100/s0071_simplify_path/Solution.kt)| Medium | String, Stack | 318 | 64.44
-| 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, Algorithm_I_Day_12_Dynamic_Programming, Dynamic_Programming_I_Day_2, Level_1_Day_10_Dynamic_Programming, Udemy_Dynamic_Programming | 127 | 97.06
-| 0069 |[Sqrt(x)](src/main/kotlin/g0001_0100/s0069_sqrtx/Solution.kt)| Easy | Top_Interview_Questions, Math, Binary_Search, Binary_Search_I_Day_4 | 153 | 95.75
-| 0068 |[Text Justification](src/main/kotlin/g0001_0100/s0068_text_justification/Solution.kt)| Hard | Array, String, Simulation | 269 | 50.00
-| 0067 |[Add Binary](src/main/kotlin/g0001_0100/s0067_add_binary/Solution.kt)| Easy | String, Math, Bit_Manipulation, Simulation, Programming_Skills_II_Day_5 | 327 | 32.67
-| 0066 |[Plus One](src/main/kotlin/g0001_0100/s0066_plus_one/Solution.kt)| Easy | Top_Interview_Questions, Array, Math, Programming_Skills_II_Day_3, Udemy_Arrays | 303 | 35.18
-| 0065 |[Valid Number](src/main/kotlin/g0001_0100/s0065_valid_number/Solution.kt)| Hard | String | 310 | 81.82
-| 0064 |[Minimum Path Sum](src/main/kotlin/g0001_0100/s0064_minimum_path_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Matrix, Dynamic_Programming_I_Day_16, Udemy_Dynamic_Programming | 222 | 95.70
-| 0063 |[Unique Paths II](src/main/kotlin/g0001_0100/s0063_unique_paths_ii/Solution.kt)| Medium | Array, Dynamic_Programming, Matrix, Dynamic_Programming_I_Day_15 | 187 | 84.62
-| 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, Algorithm_II_Day_13_Dynamic_Programming, Dynamic_Programming_I_Day_15, Level_1_Day_11_Dynamic_Programming | 209 | 49.18
-| 0061 |[Rotate List](src/main/kotlin/g0001_0100/s0061_rotate_list/Solution.kt)| Medium | Two_Pointers, Linked_List, Programming_Skills_II_Day_16, Udemy_Linked_List | 193 | 92.16
-| 0060 |[Permutation Sequence](src/main/kotlin/g0001_0100/s0060_permutation_sequence/Solution.kt)| Hard | Math, Recursion | 146 | 100.00
-| 0059 |[Spiral Matrix II](src/main/kotlin/g0001_0100/s0059_spiral_matrix_ii/Solution.kt)| Medium | Array, Matrix, Simulation, Data_Structure_II_Day_3_Array | 153 | 100.00
-| 0058 |[Length of Last Word](src/main/kotlin/g0001_0100/s0058_length_of_last_word/Solution.kt)| Easy | String, Programming_Skills_II_Day_6, Udemy_Arrays | 243 | 63.33
-| 0057 |[Insert Interval](src/main/kotlin/g0001_0100/s0057_insert_interval/Solution.kt)| Medium | Array, Level_2_Day_17_Interval | 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, Data_Structure_II_Day_2_Array, Level_2_Day_17_Interval, Udemy_2D_Arrays/Matrix | 320 | 94.22
-| 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, Algorithm_II_Day_12_Dynamic_Programming, Dynamic_Programming_I_Day_4, Udemy_Arrays | 670 | 66.67
-| 0054 |[Spiral Matrix](src/main/kotlin/g0001_0100/s0054_spiral_matrix/Solution.kt)| Medium | Top_Interview_Questions, Array, Matrix, Simulation, Programming_Skills_II_Day_8, Level_2_Day_1_Implementation/Simulation, Udemy_2D_Arrays/Matrix | 224 | 62.50
-| 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, Data_Structure_I_Day_1_Array, Dynamic_Programming_I_Day_5, Udemy_Famous_Algorithm | 662 | 82.48
-| 0052 |[N-Queens II](src/main/kotlin/g0001_0100/s0052_n_queens_ii/Solution.kt)| Hard | Backtracking | 231 | 80.00
-| 0051 |[N-Queens](src/main/kotlin/g0001_0100/s0051_n_queens/Solution.kt)| Hard | Top_100_Liked_Questions, Array, Backtracking | 243 | 95.10
-| 0050 |[Pow(x, n)](src/main/kotlin/g0001_0100/s0050_powx_n/Solution.kt)| Medium | Top_Interview_Questions, Math, Recursion, Udemy_Integers | 264 | 52.98
-| 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, Data_Structure_II_Day_8_String, Programming_Skills_II_Day_11, Udemy_Strings | 506 | 86.55
-| 0048 |[Rotate Image](src/main/kotlin/g0001_0100/s0048_rotate_image/Solution.kt)| 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 | 287 | 46.50
-| 0047 |[Permutations II](src/main/kotlin/g0001_0100/s0047_permutations_ii/Solution.kt)| Medium | Array, Backtracking, Algorithm_II_Day_10_Recursion_Backtracking | 406 | 76.36
-| 0046 |[Permutations](src/main/kotlin/g0001_0100/s0046_permutations/Solution.kt)| 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 | 186 | 100.00
-| 0045 |[Jump Game II](src/main/kotlin/g0001_0100/s0045_jump_game_ii/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Dynamic_Programming, Greedy, Algorithm_II_Day_13_Dynamic_Programming, Dynamic_Programming_I_Day_4 | 227 | 98.14
-| 0044 |[Wildcard Matching](src/main/kotlin/g0001_0100/s0044_wildcard_matching/Solution.kt)| Hard | Top_Interview_Questions, String, Dynamic_Programming, Greedy, Recursion, Udemy_Dynamic_Programming | 401 | 86.11
-| 0043 |[Multiply Strings](src/main/kotlin/g0001_0100/s0043_multiply_strings/Solution.kt)| Medium | String, Math, Simulation, Data_Structure_II_Day_8_String, Programming_Skills_II_Day_4, Level_2_Day_2_String | 390 | 56.25
-| 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, Dynamic_Programming_I_Day_9, Udemy_Two_Pointers | 196 | 100.00
-| 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, Udemy_Arrays | 345 | 100.00
-| 0040 |[Combination Sum II](src/main/kotlin/g0001_0100/s0040_combination_sum_ii/Solution.kt)| Medium | Array, Backtracking, Algorithm_II_Day_10_Recursion_Backtracking | 348 | 80.92
-| 0039 |[Combination Sum](src/main/kotlin/g0001_0100/s0039_combination_sum/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Backtracking, Algorithm_II_Day_10_Recursion_Backtracking, Level_2_Day_20_Brute_Force/Backtracking, Udemy_Backtracking/Recursion | 317 | 86.85
-| 0038 |[Count and Say](src/main/kotlin/g0001_0100/s0038_count_and_say/Solution.kt)| Medium | Top_Interview_Questions, String | 317 | 41.11
-| 0037 |[Sudoku Solver](src/main/kotlin/g0001_0100/s0037_sudoku_solver/Solution.kt)| Hard | Array, Matrix, Backtracking | 294 | 79.69
-| 0036 |[Valid Sudoku](src/main/kotlin/g0001_0100/s0036_valid_sudoku/Solution.kt)| Medium | Top_Interview_Questions, Array, Hash_Table, Matrix, Data_Structure_I_Day_5_Array | 346 | 65.03
-| 0035 |[Search Insert Position](src/main/kotlin/g0001_0100/s0035_search_insert_position/Solution.kt)| Easy | Top_100_Liked_Questions, Array, Binary_Search, Algorithm_I_Day_1_Binary_Search, Binary_Search_I_Day_2 | 267 | 50.32
-| 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, Algorithm_II_Day_1_Binary_Search, Binary_Search_I_Day_5 | 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, Algorithm_II_Day_1_Binary_Search, Binary_Search_I_Day_11, Level_2_Day_8_Binary_Search, Udemy_Binary_Search | 184 | 86.08
-| 0032 |[Longest Valid Parentheses](src/main/kotlin/g0001_0100/s0032_longest_valid_parentheses/Solution.kt)| Hard | Top_100_Liked_Questions, String, Dynamic_Programming, Stack | 215 | 95.71
-| 0031 |[Next Permutation](src/main/kotlin/g0001_0100/s0031_next_permutation/Solution.kt)| Medium | Top_100_Liked_Questions, Array, Two_Pointers | 211 | 94.23
-| 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 | 441 | 85.84
-| 0029 |[Divide Two Integers](src/main/kotlin/g0001_0100/s0029_divide_two_integers/Solution.kt)| Medium | Top_Interview_Questions, Math, Bit_Manipulation, Udemy_Bit_Manipulation | 281 | 31.67
-| 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, Programming_Skills_II_Day_1 | 257 | 32.35
-| 0027 |[Remove Element](src/main/kotlin/g0001_0100/s0027_remove_element/Solution.kt)| Easy | Array, Two_Pointers | 293 | 32.19
-| 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, Udemy_Two_Pointers | 361 | 77.19
-| 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, Data_Structure_II_Day_13_Linked_List, Udemy_Linked_List | 194 | 87.72
-| 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, Data_Structure_II_Day_12_Linked_List, Udemy_Linked_List | 149 | 99.39
-| 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 | 323 | 75.14
-| 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, Algorithm_II_Day_11_Recursion_Backtracking, Udemy_Backtracking/Recursion | 210 | 78.51
-| 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, Data_Structure_I_Day_7_Linked_List, Algorithm_I_Day_10_Recursion_Backtracking, Level_1_Day_3_Linked_List, Udemy_Linked_List | 176 | 96.25
-| 0020 |[Valid Parentheses](src/main/kotlin/g0001_0100/s0020_valid_parentheses/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, String, Stack, Data_Structure_I_Day_9_Stack_Queue, Udemy_Strings | 226 | 72.53
-| 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, Algorithm_I_Day_5_Two_Pointers, Level_2_Day_3_Linked_List | 180 | 91.58
-| 0018 |[4Sum](src/main/kotlin/g0001_0100/s0018_4sum/Solution.kt)| Medium | Array, Sorting, Two_Pointers | 221 | 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, Algorithm_II_Day_11_Recursion_Backtracking, Udemy_Backtracking/Recursion | 262 | 73.59
-| 0016 |[3Sum Closest](src/main/kotlin/g0001_0100/s0016_3sum_closest/Solution.kt)| Medium | Array, Sorting, Two_Pointers, Level_2_Day_14_Sliding_Window/Two_Pointer | 413 | 95.05
-| 0015 |[3Sum](src/main/kotlin/g0001_0100/s0015_3sum/Solution.kt)| 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 | 761 | 90.55
-| 0014 |[Longest Common Prefix](src/main/kotlin/g0001_0100/s0014_longest_common_prefix/Solution.kt)| Easy | Top_Interview_Questions, String, Level_2_Day_2_String, Udemy_Strings | 209 | 88.86
-| 0013 |[Roman to Integer](src/main/kotlin/g0001_0100/s0013_roman_to_integer/Solution.kt)| Easy | Top_Interview_Questions, String, Hash_Table, Math | 358 | 75.16
-| 0012 |[Integer to Roman](src/main/kotlin/g0001_0100/s0012_integer_to_roman/Solution.kt)| Medium | String, Hash_Table, Math | 223 | 93.87
-| 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, Algorithm_II_Day_4_Two_Pointers | 474 | 89.18
-| 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, Udemy_Dynamic_Programming | 292 | 58.58
-| 0009 |[Palindrome Number](src/main/kotlin/g0001_0100/s0009_palindrome_number/Solution.kt)| Easy | Math, Udemy_Integers | 238 | 96.24
-| 0008 |[String to Integer (atoi)](src/main/kotlin/g0001_0100/s0008_string_to_integer_atoi/Solution.kt)| Medium | Top_Interview_Questions, String | 196 | 96.46
-| 0007 |[Reverse Integer](src/main/kotlin/g0001_0100/s0007_reverse_integer/Solution.kt)| Medium | Top_Interview_Questions, Math, Udemy_Integers | 245 | 60.32
-| 0006 |[Zigzag Conversion](src/main/kotlin/g0001_0100/s0006_zigzag_conversion/Solution.kt)| Medium | String | 366 | 80.62
-| 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, Data_Structure_II_Day_9_String, Algorithm_II_Day_14_Dynamic_Programming, Dynamic_Programming_I_Day_17, Udemy_Strings | 323 | 75.48
-| 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 | 355 | 83.48
-| 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, Algorithm_I_Day_6_Sliding_Window, Level_2_Day_14_Sliding_Window/Two_Pointer, Udemy_Strings | 258 | 91.09
-| 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, Data_Structure_II_Day_10_Linked_List, Programming_Skills_II_Day_15 | 417 | 50.44
-| 0001 |[Two Sum](src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt)| Easy | Top_100_Liked_Questions, Top_Interview_Questions, Array, Hash_Table, Data_Structure_I_Day_2_Array, Level_1_Day_13_Hashmap, Udemy_Arrays | 234 | 92.75
-
## Contributing
Your ideas/fixes/algorithms are more than welcome!
diff --git a/build.gradle.kts b/build.gradle.kts
index ae731df9b..b596c4afb 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,8 +1,8 @@
plugins {
- kotlin("jvm") version "1.8.10"
+ kotlin("jvm") version "2.1.21"
jacoco
- id("org.sonarqube")version "3.5.0.2730"
- id("com.diffplug.spotless") version "6.12.0"
+ id("org.sonarqube") version "6.2.0.5505"
+ id("com.diffplug.spotless") version "7.0.4"
`maven-publish`
}
@@ -14,11 +14,11 @@ repositories {
}
dependencies {
- implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10")
- testImplementation("org.junit.jupiter:junit-jupiter-api:[5.9.2,)")
- testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:[5.9.2,)")
- 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.3,)")
+ 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.3,)")
}
tasks.test {
@@ -27,13 +27,15 @@ tasks.test {
}
group = "com.github.javadev"
-version = "1.10-SNAPSHOT"
+version = "1.39-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.properties b/gradle.properties
index d0ccec976..732fad510 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,2 +1,2 @@
sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
-org.gradle.jvmargs=-Xms256m -Xmx1024m
+org.gradle.jvmargs=-Xms512m -Xmx2048m
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 249e5832f..8bdaf60c7 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 070cb702f..2a84e188b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index a69d9cb6c..ef07e0162 100644
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright Š 2015-2021 the original authors.
+# Copyright Š 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -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/master/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/.
@@ -80,13 +82,11 @@ do
esac
done
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-APP_NAME="Gradle"
+# This is normally unused
+# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
-
-# 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,22 +133,29 @@ 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.
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=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -193,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 f127cfd49..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 ##########################################################################
@@ -26,6 +28,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -42,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
@@ -56,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 cfe22549c..34662278e 100644
--- a/pom-central.xml
+++ b/pom-central.xml
@@ -4,9 +4,9 @@
com.github.javadev
leetcode-in-kotlin
jar
- 1.10
+ 1.39
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.10
+ 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-M5
+ 3.2.5
org.junit.jupiter
junit-jupiter-engine
- [5.9.2,)
+ [5.13.3,)
@@ -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.6.0
+ 2.0.0
prepare-package
@@ -120,11 +120,14 @@
+
+ 17
+
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.2.7
sign-artifacts
@@ -135,30 +138,72 @@
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ 3.1.0
+
+
+ generate-checksums
+ verify
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
org.jetbrains.kotlin
- kotlin-stdlib-jdk8
+ kotlin-stdlib
${kotlin.version}
org.junit.jupiter
junit-jupiter-api
- [5.9.2,)
+ [5.13.3,)
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ [5.13.3,)
+ test
+
+
+ org.junit.platform
+ junit-platform-launcher
+ [1.13.3,)
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 0825af408..14290c5f1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,9 +4,9 @@
com.github.javadev
leetcode-in-kotlin
jar
- 1.10-SNAPSHOT
+ 1.39-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.10
+ 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-M5
+ 3.5.3
org.junit.jupiter
junit-jupiter-engine
- [5.9.2,)
+ [5.13.3,)
@@ -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.6.0
+ 2.0.0
prepare-package
@@ -116,7 +116,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.2.8
sign-artifacts
@@ -134,25 +134,37 @@
org.jetbrains.kotlin
- kotlin-stdlib-jdk8
+ kotlin-stdlib
${kotlin.version}
org.junit.jupiter
junit-jupiter-api
- [5.9.2,)
+ [5.13.3,)
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ [5.13.3,)
+ test
+
+
+ org.junit.platform
+ junit-platform-launcher
+ [1.13.3,)
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/NestedInteger.kt b/src/main/kotlin/com_github_leetcode/NestedInteger.kt
index ef78488b4..d0a512a2d 100644
--- a/src/main/kotlin/com_github_leetcode/NestedInteger.kt
+++ b/src/main/kotlin/com_github_leetcode/NestedInteger.kt
@@ -1,5 +1,6 @@
īģŋpackage com_github_leetcode
+@Suppress("kotlin:S6512")
class NestedInteger {
private var list: MutableList? = null
private var integer: Int? = null
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/com_github_leetcode/neighbors/Node.kt b/src/main/kotlin/com_github_leetcode/neighbors/Node.kt
deleted file mode 100644
index 75da4bdcb..000000000
--- a/src/main/kotlin/com_github_leetcode/neighbors/Node.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package com_github_leetcode.neighbors
-
-import java.util.StringJoiner
-
-class Node(var `val`: Int) {
- constructor(i: Int, asList: List) : this(i) {
- this.neighbors = ArrayList(asList)
- }
-
- var neighbors: ArrayList = ArrayList()
-
- override fun toString(): String {
- val result = StringJoiner(",", "[", "]")
- for (node in neighbors) {
- if (node!!.neighbors.isEmpty()) {
- result.add(node.`val`.toString())
- } else {
- val result2 = StringJoiner(",", "[", "]")
- for (nodeItem in node.neighbors) {
- result2.add(nodeItem!!.`val`.toString())
- }
- result.add(result2.toString())
- }
- }
- return result.toString()
- }
-}
diff --git a/src/main/kotlin/com_github_leetcode/random/Node.kt b/src/main/kotlin/com_github_leetcode/random/Node.kt
index 4e4d9b14e..2902b4172 100644
--- a/src/main/kotlin/com_github_leetcode/random/Node.kt
+++ b/src/main/kotlin/com_github_leetcode/random/Node.kt
@@ -1,54 +1,47 @@
package com_github_leetcode.random
-import java.util.StringJoiner
-
class Node {
var `val`: Int
var next: Node? = null
var random: Node? = null
- constructor() {
- `val` = 0
- }
-
constructor(`val`: Int) {
this.`val` = `val`
}
- constructor(`val`: Int, next: Node?, random: Node?) {
- this.`val` = `val`
- this.next = next
- this.random = random
- }
-
override fun toString(): String {
- val result = StringJoiner(",", "[", "]")
- val result2 = StringJoiner(",", "[", "]")
- result2.add(`val`.toString())
+ val result = StringBuilder()
+ result.append("[")
+ result.append("[")
+ result.append(`val`)
+ result.append(",")
if (random == null) {
- result2.add("null")
+ result.append("null")
} else {
- result2.add(random!!.`val`.toString())
+ result.append(random!!.`val`)
}
- result.add(result2.toString())
+ result.append("]")
var curr = next
while (curr != null) {
- val result3 = StringJoiner(",", "[", "]")
- result3.add(curr.`val`.toString())
+ result.append(",")
+ result.append("[")
+ result.append(curr.`val`)
+ result.append(",")
if (curr.random == null) {
- result3.add("null")
+ result.append("null")
} else {
var randomIndex = 0
- var curr2: Node? = this
- while (curr2!!.next != null && curr2 !== curr.random) {
- randomIndex += 1
- curr2 = curr2.next
+ var indexFinder: Node? = this
+ while (indexFinder!!.next != null && indexFinder !== curr.random) {
+ randomIndex++
+ indexFinder = indexFinder.next
}
- result3.add(randomIndex.toString())
+ result.append(randomIndex)
}
- result.add(result3.toString())
+ result.append("]")
curr = curr.next
}
+ result.append("]")
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 ce74026cd..3df093092 100644
--- a/src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt
+++ b/src/main/kotlin/g0001_0100/s0001_two_sum/Solution.kt
@@ -1,16 +1,17 @@
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
+// #2025_07_11_Time_2_ms_(98.77%)_Space_48.00_MB_(52.59%)
class Solution {
fun twoSum(numbers: IntArray, target: Int): IntArray {
- val indexMap: MutableMap = HashMap()
+ val indexMap = HashMap()
for (i in numbers.indices) {
val requiredNum = target - numbers[i]
if (indexMap.containsKey(requiredNum)) {
- return intArrayOf(indexMap[requiredNum]!!, i)
+ return intArrayOf(indexMap.getValue(requiredNum), i)
}
indexMap[numbers[i]] = i
}
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..4df6e6694 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 #2025_07_11_Time_2_ms_(87.63%)_Space_45.71_MB_(80.15%)
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..8f30beff0 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,30 +2,30 @@ 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
+// #2025_07_11_Time_3_ms_(99.17%)_Space_46.05_MB_(66.40%)
class Solution {
fun lengthOfLongestSubstring(s: String): Int {
- var i = 0
- var j = 0
- var longest = 0
- // 1. if string empty, return 0
- if (s.isEmpty()) {
- return 0
- }
- while (j < s.length) {
- // 2. if the char at index j already seen, update the longest if needs
- if (i != j && s.substring(i, j).indexOf(s[j]) > -1) {
- longest = Math.max(j - i, longest)
- i++
+ val lastIndices = IntArray(256) { -1 }
+ var maxLen = 0
+ var curLen = 0
+ var start = 0
+ for (i in s.indices) {
+ val cur = s[i]
+ if (lastIndices[cur.code] < start) {
+ lastIndices[cur.code] = i
+ curLen++
} else {
- // 3. j out of bound already, update longest
- if (++j == s.length) {
- longest = Math.max(s.length - i, longest)
- break
- }
+ val lastIndex = lastIndices[cur.code]
+ start = lastIndex + 1
+ curLen = i - start + 1
+ lastIndices[cur.code] = i
+ }
+ if (curLen > maxLen) {
+ maxLen = curLen
}
}
- return longest
+ return maxLen
}
}
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..e43c2e39a 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,27 +1,40 @@
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%)
+// #Top_Interview_150_Binary_Search #Big_O_Time_O(log(min(N,M)))_Space_O(1)
+// #AI_can_be_used_to_solve_the_task #2025_07_11_Time_2_ms_(99.23%)_Space_51.04_MB_(73.69%)
-import kotlin.collections.ArrayList
+import kotlin.math.max
+import kotlin.math.min
class Solution {
fun findMedianSortedArrays(nums1: IntArray, nums2: IntArray): Double {
- val l: MutableList = ArrayList()
- val f: Double
- for (j in nums1) {
- l.add(j)
+ if (nums2.size < nums1.size) {
+ return findMedianSortedArrays(nums2, nums1)
}
- for (i in nums2) {
- l.add(i)
+ val n1 = nums1.size
+ val n2 = nums2.size
+ var low = 0
+ var high = n1
+ while (low <= high) {
+ val cut1 = (low + high) / 2
+ val cut2 = ((n1 + n2 + 1) / 2) - cut1
+ val l1 = if (cut1 == 0) Int.MIN_VALUE else nums1[cut1 - 1]
+ val l2 = if (cut2 == 0) Int.MIN_VALUE else nums2[cut2 - 1]
+ val r1 = if (cut1 == n1) Int.MAX_VALUE else nums1[cut1]
+ val r2 = if (cut2 == n2) Int.MAX_VALUE else nums2[cut2]
+ if (l1 <= r2 && l2 <= r1) {
+ return if ((n1 + n2) % 2 == 0) {
+ (max(l1, l2).toDouble() + min(r1, r2).toDouble()) / 2.0
+ } else {
+ max(l1, l2).toDouble()
+ }
+ } else if (l1 > r2) {
+ high = cut1 - 1
+ } else {
+ low = cut1 + 1
+ }
}
- l.sort()
- val k = l.size
- f = if (k % 2 == 0) {
- (l[k / 2 - 1] + l[k / 2]).toDouble() / 2
- } else {
- l[(k + 1) / 2 - 1].toDouble()
- }
- return f
+ return 0.0
}
}
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..12f3703b3 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) #2025_07_11_Time_8_ms_(96.61%)_Space_43.12_MB_(69.70%)
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..d60d68046 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 #Big_O_Time_O(n)_Space_O(n)
+// #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..a9e5a7da3 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%)
+// #Medium #Top_Interview_Questions #Math #Udemy_Integers #Big_O_Time_O(log10(x))_Space_O(1)
+// #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..0aa849bce 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,11 @@
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 #Big_O_Time_O(n)_Space_O(n)
+// #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..f77297ce6 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 #Big_O_Time_O(log10(x))_Space_O(1)
+// #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..47fb006b0 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 #Big_O_Time_O(1)_Space_O(1)
+// #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..9f9a6a634 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_Interview_Questions #String #Hash_Table #Math #Top_Interview_150_Array/String
+// #Big_O_Time_O(n)_Space_O(1) #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 d25709d74..3d20c338e 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%)
+// #Top_Interview_150_Array/String #Big_O_Time_O(n*m)_Space_O(m)
+// #2023_07_03_Time_154_ms_(89.70%)_Space_34.6_MB_(95.06%)
class Solution {
fun longestCommonPrefix(strs: Array): String {
@@ -14,7 +15,7 @@ class Solution {
var temp = strs[0]
var i = 1
var cur: String
- while (temp.length > 0 && i < strs.size) {
+ while (temp.isNotEmpty() && i < strs.size) {
if (temp.length > strs[i].length) {
temp = temp.substring(0, strs[i].length)
}
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 716a9d3fd..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.isEmpty() && stack.peek() == '(') {
- stack.pop()
- } else if (c == '}' && !stack.isEmpty() && stack.peek() == '{') {
- stack.pop()
- } else if (c == ']' && !stack.isEmpty() && 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 7917c03b7..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,9 +13,9 @@ class Solution {
ch.sort()
val temp = String(ch)
hm.computeIfAbsent(
- temp
+ temp,
) { _: String? -> ArrayList() }
- hm[temp]!!.add(s)
+ hm.getValue(temp).add(s)
}
return ArrayList>(hm.values)
}
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 6e4629730..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,9 +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%)
-
-import java.util.Arrays
+// #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> {
@@ -39,7 +37,7 @@ class Solution {
val sol: MutableList = ArrayList()
for (r in 0 until n) {
val queenRow = CharArray(n)
- Arrays.fill(queenRow, '.')
+ queenRow.fill('.')
queenRow[pos[r]] = 'Q'
sol.add(String(queenRow))
}
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 fa508878b..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,8 +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%)
-
-import java.util.Arrays
+// #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 {
@@ -17,7 +16,7 @@ class Solution {
}
val res = Array(l + n - r) { IntArray(2) }
for (i in 0 until l) {
- res[i] = Arrays.copyOf(intervals[i], intervals[i].size)
+ res[i] = intervals[i].copyOf(intervals[i].size)
}
res[l][0] = Math.min(newInterval[0], if (l == n) newInterval[0] else intervals[l][0])
res[l][1] = Math.max(newInterval[1], if (r == -1) newInterval[1] else intervals[r][1])
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 d8554a112..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
@@ -19,7 +20,7 @@ class Solution {
}
val s = path.substring(start, end)
if (s == "..") {
- if (!stk.isEmpty()) {
+ if (stk.isNotEmpty()) {
stk.pop()
}
} else if (s != "." && s != "") {
@@ -28,7 +29,7 @@ class Solution {
start = end + 1
}
val ans = StringBuilder()
- while (!stk.isEmpty()) {
+ while (stk.isNotEmpty()) {
ans.insert(0, stk.pop())
ans.insert(0, "/")
}
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 a405ca59c..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,8 +1,8 @@
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() {
+class Solution {
fun restoreIpAddresses(s: String): List {
val results: MutableList = ArrayList()
step(s, 0, IntArray(4), 0, results)
@@ -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 7e1df55e1..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
@@ -30,9 +31,9 @@ class Solution {
queue.add(localRoot)
queue.add(null)
var level: MutableList = ArrayList()
- while (!queue.isEmpty()) {
+ while (queue.isNotEmpty()) {
localRoot = queue.remove()
- while (!queue.isEmpty() && localRoot != null) {
+ while (queue.isNotEmpty() && localRoot != null) {
level.add(localRoot.`val`)
if (localRoot.left != null) {
queue.add(localRoot.left)
@@ -44,7 +45,7 @@ class Solution {
}
result.add(level)
level = ArrayList()
- if (!queue.isEmpty()) {
+ if (queue.isNotEmpty()) {
queue.add(null)
}
}
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 781a906ef..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
@@ -29,9 +29,9 @@ class Solution {
q.add(null)
var zig = true
var level = LinkedList()
- while (!q.isEmpty()) {
+ while (q.isNotEmpty()) {
var node: TreeNode? = q.remove()
- while (!q.isEmpty() && node != null) {
+ while (q.isNotEmpty() && node != null) {
if (zig) {
level.add(node.`val`)
} else {
@@ -48,7 +48,7 @@ class Solution {
result.add(level)
zig = !zig
level = LinkedList()
- if (!q.isEmpty()) {
+ if (q.isNotEmpty()) {
q.add(null)
}
}
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 76175f56c..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:
@@ -20,8 +19,9 @@ import java.util.HashMap
class Solution {
private var j = 0
private val map: MutableMap = HashMap()
+
fun get(key: Int): Int {
- return map[key]!!
+ return map.getValue(key)
}
private fun answer(preorder: IntArray, inorder: IntArray, start: Int, end: Int): TreeNode? {
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 27dfa6f0c..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,11 +1,11 @@
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
-/**
+/*
* Example:
* var ti = TreeNode(5)
* var v = ti.`val`
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 830b74fd6..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,13 +1,12 @@
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:
* var ti = TreeNode(5)
* var v = ti.`val`
@@ -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 491339d40..56407170e 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
@@ -1,12 +1,13 @@
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%)
+// #Easy #Top_100_Liked_Questions #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 #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
-/**
+/*
* Example:
* var ti = TreeNode(5)
* var v = ti.`val`
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/s0111_minimum_depth_of_binary_tree/Solution.kt b/src/main/kotlin/g0101_0200/s0111_minimum_depth_of_binary_tree/Solution.kt
index 081a42532..d60bd8404 100644
--- a/src/main/kotlin/g0101_0200/s0111_minimum_depth_of_binary_tree/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0111_minimum_depth_of_binary_tree/Solution.kt
@@ -25,7 +25,7 @@ class Solution {
val queue: Queue = LinkedList()
queue.add(root)
var d = 0
- while (!queue.isEmpty()) {
+ while (queue.isNotEmpty()) {
val size: Int = queue.size
for (i in 0 until size) {
val current: TreeNode = queue.poll()
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 513078e4c..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
@@ -24,7 +24,7 @@ class Solution {
root.next = null
var temp: Node?
var prev: Node?
- while (!bfsQueue.isEmpty()) {
+ while (bfsQueue.isNotEmpty()) {
val size = bfsQueue.size
prev = null
for (j in 0 until size) {
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 21fc9adc1..c1cb7ea68 100644
--- a/src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0120_triangle/Solution.kt
@@ -1,11 +1,9 @@
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%)
-import java.util.Arrays
-
class Solution {
fun minimumTotal(triangle: List>): Int {
if (triangle.isEmpty()) {
@@ -13,7 +11,7 @@ class Solution {
}
val dp = Array(triangle.size) { IntArray(triangle[triangle.size - 1].size) }
for (temp in dp) {
- Arrays.fill(temp, -10001)
+ temp.fill(-10001)
}
return dfs(triangle, dp, 0, 0)
}
@@ -29,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 4f79a001f..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
@@ -25,14 +25,14 @@ class Solution {
// find endWord flag
var findEnd = false
// traverse current layer nodes
- while (!queue.isEmpty()) {
+ while (queue.isNotEmpty()) {
val word = queue.remove()
for (next in wordSet) {
// is ladder words
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 602bd855d..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 {
@@ -17,7 +17,7 @@ class Solution {
val strLen = beginWord.length
beginSet.add(beginWord)
endSet.add(endWord)
- while (!beginSet.isEmpty() && !endSet.isEmpty()) {
+ while (beginSet.isNotEmpty() && endSet.isNotEmpty()) {
if (beginSet.size > endSet.size) {
val temp = beginSet
beginSet = endSet
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 c919efef3..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
@@ -17,12 +18,12 @@ class Solution {
var lastNum = Integer.MIN_VALUE
var length = 0
var maxLength = 1
- while (!queue.isEmpty()) {
+ while (queue.isNotEmpty()) {
val num = queue.poll()
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/s0132_palindrome_partitioning_ii/Solution.kt b/src/main/kotlin/g0101_0200/s0132_palindrome_partitioning_ii/Solution.kt
index 93a4f32e3..87ff0d2e0 100644
--- a/src/main/kotlin/g0101_0200/s0132_palindrome_partitioning_ii/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0132_palindrome_partitioning_ii/Solution.kt
@@ -2,15 +2,13 @@ package g0101_0200.s0132_palindrome_partitioning_ii
// #Hard #String #Dynamic_Programming #2022_10_09_Time_290_ms_(100.00%)_Space_34.6_MB_(76.92%)
-import java.util.Arrays
-
@Suppress("NAME_SHADOWING")
class Solution {
fun minCut(s: String): Int {
val n = s.length
val t = s.toCharArray()
val dp = IntArray(n + 1)
- Arrays.fill(dp, Int.MAX_VALUE)
+ dp.fill(Int.MAX_VALUE)
dp[0] = -1
var i = 0
while (i < n) {
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..9b8210c9b 100644
--- a/src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0133_clone_graph/Solution.kt
@@ -1,9 +1,9 @@
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 #2025_08_03_Time_133_ms_(88.96%)_Space_43.11_MB_(67.94%)
-import com_github_leetcode.neighbors.Node
+import com_github_leetcode.Node
/*
* Definition for a Node.
@@ -24,11 +24,10 @@ class Solution {
}
val newNode = Node(node.`val`)
processedNodes[node] = newNode
- newNode.neighbors = ArrayList()
for (neighbor in node.neighbors) {
- val clonedNeighbor: Node? = cloneGraph(neighbor, processedNodes)
+ val clonedNeighbor = cloneGraph(neighbor, processedNodes)
if (clonedNeighbor != null) {
- newNode.neighbors.add(clonedNeighbor)
+ (newNode.neighbors as ArrayList).add(clonedNeighbor)
}
}
return newNode
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 092f4258f..30f2f2a07 100644
--- a/src/main/kotlin/g0101_0200/s0135_candy/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0135_candy/Solution.kt
@@ -1,13 +1,12 @@
package g0101_0200.s0135_candy
-// #Hard #Array #Greedy #2022_10_09_Time_466_ms_(58.33%)_Space_51.2_MB_(83.33%)
-
-import java.util.Arrays
+// #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 {
val candies = IntArray(ratings.size)
- Arrays.fill(candies, 1)
+ candies.fill(1)
for (i in 0 until ratings.size - 1) {
if (ratings[i + 1] > ratings[i]) {
candies[i + 1] = candies[i] + 1
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..34b196ff0 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) #2025_07_04_Time_123_ms_(90.70%)_Space_43.99_MB_(97.67%)
import com_github_leetcode.random.Node
@@ -18,48 +18,19 @@ import com_github_leetcode.random.Node
*/
class Solution {
fun copyRandomList(head: Node?): Node? {
- if (head == null) {
- return null
+ val hashMap: MutableMap = HashMap()
+ var cur = head
+ while (cur != null) {
+ hashMap.put(cur, Node(cur.`val`))
+ cur = cur.next
}
- // first pass to have a clone node point to the next node. ie A->B becomes A->clonedNode->B
- var curr: Node? = head
- while (curr != null) {
- val clonedNode = Node(curr.`val`)
- clonedNode.next = curr.next
- curr.next = clonedNode
- curr = clonedNode.next
+ cur = head
+ while (cur != null) {
+ val copy: Node = hashMap[cur]!!
+ copy.next = hashMap[cur.next]
+ copy.random = hashMap[cur.random]
+ cur = cur.next
}
- curr = head
- // second pass to make the cloned node's random pointer point to the orginal node's randome
- // pointer.
- // ie. A's random pointer becomes ClonedNode's random pointer
- while (curr != null) {
- if (curr.random != null) {
- curr.next?.random = curr.random!!.next
- } else {
- curr.next?.random = null
- }
- curr = curr.next?.next
- }
- curr = head
- // third pass to restore the links and return the head of the cloned nodes' list.
- var newHead: Node? = null
- while (curr != null) {
- var clonedNode: Node
- if (newHead == null) {
- clonedNode = curr.next!!
- newHead = clonedNode
- } else {
- clonedNode = curr.next!!
- }
- curr.next = clonedNode.next
- if (curr.next != null) {
- clonedNode.next = curr.next!!.next
- } else {
- clonedNode.next = null
- }
- curr = curr.next
- }
- return newHead
+ return hashMap[head]
}
}
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 b786f710f..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.isEmpty()) {
+ 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 572181807..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[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/s0166_fraction_to_recurring_decimal/Solution.kt b/src/main/kotlin/g0101_0200/s0166_fraction_to_recurring_decimal/Solution.kt
index 26b606fd2..43afb00d0 100644
--- a/src/main/kotlin/g0101_0200/s0166_fraction_to_recurring_decimal/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0166_fraction_to_recurring_decimal/Solution.kt
@@ -27,7 +27,7 @@ class Solution {
val map: MutableMap = HashMap()
while (remainder != 0L) {
if (map.containsKey(remainder)) {
- sb.insert(map[remainder]!!, "(")
+ sb.insert(map.getValue(remainder), "(")
sb.append(")")
break
}
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/s0179_largest_number/Solution.kt b/src/main/kotlin/g0101_0200/s0179_largest_number/Solution.kt
index 16f89eb79..560bd606a 100644
--- a/src/main/kotlin/g0101_0200/s0179_largest_number/Solution.kt
+++ b/src/main/kotlin/g0101_0200/s0179_largest_number/Solution.kt
@@ -1,7 +1,7 @@
package g0101_0200.s0179_largest_number
// #Medium #Top_Interview_Questions #String #Sorting #Greedy
-// #2022_10_13_Time_380_ms_(43.40%)_Space_39.9_MB_(60.38%)
+// #2023_03_02_Time_187_ms_(100.00%)_Space_36.7_MB_(76.56%)
class Solution {
fun largestNumber(nums: IntArray): String {
@@ -10,11 +10,7 @@ class Solution {
for (i in 0 until n) {
s[i] = nums[i].toString()
}
- s.sortWith { a: String?, b: String? ->
- (b + a).compareTo(
- a + b
- )
- }
+ s.sortWith { a, b -> (b + a).compareTo(a + b) }
val sb = StringBuilder()
for (str in s) {
sb.append(str)
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/s0192_word_frequency/script.sh b/src/main/kotlin/g0101_0200/s0192_word_frequency/script.sh
index 20c746b95..09c640155 100644
--- a/src/main/kotlin/g0101_0200/s0192_word_frequency/script.sh
+++ b/src/main/kotlin/g0101_0200/s0192_word_frequency/script.sh
@@ -1,3 +1,3 @@
# Read from the file words.txt and output the word frequency list to stdout.
-# #Medium #Shell #2022_10_18_Time_114_ms_(73.60%)_Space_3.8_MB_(32.09%)sed -e 's/ /\n/g' words.txt |
-sed -e '/^$/d' | sort | uniq -c | sort -r | awk '{print $2" "$1}'
+# #Medium #Shell #2023_03_02_Time_96_ms_(80.40%)_Space_3.9_MB_(41.71%)
+echo -e "$(cat words.txt)" | awk '{for(i=1;i<=NF;i++){if(arr[$i]==0){arr[$i]=1}else{arr[$i]=arr[$i]+1}}}END{for(i in arr) print i, arr[i]}' | sort -k2 -n -r
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 6b80ae84c..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 {
@@ -25,16 +25,16 @@ class WordDictionary {
fun dfs(p: TrieNode?, start: Int): Boolean {
if (p == null) return false
if (start == word.length) return p.isWord
- if (word[start] == '.') {
+ return if (word[start] == '.') {
for (i in 0..25) {
if (dfs(p.children[i], start + 1)) {
return true
}
}
- return false
+ false
} else {
val i = word[start] - 'a'
- return dfs(p.children[i], start + 1)
+ dfs(p.children[i], start + 1)
}
}
return dfs(trieTree, 0)
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 06888ea14..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 {
@@ -18,7 +18,7 @@ class Solution {
return
}
if (n == 0 && tmp.size == k) {
- a.add(tmp.map { it -> it }.toMutableList())
+ a.add(tmp.map { it }.toMutableList())
return
}
for (i in index until 10) {
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 3cff97658..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 {
@@ -19,10 +19,10 @@ class Solution {
if (d.containsKey(m)) {
return true
}
- if (d.containsKey(m - 1) && Math.abs(nums[i] - d[m - 1]!!) < w) {
+ if (d.containsKey(m - 1) && Math.abs(nums[i] - d.getValue(m - 1)) < w) {
return true
}
- if (d.containsKey(m + 1) && Math.abs(nums[i] - d[m + 1]!!) < w) {
+ if (d.containsKey(m + 1) && Math.abs(nums[i] - d.getValue(m + 1)) < w) {
return true
}
d[m] = nums[i].toLong()
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 a2968ae34..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,11 +1,22 @@
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
+/*
+ * Example:
+ * var ti = TreeNode(5)
+ * var v = ti.`val`
+ * Definition for a binary tree node.
+ * class TreeNode(var `val`: Int) {
+ * var left: TreeNode? = null
+ * var right: TreeNode? = null
+ * }
+ */
class Solution {
private var k = 0
private var count = 0
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 b0c454283..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
@@ -17,11 +18,11 @@ import com_github_leetcode.TreeNode
* }
*/
class Solution {
- fun lowestCommonAncestor(root: TreeNode?, p: TreeNode, q: TreeNode): TreeNode? {
+ fun lowestCommonAncestor(root: TreeNode?, p: TreeNode?, q: TreeNode?): TreeNode? {
if (root == null) {
return null
}
- if (root.`val` == p.`val` || root.`val` == q.`val`) {
+ if (root.`val` == p?.`val` || root.`val` == q?.`val`) {
return root
}
val left: TreeNode? = lowestCommonAncestor(root.left, p, q)
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 d9b1c2892..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
@@ -15,7 +15,7 @@ class Solution {
var i = 0
var j = 0
while (j < nums.size) {
- while (!dq.isEmpty() && dq.peekLast() < nums[j]) {
+ while (dq.isNotEmpty() && dq.peekLast() < nums[j]) {
dq.pollLast()
}
dq.addLast(nums[j])
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/s0241_different_ways_to_add_parentheses/Solution.kt b/src/main/kotlin/g0201_0300/s0241_different_ways_to_add_parentheses/Solution.kt
index 1cfcd9022..979f27352 100644
--- a/src/main/kotlin/g0201_0300/s0241_different_ways_to_add_parentheses/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0241_different_ways_to_add_parentheses/Solution.kt
@@ -10,7 +10,7 @@ class Solution {
private fun diffWayToCompute(expression: String, hashMap: HashMap>): List {
if (hashMap.containsKey(expression)) {
- return hashMap[expression]!!
+ return hashMap.getValue(expression)
}
val newList = arrayListOf()
if (!hasOperatorInBetween(expression)) {
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..8a33f594d 100644
--- a/src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt
+++ b/src/main/kotlin/g0201_0300/s0279_perfect_squares/Solution.kt
@@ -1,6 +1,6 @@
package g0201_0300.s0279_perfect_squares
-// #Medium #Top_Interview_Questions #Dynamic_Programming #Math #Breadth_First_Search
+// #Medium #Top_100_Liked_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%)
@Suppress("NAME_SHADOWING")
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 87f41e596..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
@@ -6,7 +6,7 @@ package g0201_0300.s0282_expression_add_operators
class Solution {
fun addOperators(num: String, target: Int): List {
val res: MutableList = ArrayList()
- if (num.length == 0 || java.lang.Long.valueOf(num) > Int.MAX_VALUE) {
+ if (num.isEmpty() || java.lang.Long.valueOf(num) > Int.MAX_VALUE) {
return res
}
val list = num.toCharArray()
@@ -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 bbd809a3b..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,15 +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/s0332_reconstruct_itinerary/Solution.kt b/src/main/kotlin/g0301_0400/s0332_reconstruct_itinerary/Solution.kt
index 6862c15ca..d444c8c6d 100644
--- a/src/main/kotlin/g0301_0400/s0332_reconstruct_itinerary/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0332_reconstruct_itinerary/Solution.kt
@@ -26,7 +26,7 @@ class Solution {
private fun dfs(map: Map>, src: String, ans: LinkedList) {
val temp = map[src]
- while (temp != null && !temp.isEmpty()) {
+ while (!temp.isNullOrEmpty()) {
val nbr = temp.remove()
dfs(map, nbr, ans)
}
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 f0d4e0c3d..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,13 +1,13 @@
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
+@Suppress("kotlin:S6518")
class Solution {
fun topKFrequent(nums: IntArray, k: Int): IntArray {
nums.sort()
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 5650c7a05..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,9 +11,9 @@ 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[nums2[i]]!! - 1
+ a[nums2[i]] = a.getValue(nums2[i]) - 1
}
}
return s.toIntArray()
diff --git a/src/main/kotlin/g0301_0400/s0352_data_stream_as_disjoint_intervals/SummaryRanges.kt b/src/main/kotlin/g0301_0400/s0352_data_stream_as_disjoint_intervals/SummaryRanges.kt
index 312722981..78f7d4654 100644
--- a/src/main/kotlin/g0301_0400/s0352_data_stream_as_disjoint_intervals/SummaryRanges.kt
+++ b/src/main/kotlin/g0301_0400/s0352_data_stream_as_disjoint_intervals/SummaryRanges.kt
@@ -58,7 +58,7 @@ class SummaryRanges {
}
}
-/**
+/*
* Your SummaryRanges object will be instantiated and called as such:
* var obj = SummaryRanges()
* obj.addNum(value)
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/s0355_design_twitter/Twitter.kt b/src/main/kotlin/g0301_0400/s0355_design_twitter/Twitter.kt
index 52f05091d..468c49937 100644
--- a/src/main/kotlin/g0301_0400/s0355_design_twitter/Twitter.kt
+++ b/src/main/kotlin/g0301_0400/s0355_design_twitter/Twitter.kt
@@ -30,7 +30,7 @@ class Twitter {
fun getNewsFeed(userId: Int): List {
checkNewUser(userId)
val res: MutableList = ArrayList()
- val followers = twitterData[userId]!!
+ val followers = twitterData.getValue(userId)
var t = head.next
while (t != null && res.size < 10) {
if (followers.contains(t.userId)) {
@@ -44,7 +44,7 @@ class Twitter {
fun follow(followerId: Int, followeeId: Int) {
checkNewUser(followeeId)
checkNewUser(followerId)
- twitterData[followerId]!!.add(followeeId)
+ twitterData.getValue(followerId).add(followeeId)
}
fun unfollow(followerId: Int, followeeId: Int) {
@@ -54,7 +54,7 @@ class Twitter {
return
}
checkNewUser(followerId)
- twitterData[followerId]!!.remove(followeeId)
+ twitterData.getValue(followerId).remove(followeeId)
}
fun checkNewUser(userId: Int) {
@@ -63,7 +63,7 @@ class Twitter {
}
twitterData[userId] = HashSet()
// follow yourself
- twitterData[userId]!!.add(userId)
+ twitterData.getValue(userId).add(userId)
}
}
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 9016fb8ee..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,14 +8,16 @@ 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(jug1: Int, jug2: Int, target: Int): Boolean {
- if (jug1 + jug2 < target) {
+ fun canMeasureWater(jug1Capacity: Int, jug2Capacity: Int, targetCapacity: Int): Boolean {
+ if (jug1Capacity + jug2Capacity < targetCapacity) {
return false
}
- val gcd = gcd(jug1, jug2)
- return target % gcd == 0
+ val gcd = gcd(jug1Capacity, jug2Capacity)
+ return targetCapacity % gcd == 0
}
}
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 5ae158fd4..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) {
@@ -31,7 +31,7 @@ class Solution {
}
}
var i = 1
- while (i <= k && !queue.isEmpty()) {
+ while (i <= k && queue.isNotEmpty()) {
val cur = queue.poll()
res.add(cur.al)
val next = cur.index
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/s0377_combination_sum_iv/Solution.kt b/src/main/kotlin/g0301_0400/s0377_combination_sum_iv/Solution.kt
index 45fcb2c5e..f5ef08d52 100644
--- a/src/main/kotlin/g0301_0400/s0377_combination_sum_iv/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0377_combination_sum_iv/Solution.kt
@@ -3,14 +3,12 @@ package g0301_0400.s0377_combination_sum_iv
// #Medium #Array #Dynamic_Programming #Dynamic_Programming_I_Day_21
// #2022_11_22_Time_217_ms_(72.41%)_Space_33.9_MB_(86.21%)
-import java.util.Arrays
-
class Solution {
private lateinit var storage: IntArray
fun combinationSum4(nums: IntArray, target: Int): Int {
storage = IntArray(target + 1)
- Arrays.fill(storage, -1)
+ storage.fill(-1)
return result(nums, target)
}
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 1b84fe00a..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
@@ -13,25 +13,27 @@ class RandomizedCollection() {
fun insert(x: Int): Boolean {
a2m.add(x)
val pos = a2m.size - 1
- if (x in m2a) {
+ return if (x in m2a) {
m2a[x]!!.add(pos)
- return false
+ false
} else {
m2a[x] = HashSet()
m2a[x]!!.add(pos)
- return true
+ true
}
}
/** 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/s0388_longest_absolute_file_path/Solution.kt b/src/main/kotlin/g0301_0400/s0388_longest_absolute_file_path/Solution.kt
index e83187435..8b642dbfd 100644
--- a/src/main/kotlin/g0301_0400/s0388_longest_absolute_file_path/Solution.kt
+++ b/src/main/kotlin/g0301_0400/s0388_longest_absolute_file_path/Solution.kt
@@ -45,17 +45,17 @@ class Solution {
if (nextLevel < currLevel) {
var j = 0
if (isFile) {
- while (!stack.isEmpty() && j < currLevel - nextLevel) {
+ while (stack.isNotEmpty() && j < currLevel - nextLevel) {
currDirLen -= stack.pop()
j++
}
} else {
- while (!stack.isEmpty() && j <= currLevel - nextLevel) {
+ while (stack.isNotEmpty() && j <= currLevel - nextLevel) {
currDirLen -= stack.pop()
j++
}
}
- } else if (nextLevel == currLevel && !isFile && !stack.isEmpty()) {
+ } else if (nextLevel == currLevel && !isFile && stack.isNotEmpty()) {
currDirLen -= stack.pop()
}
if (nextLevel == 0) {
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 46089229d..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,15 +1,18 @@
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")
class Solution {
private var root: MutableMap? = null
private var rate: MutableMap? = null
+
fun calcEquation(
equations: List>,
values: DoubleArray,
- queries: List>
+ queries: List>,
): DoubleArray {
root = HashMap()
rate = HashMap()
@@ -39,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/s0407_trapping_rain_water_ii/Solution.kt b/src/main/kotlin/g0401_0500/s0407_trapping_rain_water_ii/Solution.kt
index 4895a4326..cc70b9a4a 100644
--- a/src/main/kotlin/g0401_0500/s0407_trapping_rain_water_ii/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0407_trapping_rain_water_ii/Solution.kt
@@ -37,7 +37,7 @@ class Solution {
visited1[r][cols - 1] = true
}
// end build wall
- while (!walls.isEmpty()) {
+ while (walls.isNotEmpty()) {
val min = walls.poll()
visit(heightMap, min, walls)
}
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 0b443cfda..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%)
/*
@@ -12,16 +12,14 @@ package g0401_0500.s0427_construct_quad_tree
* var bottomRight: Node? = null
* }
*/
-
class Solution {
fun construct(grid: Array): Node? {
return construct(grid, 0, 0, grid.size)
}
- fun construct(grid: Array, x: Int, y: Int, len: Int): Node? {
+ private fun construct(grid: Array, x: Int, y: Int, len: Int): Node? {
val value: Int = grid[x][y]
if (len == 1) { return Node(value == 1, true) }
-
var isLeaf = true
for (i in 0 until len) {
for (p in 0 until len) {
@@ -31,7 +29,6 @@ class Solution {
}
}
if (isLeaf) { return Node(value == 1, true) }
-
return Node(true, false).apply {
val halfLength: Int = len / 2
topLeft = construct(grid, x, y, halfLength)
diff --git a/src/main/kotlin/g0401_0500/s0429_n_ary_tree_level_order_traversal/Solution.kt b/src/main/kotlin/g0401_0500/s0429_n_ary_tree_level_order_traversal/Solution.kt
index c3ed89cc1..1119085b2 100644
--- a/src/main/kotlin/g0401_0500/s0429_n_ary_tree_level_order_traversal/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0429_n_ary_tree_level_order_traversal/Solution.kt
@@ -1,9 +1,11 @@
package g0401_0500.s0429_n_ary_tree_level_order_traversal
// #Medium #Breadth_First_Search #Tree #Programming_Skills_II_Day_9
-// #2022_12_22_Time_278_ms_(75.00%)_Space_38.9_MB_(87.50%)
+// #2023_03_07_Time_248_ms_(75.86%)_Space_38.6_MB_(93.10%)
import com_github_leetcode.Node
+import java.util.LinkedList
+import java.util.Queue
/*
* Definition for a Node.
@@ -11,13 +13,26 @@ import com_github_leetcode.Node
* var neighbors: List = listOf()
* }
*/
-
class Solution {
- fun levelOrder(root: Node?) = go(listOfNotNull(root), mutableListOf())
-
- private tailrec fun go(level: List, acc: MutableList>): List> =
- if (level.isEmpty()) acc else go(
- level = level.flatMap(Node::neighbors).filterNotNull(),
- acc = acc.apply { level.map(Node::`val`).also { add(it) } }
- )
+ fun levelOrder(root: Node?): List> {
+ val result: MutableList> = ArrayList()
+ if (root == null) {
+ return result
+ }
+ val queue: Queue = LinkedList()
+ queue.offer(root)
+ while (queue.isNotEmpty()) {
+ val size: Int = queue.size
+ val level: MutableList = ArrayList()
+ for (i in 0 until size) {
+ val currentNode: Node = queue.poll()
+ level.add(currentNode.`val`)
+ for (child in currentNode.neighbors) {
+ queue.offer(child)
+ }
+ }
+ result.add(level)
+ }
+ return result
+ }
}
diff --git a/src/main/kotlin/g0401_0500/s0430_flatten_a_multilevel_doubly_linked_list/Node.kt b/src/main/kotlin/g0401_0500/s0430_flatten_a_multilevel_doubly_linked_list/Node.kt
index e7a6b9d81..f795e180d 100644
--- a/src/main/kotlin/g0401_0500/s0430_flatten_a_multilevel_doubly_linked_list/Node.kt
+++ b/src/main/kotlin/g0401_0500/s0430_flatten_a_multilevel_doubly_linked_list/Node.kt
@@ -1,12 +1,6 @@
package g0401_0500.s0430_flatten_a_multilevel_doubly_linked_list
class Node(var `val`: Int) {
- constructor(i: Int, node: Node?, node1: Node?, nothing: Node?) : this(i) {
- this.prev = node
- this.next = node1
- this.child = nothing
- }
-
var prev: Node? = null
var next: Node? = null
var child: Node? = null
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 5c8abb7bf..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
@@ -34,7 +34,7 @@ class Solution {
val queue: Queue = LinkedList()
queue.offer(start)
var step = 0
- while (!queue.isEmpty()) {
+ while (queue.isNotEmpty()) {
var curSize = queue.size
while (curSize-- > 0) {
val cur = queue.poll()
diff --git a/src/main/kotlin/g0401_0500/s0434_number_of_segments_in_a_string/Solution.kt b/src/main/kotlin/g0401_0500/s0434_number_of_segments_in_a_string/Solution.kt
index 912a19a92..d63134223 100644
--- a/src/main/kotlin/g0401_0500/s0434_number_of_segments_in_a_string/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0434_number_of_segments_in_a_string/Solution.kt
@@ -7,13 +7,13 @@ class Solution {
fun countSegments(s: String): Int {
var s = s
s = s.trim { it <= ' ' }
- if (s.length == 0) {
+ if (s.isEmpty()) {
return 0
}
val splitted = s.split(" ".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
var result = 0
for (value in splitted) {
- if (value.length > 0) {
+ if (value.isNotEmpty()) {
result++
}
}
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 4c2f48e99..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,15 +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%)
-
-import java.util.Arrays
+// #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 {
- Arrays.sort(intervals) { a: IntArray, b: IntArray ->
+ 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..fdf6616ac 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,6 +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
+// #Medium #Top_100_Liked_Questions #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/s0442_find_all_duplicates_in_an_array/Solution.kt b/src/main/kotlin/g0401_0500/s0442_find_all_duplicates_in_an_array/Solution.kt
index cf0cf8d2a..8eab9b0f9 100644
--- a/src/main/kotlin/g0401_0500/s0442_find_all_duplicates_in_an_array/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0442_find_all_duplicates_in_an_array/Solution.kt
@@ -6,13 +6,11 @@ class Solution {
fun findDuplicates(nums: IntArray): List {
val setToCheck: MutableSet = mutableSetOf()
val duplicates: MutableList = mutableListOf()
-
nums.forEach { element ->
if (!setToCheck.add(element)) {
duplicates.add(element)
}
}
-
return duplicates
}
}
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 a2a243e0d..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,8 +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%)
-
-import java.util.Arrays
+// #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 {
/*
@@ -17,13 +16,8 @@ class Solution {
* {0, 6}, {7, 8}, {0, 9}, then we shoot at 6, then at 8, this gives us the result of bursting all balloons.
*/
fun findMinArrowShots(points: Array): Int {
- Arrays.sort(
- points
- ) { a: IntArray, b: IntArray ->
- Integer.compare(
- a[1],
- b[1]
- )
+ points.sortWith { a: IntArray, b: IntArray ->
+ a[1].compareTo(b[1])
}
var minArrows = 1
var end = points[0][1].toLong()
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/s0456_132_pattern/Solution.kt b/src/main/kotlin/g0401_0500/s0456_132_pattern/Solution.kt
index 677bd935b..f4a79b729 100644
--- a/src/main/kotlin/g0401_0500/s0456_132_pattern/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0456_132_pattern/Solution.kt
@@ -20,7 +20,7 @@ class Solution {
if (nums[i] < s3) {
return true
} else {
- while (!stack.isEmpty() && nums[i] > stack.peek()) {
+ while (stack.isNotEmpty() && nums[i] > stack.peek()) {
s3 = Math.max(s3, stack.pop())
}
}
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/s0468_validate_ip_address/Solution.kt b/src/main/kotlin/g0401_0500/s0468_validate_ip_address/Solution.kt
index 49f498eaf..11d2273e8 100644
--- a/src/main/kotlin/g0401_0500/s0468_validate_ip_address/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0468_validate_ip_address/Solution.kt
@@ -4,7 +4,7 @@ package g0401_0500.s0468_validate_ip_address
class Solution {
fun validIPAddress(ip: String): String {
- if (ip.length == 0) {
+ if (ip.isEmpty()) {
return NEITHER
}
val arr = ip.split("\\.".toRegex()).toTypedArray()
diff --git a/src/main/kotlin/g0401_0500/s0472_concatenated_words/Solution.kt b/src/main/kotlin/g0401_0500/s0472_concatenated_words/Solution.kt
index 1a8edb8cb..30b7d08fd 100644
--- a/src/main/kotlin/g0401_0500/s0472_concatenated_words/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0472_concatenated_words/Solution.kt
@@ -3,20 +3,13 @@ package g0401_0500.s0472_concatenated_words
// #Hard #Array #String #Dynamic_Programming #Depth_First_Search #Trie
// #2022_12_29_Time_484_ms_(100.00%)_Space_48_MB_(100.00%)
-import java.util.Arrays
-
class Solution {
private val ans: MutableList = ArrayList()
private var root: Trie? = null
fun findAllConcatenatedWordsInADict(words: Array): List {
root = Trie()
- Arrays.sort(
- words
- ) { a: String, b: String ->
- Integer.compare(
- a.length,
- b.length
- )
+ words.sortWith { a: String, b: String ->
+ a.length.compareTo(b.length)
}
for (word in words) {
var ptr = root
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 01a828617..9c30d5d7a 100644
--- a/src/main/kotlin/g0401_0500/s0488_zuma_game/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0488_zuma_game/Solution.kt
@@ -13,10 +13,10 @@ class Solution {
}
private fun findMinStepDp(board: String, hand: String, dp: MutableMap?>): Int {
- if (board.length == 0) {
+ if (board.isEmpty()) {
return 0
}
- if (hand.length == 0) {
+ if (hand.isEmpty()) {
return -1
}
if (dp[board] != null && dp[board]!![hand] != null) {
@@ -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 0baaa14e1..293cd51e4 100644
--- a/src/main/kotlin/g0401_0500/s0491_increasing_subsequences/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0491_increasing_subsequences/Solution.kt
@@ -4,8 +4,8 @@ package g0401_0500.s0491_increasing_subsequences
// #2023_01_03_Time_499_ms_(100.00%)_Space_50.1_MB_(100.00%)
class Solution {
- fun findSubsequences(nums: IntArray?): List> {
- if (nums == null || nums.size == 1) {
+ fun findSubsequences(nums: IntArray): List> {
+ if (nums.size == 1) {
return ArrayList()
}
val answer: MutableSet> = HashSet()
@@ -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/s0493_reverse_pairs/Solution.kt b/src/main/kotlin/g0401_0500/s0493_reverse_pairs/Solution.kt
index 0220b0d9e..4432dbef4 100644
--- a/src/main/kotlin/g0401_0500/s0493_reverse_pairs/Solution.kt
+++ b/src/main/kotlin/g0401_0500/s0493_reverse_pairs/Solution.kt
@@ -3,8 +3,6 @@ package g0401_0500.s0493_reverse_pairs
// #Hard #Array #Binary_Search #Ordered_Set #Divide_and_Conquer #Segment_Tree #Binary_Indexed_Tree
// #Merge_Sort #2023_01_04_Time_887_ms_(66.67%)_Space_73.9_MB_(66.67%)
-import java.util.Arrays
-
class Solution {
fun reversePairs(nums: IntArray): Int {
return mergeSort(nums, 0, nums.size - 1)
@@ -25,7 +23,7 @@ class Solution {
}
cnt += j - (mid + 1)
}
- Arrays.sort(nums, start, end + 1)
+ nums.sort(start, end + 1)
return cnt
}
}
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 6c31e21ae..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,22 +1,22 @@
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")
class Solution {
- fun findTargetSumWays(nums: IntArray, s: Int): Int {
- var s = s
+ fun findTargetSumWays(nums: IntArray, target: Int): Int {
+ var target = target
var sum = 0
- s = Math.abs(s)
+ target = Math.abs(target)
for (num in nums) {
sum += num
}
- // Invalid s, just return 0
- if (s > sum || (sum + s) % 2 != 0) {
+ // Invalid target, just return 0
+ if (target > sum || (sum + target) % 2 != 0) {
return 0
}
- val dp = Array((sum + s) / 2 + 1) { IntArray(nums.size + 1) }
+ val dp = Array((sum + target) / 2 + 1) { IntArray(nums.size + 1) }
dp[0][0] = 1
// empty knapsack must be processed specially
for (i in nums.indices) {
@@ -34,6 +34,6 @@ class Solution {
}
}
}
- return dp[(sum + s) / 2][nums.size]
+ return dp[(sum + target) / 2][nums.size]
}
}
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/s0501_find_mode_in_binary_search_tree/Solution.kt b/src/main/kotlin/g0501_0600/s0501_find_mode_in_binary_search_tree/Solution.kt
index 3dbcabce9..4c894be96 100644
--- a/src/main/kotlin/g0501_0600/s0501_find_mode_in_binary_search_tree/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0501_find_mode_in_binary_search_tree/Solution.kt
@@ -50,7 +50,6 @@ class Solution {
}
}
processInOrder()
-
return ans.toIntArray()
}
}
diff --git a/src/main/kotlin/g0501_0600/s0502_ipo/Solution.kt b/src/main/kotlin/g0501_0600/s0502_ipo/Solution.kt
index a1cd613c0..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,9 +23,8 @@ 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.isEmpty() && currentCapital >= capitalMinHeap.peek().capital) {
+ while (capitalMinHeap.isNotEmpty() && currentCapital >= capitalMinHeap.peek().capital) {
profitMaxHeap.add(capitalMinHeap.poll())
}
diff --git a/src/main/kotlin/g0501_0600/s0503_next_greater_element_ii/Solution.kt b/src/main/kotlin/g0501_0600/s0503_next_greater_element_ii/Solution.kt
index 0e93dd888..41128eb76 100644
--- a/src/main/kotlin/g0501_0600/s0503_next_greater_element_ii/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0503_next_greater_element_ii/Solution.kt
@@ -11,7 +11,7 @@ class Solution {
val result = IntArray(nums.size)
val stack: Deque = ArrayDeque()
for (i in nums.size * 2 - 1 downTo 0) {
- while (!stack.isEmpty() && nums[stack.peek()] <= nums[i % nums.size]) {
+ while (stack.isNotEmpty() && nums[stack.peek()] <= nums[i % nums.size]) {
stack.pop()
}
result[i % nums.size] = if (stack.isEmpty()) -1 else nums[stack.peek()]
diff --git a/src/main/kotlin/g0501_0600/s0508_most_frequent_subtree_sum/Solution.kt b/src/main/kotlin/g0501_0600/s0508_most_frequent_subtree_sum/Solution.kt
index 542a141e3..4a1b0a77e 100644
--- a/src/main/kotlin/g0501_0600/s0508_most_frequent_subtree_sum/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0508_most_frequent_subtree_sum/Solution.kt
@@ -28,12 +28,12 @@ class Solution {
}
private fun treeSum(node: TreeNode?): Int {
- if (node == null) {
- return 0
+ return if (node == null) {
+ 0
} else {
val sum = node.`val` + treeSum(node.left) + treeSum(node.right)
cache[sum] = cache.getOrDefault(sum, 0) + 1
- return sum
+ sum
}
}
}
diff --git a/src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt b/src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt
index 231f54651..6afd1d60d 100644
--- a/src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0509_fibonacci_number/Solution.kt
@@ -6,6 +6,7 @@ package g0501_0600.s0509_fibonacci_number
class Solution {
private val memo = IntArray(31)
+
fun fib(n: Int): Int {
if (n == 0) {
return 0
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/s0515_find_largest_value_in_each_tree_row/Solution.kt b/src/main/kotlin/g0501_0600/s0515_find_largest_value_in_each_tree_row/Solution.kt
index de1e53770..8b2dbe8f1 100644
--- a/src/main/kotlin/g0501_0600/s0515_find_largest_value_in_each_tree_row/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0515_find_largest_value_in_each_tree_row/Solution.kt
@@ -23,7 +23,7 @@ class Solution {
val queue: Queue = LinkedList()
if (root != null) {
queue.offer(root)
- while (!queue.isEmpty()) {
+ while (queue.isNotEmpty()) {
var max = Int.MIN_VALUE
val size = queue.size
for (i in 0 until size) {
diff --git a/src/main/kotlin/g0501_0600/s0520_detect_capital/Solution.kt b/src/main/kotlin/g0501_0600/s0520_detect_capital/Solution.kt
index c6065ee11..541918a3b 100644
--- a/src/main/kotlin/g0501_0600/s0520_detect_capital/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0520_detect_capital/Solution.kt
@@ -3,8 +3,8 @@ package g0501_0600.s0520_detect_capital
// #Easy #String #2023_01_13_Time_161_ms_(84.54%)_Space_33.9_MB_(92.99%)
class Solution {
- fun detectCapitalUse(word: String?): Boolean {
- if (word == null || word.length == 0) {
+ fun detectCapitalUse(word: String): Boolean {
+ if (word.isEmpty()) {
return false
}
var upper = 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/s0524_longest_word_in_dictionary_through_deleting/Solution.kt b/src/main/kotlin/g0501_0600/s0524_longest_word_in_dictionary_through_deleting/Solution.kt
index 31fcdba80..de1ab8fca 100644
--- a/src/main/kotlin/g0501_0600/s0524_longest_word_in_dictionary_through_deleting/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0524_longest_word_in_dictionary_through_deleting/Solution.kt
@@ -22,7 +22,7 @@ class Solution {
var maxLen = 0
var res = ""
for (i in 0 until s.length) {
- if (!map[s[i]]!!.isEmpty()) {
+ if (map[s[i]]!!.isNotEmpty()) {
val deque = map[s[i]]!!
val size = deque.size
for (j in 0 until size) {
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 209811475..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
@@ -18,6 +18,7 @@ import com_github_leetcode.TreeNode
class Solution {
private var ans = Int.MAX_VALUE
private var prev = Int.MAX_VALUE
+
fun getMinimumDifference(root: TreeNode?): Int {
if (root == null) {
return ans
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/s0542_01_matrix/Solution.kt b/src/main/kotlin/g0501_0600/s0542_01_matrix/Solution.kt
index 3860ff0fe..45cb69882 100644
--- a/src/main/kotlin/g0501_0600/s0542_01_matrix/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0542_01_matrix/Solution.kt
@@ -5,13 +5,11 @@ package g0501_0600.s0542_01_matrix
// #Graph_Theory_I_Day_5_Matrix_Related_Problems
// #2023_01_17_Time_441_ms_(94.06%)_Space_54_MB_(78.22%)
-import java.util.Arrays
-
class Solution {
fun updateMatrix(mat: Array): Array {
val dist = Array(mat.size) { IntArray(mat[0].size) }
for (i in mat.indices) {
- Arrays.fill(dist[i], Int.MAX_VALUE - 100000)
+ dist[i].fill(Int.MAX_VALUE - 100000)
}
for (i in mat.indices) {
for (j in mat[0].indices) {
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 c41f7fa70..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,16 +1,14 @@
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%)
-import java.util.Arrays
-
class Solution {
fun findCircleNum(arr: Array): Int {
val parent = IntArray(arr.size)
- Arrays.fill(parent, -1)
+ parent.fill(-1)
var ans = 0
for (i in 0 until arr.size - 1) {
for (j in i + 1 until arr[i].size) {
diff --git a/src/main/kotlin/g0501_0600/s0550_game_play_analysis_iv/readme.md b/src/main/kotlin/g0501_0600/s0550_game_play_analysis_iv/readme.md
new file mode 100644
index 000000000..d10fe837a
--- /dev/null
+++ b/src/main/kotlin/g0501_0600/s0550_game_play_analysis_iv/readme.md
@@ -0,0 +1,52 @@
+550\. Game Play Analysis IV
+
+Medium
+
+SQL Schema
+
+Table: `Activity`
+
+ +--------------+---------+
+ | Column Name | Type |
+ +--------------+---------+
+ | player_id | int |
+ | device_id | int |
+ | event_date | date |
+ | games_played | int |
+ +--------------+---------+
+ (player_id, event_date) is the primary key of this table.
+ This table shows the activity of players of some games.
+ Each row is a record of a player who logged in and played a number of games
+ (possibly 0) before logging out on someday using some device.
+
+Write an SQL query to report the **fraction** of players that logged in again on the day after the day they first logged in, **rounded to 2 decimal places**. In other words, you need to count the number of players that logged in for at least two consecutive days starting from their first login date, then divide that number by the total number of players.
+
+The query result format is in the following example.
+
+**Example 1:**
+
+**Input:**
+
+Activity table:
+
+ +-----------+-----------+------------+--------------+
+ | player_id | device_id | event_date | games_played |
+ +-----------+-----------+------------+--------------+
+ | 1 | 2 | 2016-03-01 | 5 |
+ | 1 | 2 | 2016-03-02 | 6 |
+ | 2 | 3 | 2017-06-25 | 1 |
+ | 3 | 1 | 2016-03-02 | 0 |
+ | 3 | 4 | 2018-07-03 | 5 |
+ +-----------+-----------+------------+--------------+
+
+**Output:**
+
+ +-----------+
+ | fraction |
+ +-----------+
+ | 0.33 |
+ +-----------+
+
+**Explanation:**
+
+Only the player with id 1 logged back in after the first day he had logged in so the answer is 1/3 = 0.33
\ No newline at end of file
diff --git a/src/main/kotlin/g0501_0600/s0550_game_play_analysis_iv/script.sql b/src/main/kotlin/g0501_0600/s0550_game_play_analysis_iv/script.sql
new file mode 100644
index 000000000..9d58cf722
--- /dev/null
+++ b/src/main/kotlin/g0501_0600/s0550_game_play_analysis_iv/script.sql
@@ -0,0 +1,6 @@
+# Write your MySQL query statement below
+# #Medium #Database #2023_05_18_Time_762_ms_(97.74%)_Space_0B_(100.00%)
+SELECT ROUND(COUNT(t2.player_id)/CAST(COUNT(t1.player_id) AS DECIMAL),2) AS fraction
+FROM
+(SELECT player_id, MIN(event_date) AS first_login FROM Activity GROUP BY player_id) t1 LEFT JOIN Activity t2
+ON t1.player_id = t2.player_id AND t1.first_login = t2.event_date - 1
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/s0554_brick_wall/Solution.kt b/src/main/kotlin/g0501_0600/s0554_brick_wall/Solution.kt
index 3030e07ca..3896af5f9 100644
--- a/src/main/kotlin/g0501_0600/s0554_brick_wall/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0554_brick_wall/Solution.kt
@@ -14,8 +14,7 @@ class Solution {
}
}
var value = 0
-
- if (gapMap.size > 0) {
+ if (gapMap.isNotEmpty()) {
value = gapMap.values.max()
}
return wall.size - value
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 6c9a79836..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
@@ -11,7 +11,6 @@ package g0501_0600.s0558_logical_or_of_two_binary_grids_represented_as_quad_tree
* var bottomRight: Node? = null
* }
*/
-
class Solution {
fun intersect(quadTree1: Node?, quadTree2: Node?): Node? {
if (quadTree1!!.isLeaf) {
@@ -26,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/s0559_maximum_depth_of_n_ary_tree/Solution.kt b/src/main/kotlin/g0501_0600/s0559_maximum_depth_of_n_ary_tree/Solution.kt
index 85abc361a..55a635a29 100644
--- a/src/main/kotlin/g0501_0600/s0559_maximum_depth_of_n_ary_tree/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0559_maximum_depth_of_n_ary_tree/Solution.kt
@@ -11,7 +11,6 @@ import com_github_leetcode.Node
* var neighbors: List = listOf()
* }
*/
-
class Solution {
private var max = 0
@@ -29,7 +28,7 @@ class Solution {
}
private fun findDepth(n: Node?, d: Int) {
- if (!n!!.neighbors.isEmpty()) {
+ if (n!!.neighbors.isNotEmpty()) {
for (no in n.neighbors) {
findDepth(no, d + 1)
}
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/s0563_binary_tree_tilt/Solution.kt b/src/main/kotlin/g0501_0600/s0563_binary_tree_tilt/Solution.kt
index bf0e1c79b..433082769 100644
--- a/src/main/kotlin/g0501_0600/s0563_binary_tree_tilt/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0563_binary_tree_tilt/Solution.kt
@@ -17,6 +17,7 @@ import com_github_leetcode.TreeNode
*/
class Solution {
private var sum = 0
+
private fun sumTilt(root: TreeNode?): Int {
if (root == null) {
return 0
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/s0570_managers_with_at_least_5_direct_reports/readme.md b/src/main/kotlin/g0501_0600/s0570_managers_with_at_least_5_direct_reports/readme.md
new file mode 100644
index 000000000..f4d18b258
--- /dev/null
+++ b/src/main/kotlin/g0501_0600/s0570_managers_with_at_least_5_direct_reports/readme.md
@@ -0,0 +1,51 @@
+570\. Managers with at Least 5 Direct Reports
+
+Medium
+
+SQL Schema
+
+Table: `Employee`
+
+ +-------------+---------+
+ | Column Name | Type |
+ +-------------+---------+
+ | id | int |
+ | name | varchar |
+ | department | varchar |
+ | managerId | int |
+ +-------------+---------+
+ id is the primary key column for this table.
+ Each row of this table indicates the name of an employee, their department, and the id of their manager.
+ If managerId is null, then the employee does not have a manager.
+ No employee will be the manager of themself.
+
+Write an SQL query to report the managers with at least **five direct reports**.
+
+Return the result table in **any order**.
+
+The query result format is in the following example.
+
+**Example 1:**
+
+**Input:**
+
+Employee table:
+
+ +-----+-------+------------+-----------+
+ | id | name | department | managerId |
+ +-----+-------+------------+-----------+
+ | 101 | John | A | None |
+ | 102 | Dan | A | 101 |
+ | 103 | James | A | 101 |
+ | 104 | Amy | A | 101 |
+ | 105 | Anne | A | 101 |
+ | 106 | Ron | B | 101 |
+ +-----+-------+------------+-----------+
+
+**Output:**
+
+ +------+
+ | name |
+ +------+
+ | John |
+ +------+
\ No newline at end of file
diff --git a/src/main/kotlin/g0501_0600/s0570_managers_with_at_least_5_direct_reports/script.sql b/src/main/kotlin/g0501_0600/s0570_managers_with_at_least_5_direct_reports/script.sql
new file mode 100644
index 000000000..0116a50c7
--- /dev/null
+++ b/src/main/kotlin/g0501_0600/s0570_managers_with_at_least_5_direct_reports/script.sql
@@ -0,0 +1,7 @@
+# Write your MySQL query statement below
+# #Medium #Database #2023_05_18_Time_454_ms_(90.82%)_Space_0B_(100.00%)
+select e.name
+from employee m left join employee e
+on m.managerid = e.id
+group by e.name
+having count(e.name) > 4;
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/s0575_distribute_candies/Solution.kt b/src/main/kotlin/g0501_0600/s0575_distribute_candies/Solution.kt
index 573ea55ae..4147253ad 100644
--- a/src/main/kotlin/g0501_0600/s0575_distribute_candies/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0575_distribute_candies/Solution.kt
@@ -2,7 +2,7 @@ package g0501_0600.s0575_distribute_candies
// #Easy #Array #Hash_Table #2023_01_23_Time_538_ms_(76.92%)_Space_47.3_MB_(69.23%)
-internal class Solution {
+class Solution {
fun distributeCandies(candyType: IntArray): Int {
val s: MutableSet = HashSet()
for (i in candyType) {
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 dc959f091..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
@@ -2,8 +2,6 @@ package g0501_0600.s0576_out_of_boundary_paths
// #Medium #Dynamic_Programming #2023_01_23_Time_153_ms_(100.00%)_Space_34.7_MB_(80.00%)
-import java.util.Arrays
-
class Solution {
private val dRowCol = arrayOf(intArrayOf(1, 0), intArrayOf(-1, 0), intArrayOf(0, 1), intArrayOf(0, -1))
private fun dfs(
@@ -12,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
@@ -37,13 +35,13 @@ class Solution {
val cache = Array(m) {
Array(n) {
IntArray(
- maxMoves + 1
+ maxMoves + 1,
)
}
}
for (c1 in cache) {
for (c2 in c1) {
- Arrays.fill(c2, -1)
+ c2.fill(-1)
}
}
return dfs(m, n, maxMoves, startRow, startCol, cache)
diff --git a/src/main/kotlin/g0501_0600/s0577_employee_bonus/readme.md b/src/main/kotlin/g0501_0600/s0577_employee_bonus/readme.md
new file mode 100644
index 000000000..fd59315e2
--- /dev/null
+++ b/src/main/kotlin/g0501_0600/s0577_employee_bonus/readme.md
@@ -0,0 +1,75 @@
+577\. Employee Bonus
+
+Easy
+
+SQL Schema
+
+Table: `Employee`
+
+ +-------------+---------+
+ | Column Name | Type |
+ +-------------+---------+
+ | empId | int |
+ | name | varchar |
+ | supervisor | int |
+ | salary | int |
+ +-------------+---------+
+
+empId is the primary key column for this table.
+
+Each row of this table indicates the name and the ID of an employee in addition to their salary and the id of their manager.
+
+Table: `Bonus`
+
+ +-------------+------+
+ | Column Name | Type |
+ +-------------+------+
+ | empId | int |
+ | bonus | int |
+ +-------------+------+
+
+empId is the primary key column for this table.
+
+empId is a foreign key to empId from the Employee table.
+
+Each row of this table contains the id of an employee and their respective bonus.
+
+Write an SQL query to report the name and bonus amount of each employee with a bonus **less than** `1000`.
+
+Return the result table in **any order**.
+
+The query result format is in the following example.
+
+**Example 1:**
+
+**Input:**
+
+Employee table:
+
+ +-------+--------+------------+--------+
+ | empId | name | supervisor | salary |
+ +-------+--------+------------+--------+
+ | 3 | Brad | null | 4000 |
+ | 1 | John | 3 | 1000 |
+ | 2 | Dan | 3 | 2000 |
+ | 4 | Thomas | 3 | 4000 |
+ +-------+--------+------------+--------+
+
+Bonus table:
+
+ +-------+-------+
+ | empId | bonus |
+ +-------+-------+
+ | 2 | 500 |
+ | 4 | 2000 |
+ +-------+-------+
+
+**Output:**
+
+ +------+-------+
+ | name | bonus |
+ +------+-------+
+ | Brad | null |
+ | John | null |
+ | Dan | 500 |
+ +------+-------+
\ No newline at end of file
diff --git a/src/main/kotlin/g0501_0600/s0577_employee_bonus/script.sql b/src/main/kotlin/g0501_0600/s0577_employee_bonus/script.sql
new file mode 100644
index 000000000..682aea89e
--- /dev/null
+++ b/src/main/kotlin/g0501_0600/s0577_employee_bonus/script.sql
@@ -0,0 +1,6 @@
+# Write your MySQL query statement below
+# #Easy #Database #2023_05_18_Time_1473_ms_(95.83%)_Space_0B_(100.00%)
+SELECT name, bonus
+FROM Employee e
+LEFT JOIN Bonus b ON e.empId = b.empId
+WHERE bonus < 1000 or b.empId is null;
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/s0585_investments_in_2016/readme.md b/src/main/kotlin/g0501_0600/s0585_investments_in_2016/readme.md
new file mode 100644
index 000000000..10b12fb7a
--- /dev/null
+++ b/src/main/kotlin/g0501_0600/s0585_investments_in_2016/readme.md
@@ -0,0 +1,67 @@
+585\. Investments in 2016
+
+Medium
+
+SQL Schema
+
+Table: `Insurance`
+
+ +-------------+-------+
+ | Column Name | Type |
+ +-------------+-------+
+ | pid | int |
+ | tiv_2015 | float |
+ | tiv_2016 | float |
+ | lat | float |
+ | lon | float |
+ +-------------+-------+
+
+pid is the primary key column for this table.
+
+Each row of this table contains information about one policy where:
+
+pid is the policyholder's policy ID.
+
+tiv\_2015 is the total investment value in 2015 and tiv\_2016 is the total investment value in 2016.
+
+lat is the latitude of the policy holder's city. It's guaranteed that lat is not NULL.
+
+lon is the longitude of the policy holder's city. It's guaranteed that lon is not NULL.
+
+Write an SQL query to report the sum of all total investment values in 2016 `tiv_2016`, for all policyholders who:
+
+* have the same `tiv_2015` value as one or more other policyholders, and
+* are not located in the same city like any other policyholder (i.e., the (`lat, lon`) attribute pairs must be unique).
+
+Round `tiv_2016` to **two decimal places**.
+
+The query result format is in the following example.
+
+**Example 1:**
+
+**Input:** Insurance table:
+
+ +-----+----------+----------+-----+-----+
+ | pid | tiv_2015 | tiv_2016 | lat | lon |
+ +-----+----------+----------+-----+-----+
+ | 1 | 10 | 5 | 10 | 10 |
+ | 2 | 20 | 20 | 20 | 20 |
+ | 3 | 10 | 30 | 20 | 20 |
+ | 4 | 10 | 40 | 40 | 40 |
+ +-----+----------+----------+-----+-----+
+
+**Output:**
+
+ +----------+
+ | tiv_2016 |
+ +----------+
+ | 45.00 |
+ +----------+
+
+**Explanation:**
+
+The first record in the table, like the last record, meets both of the two criteria.
+The tiv\_2015 value 10 is the same as the third and fourth records, and its location is unique.
+
+The second record does not meet any of the two criteria. Its tiv\_2015 is not like any other policyholders and its location is the same as the third record, which makes the third record fail, too.
+So, the result is the sum of tiv\_2016 of the first and last record, which is 45.
\ No newline at end of file
diff --git a/src/main/kotlin/g0501_0600/s0585_investments_in_2016/script.sql b/src/main/kotlin/g0501_0600/s0585_investments_in_2016/script.sql
new file mode 100644
index 000000000..771698ce8
--- /dev/null
+++ b/src/main/kotlin/g0501_0600/s0585_investments_in_2016/script.sql
@@ -0,0 +1,7 @@
+# Write your MySQL query statement below
+# #Medium #Database #2023_05_18_Time_729_ms_(99.22%)_Space_0B_(100.00%)
+select round(sum(tiv_2016),2) tiv_2016 from insurance i1
+where tiv_2015 in (select tiv_2015 from insurance i2
+ where i1.pid != i2.pid)
+and (lat, lon) not in (select lat, lon from insurance i3
+ where i3.pid != i1.pid)
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 ef45617c3..6bbb8f7f5 100644
--- a/src/main/kotlin/g0501_0600/s0593_valid_square/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0593_valid_square/Solution.kt
@@ -2,8 +2,6 @@ package g0501_0600.s0593_valid_square
// #Medium #Math #Geometry #2023_02_01_Time_161_ms_(83.33%)_Space_35_MB_(66.67%)
-import java.util.Arrays
-
class Solution {
fun validSquare(p1: IntArray, p2: IntArray, p3: IntArray, p4: IntArray): Boolean {
val distancesSquared = IntArray(6)
@@ -13,7 +11,7 @@ class Solution {
distancesSquared[3] = getDistanceSquared(p2, p3)
distancesSquared[4] = getDistanceSquared(p2, p4)
distancesSquared[5] = getDistanceSquared(p3, p4)
- Arrays.sort(distancesSquared)
+ distancesSquared.sort()
if (distancesSquared[0] == 0) {
return false
}
@@ -22,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/g0501_0600/s0594_longest_harmonious_subsequence/Solution.kt b/src/main/kotlin/g0501_0600/s0594_longest_harmonious_subsequence/Solution.kt
index ef576756b..57761bf7b 100644
--- a/src/main/kotlin/g0501_0600/s0594_longest_harmonious_subsequence/Solution.kt
+++ b/src/main/kotlin/g0501_0600/s0594_longest_harmonious_subsequence/Solution.kt
@@ -2,11 +2,9 @@ package g0501_0600.s0594_longest_harmonious_subsequence
// #Easy #Array #Hash_Table #Sorting #2023_02_01_Time_331_ms_(100.00%)_Space_40.2_MB_(96.15%)
-import java.util.Arrays
-
class Solution {
fun findLHS(nums: IntArray): Int {
- Arrays.sort(nums)
+ nums.sort()
var max = 0
var lastN = 0
var curN = 1
diff --git a/src/main/kotlin/g0601_0700/s0602_friend_requests_ii_who_has_the_most_friends/readme.md b/src/main/kotlin/g0601_0700/s0602_friend_requests_ii_who_has_the_most_friends/readme.md
new file mode 100644
index 000000000..38aed7662
--- /dev/null
+++ b/src/main/kotlin/g0601_0700/s0602_friend_requests_ii_who_has_the_most_friends/readme.md
@@ -0,0 +1,48 @@
+602\. Friend Requests II: Who Has the Most Friends
+
+Medium
+
+SQL Schema
+
+Table: `RequestAccepted`
+
+ +----------------+---------+
+ | Column Name | Type |
+ +----------------+---------+
+ | requester_id | int |
+ | accepter_id | int |
+ | accept_date | date |
+ +----------------+---------+
+
+(requester_id, accepter_id) is the primary key for this table. This table contains the ID of the user who sent the request, the ID of the user who received the request, and the date when the request was accepted.
+
+Write an SQL query to find the people who have the most friends and the most friends number.
+
+The test cases are generated so that only one person has the most friends.
+
+The query result format is in the following example.
+
+**Example 1:**
+
+**Input:** RequestAccepted table:
+
+ +--------------+-------------+-------------+
+ | requester_id | accepter_id | accept_date |
+ +--------------+-------------+-------------+
+ | 1 | 2 | 2016/06/03 |
+ | 1 | 3 | 2016/06/08 |
+ | 2 | 3 | 2016/06/08 |
+ | 3 | 4 | 2016/06/09 |
+ +--------------+-------------+-------------+
+
+**Output:**
+
+ +----+-----+
+ | id | num |
+ +----+-----+
+ | 3 | 3 |
+ +----+-----+
+
+**Explanation:** The person with id 3 is a friend of people 1, 2, and 4, so he has three friends in total, which is the most number than any others.
+
+**Follow up:** In the real world, multiple people could have the same most number of friends. Could you find all these people in this case?
\ No newline at end of file
diff --git a/src/main/kotlin/g0601_0700/s0602_friend_requests_ii_who_has_the_most_friends/script.sql b/src/main/kotlin/g0601_0700/s0602_friend_requests_ii_who_has_the_most_friends/script.sql
new file mode 100644
index 000000000..07f6f4716
--- /dev/null
+++ b/src/main/kotlin/g0601_0700/s0602_friend_requests_ii_who_has_the_most_friends/script.sql
@@ -0,0 +1,12 @@
+# Write your MySQL query statement below
+# #Medium #Database #2023_05_19_Time_398_ms_(97.39%)_Space_0B_(100.00%)
+SELECT req AS id, COUNT(acc) AS num
+FROM
+((SELECT requester_id AS req, accepter_id AS acc
+FROM requestaccepted)
+UNION
+(SELECT accepter_id AS req, requester_id AS acc
+FROM requestaccepted)) t
+GROUP BY req
+ORDER BY num DESC
+LIMIT 1
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/s0610_triangle_judgement/readme.md b/src/main/kotlin/g0601_0700/s0610_triangle_judgement/readme.md
new file mode 100644
index 000000000..1f73738ad
--- /dev/null
+++ b/src/main/kotlin/g0601_0700/s0610_triangle_judgement/readme.md
@@ -0,0 +1,45 @@
+610\. Triangle Judgement
+
+Easy
+
+SQL Schema
+
+Table: `Triangle`
+
+ +-------------+------+
+ | Column Name | Type |
+ +-------------+------+
+ | x | int |
+ | y | int |
+ | z | int |
+ +-------------+------+
+
+(x, y, z) is the primary key column for this table.
+
+Each row of this table contains the lengths of three line segments.
+
+Write an SQL query to report for every three line segments whether they can form a triangle.
+
+Return the result table in **any order**.
+
+The query result format is in the following example.
+
+**Example 1:**
+
+**Input:** Triangle table:
+
+ +----+----+----+
+ | x | y | z |
+ +----+----+----+
+ | 13 | 15 | 30 |
+ | 10 | 20 | 15 |
+ +----+----+----+
+
+**Output:**
+
+ +----+----+----+----------+
+ | x | y | z | triangle |
+ +----+----+----+----------+
+ | 13 | 15 | 30 | No |
+ | 10 | 20 | 15 | Yes |
+ +----+----+----+----------+
\ No newline at end of file
diff --git a/src/main/kotlin/g0601_0700/s0610_triangle_judgement/script.sql b/src/main/kotlin/g0601_0700/s0610_triangle_judgement/script.sql
new file mode 100644
index 000000000..72d21b3b8
--- /dev/null
+++ b/src/main/kotlin/g0601_0700/s0610_triangle_judgement/script.sql
@@ -0,0 +1,5 @@
+# Write your MySQL query statement below
+# #Easy #Database #2023_05_19_Time_464_ms_(72.35%)_Space_0B_(100.00%)
+SELECT *,
+ CASE WHEN x+y>z AND y+z>x AND z+x>y THEN 'Yes' ELSE 'No' END AS triangle
+FROM Triangle
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/s0619_biggest_single_number/readme.md b/src/main/kotlin/g0601_0700/s0619_biggest_single_number/readme.md
new file mode 100644
index 000000000..34475a755
--- /dev/null
+++ b/src/main/kotlin/g0601_0700/s0619_biggest_single_number/readme.md
@@ -0,0 +1,76 @@
+619\. Biggest Single Number
+
+Easy
+
+SQL Schema
+
+Table: `MyNumbers`
+
+ +-------------+------+
+ | Column Name | Type |
+ +-------------+------+
+ | num | int |
+ +-------------+------+
+
+There is no primary key for this table. It may contain duplicates.
+
+Each row of this table contains an integer.
+
+A **single number** is a number that appeared only once in the `MyNumbers` table.
+
+Write an SQL query to report the largest **single number**. If there is no **single number**, report `null`.
+
+The query result format is in the following example.
+
+**Example 1:**
+
+**Input:** MyNumbers table:
+
+ +-----+
+ | num |
+ +-----+
+ | 8 |
+ | 8 |
+ | 3 |
+ | 3 |
+ | 1 |
+ | 4 |
+ | 5 |
+ | 6 |
+ +-----+
+
+**Output:**
+
+ +-----+
+ | num |
+ +-----+
+ | 6 |
+ +-----+
+
+**Explanation:** The single numbers are 1, 4, 5, and 6. Since 6 is the largest single number, we return it.
+
+**Example 2:**
+
+**Input:** MyNumbers table:
+
+ +-----+
+ | num |
+ +-----+
+ | 8 |
+ | 8 |
+ | 7 |
+ | 7 |
+ | 3 |
+ | 3 |
+ | 3 |
+ +-----+
+
+**Output:**
+
+ +------+
+ | num |
+ +------+
+ | null |
+ +------+
+
+**Explanation:** There are no single numbers in the input table so we return null.
\ No newline at end of file
diff --git a/src/main/kotlin/g0601_0700/s0619_biggest_single_number/script.sql b/src/main/kotlin/g0601_0700/s0619_biggest_single_number/script.sql
new file mode 100644
index 000000000..31829a4fe
--- /dev/null
+++ b/src/main/kotlin/g0601_0700/s0619_biggest_single_number/script.sql
@@ -0,0 +1,8 @@
+# Write your MySQL query statement below
+# #Easy #Database #2023_05_20_Time_656_ms_(90.69%)_Space_0B_(100.00%)
+SELECT MAX(num) AS num
+FROM (SELECT num, COUNT(num)
+ FROM MyNumbers
+ GROUP BY num
+ HAVING COUNT(num) = 1) t
+
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/s0630_course_schedule_iii/Solution.kt b/src/main/kotlin/g0601_0700/s0630_course_schedule_iii/Solution.kt
index 42b412a5b..b3f4977eb 100644
--- a/src/main/kotlin/g0601_0700/s0630_course_schedule_iii/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0630_course_schedule_iii/Solution.kt
@@ -2,13 +2,12 @@ package g0601_0700.s0630_course_schedule_iii
// #Hard #Array #Greedy #Heap_Priority_Queue #2023_02_09_Time_536_ms_(100.00%)_Space_58_MB_(100.00%)
-import java.util.Arrays
import java.util.PriorityQueue
class Solution {
fun scheduleCourse(courses: Array): Int {
// Sort the courses based on their deadline date.
- Arrays.sort(courses) { a: IntArray, b: IntArray ->
+ courses.sortWith { a: IntArray, b: IntArray ->
a[1] - b[1]
}
// Only the duration is stored. We don't care which course
@@ -39,7 +38,7 @@ class Solution {
// Remove any course that is longer than current course
// will work, but we remove the longest one with the help
// of heap (pq).
- if (!pq.isEmpty() && pq.peek() > course[0]) {
+ if (pq.isNotEmpty() && pq.peek() > course[0]) {
time -= pq.poll()
time += course[0]
pq.offer(course[0])
diff --git a/src/main/kotlin/g0601_0700/s0636_exclusive_time_of_functions/Solution.kt b/src/main/kotlin/g0601_0700/s0636_exclusive_time_of_functions/Solution.kt
index a0bd73a42..320079e72 100644
--- a/src/main/kotlin/g0601_0700/s0636_exclusive_time_of_functions/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0636_exclusive_time_of_functions/Solution.kt
@@ -17,7 +17,7 @@ class Solution {
val top = stack.pop()
val executionTime = log.time - top.time + 1
result[top.id] += executionTime - top.waitingTime
- if (!stack.isEmpty()) {
+ if (stack.isNotEmpty()) {
stack.peek().waitingTime += executionTime
}
}
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 12ddbe080..5f626ef65 100644
--- a/src/main/kotlin/g0601_0700/s0638_shopping_offers/Solution.kt
+++ b/src/main/kotlin/g0601_0700/s0638_shopping_offers/Solution.kt
@@ -3,11 +3,11 @@ package g0601_0700.s0638_shopping_offers
// #Medium #Array #Dynamic_Programming #Bit_Manipulation #Backtracking #Bitmask #Memoization
// #2023_02_10_Time_195_ms_(100.00%)_Space_35.1_MB_(100.00%)
-class Solution() {
+class Solution {
fun shoppingOffers(
price: List,
special: List>,
- needs: List
+ needs: List