{"id":24108208,"url":"https://github.com/luaannguyen/go-leetcode","last_synced_at":"2025-08-25T19:02:59.262Z","repository":{"id":271300784,"uuid":"912994925","full_name":"LuaanNguyen/go-leetcode","owner":"LuaanNguyen","description":"My GO solutions for daily Leetcode ✏️ ","archived":false,"fork":false,"pushed_at":"2025-04-12T20:47:38.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-25T19:02:58.217Z","etag":null,"topics":["go","golang","leetcode","leetcode-questions","leetcode-solutions"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LuaanNguyen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-06T20:20:10.000Z","updated_at":"2025-04-16T23:50:03.000Z","dependencies_parsed_at":"2025-01-06T22:19:00.138Z","dependency_job_id":"cb400162-0109-46bc-b13d-81c6a63ed648","html_url":"https://github.com/LuaanNguyen/go-leetcode","commit_stats":null,"previous_names":["luaannguyen/go-leetcode"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LuaanNguyen/go-leetcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2Fgo-leetcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2Fgo-leetcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2Fgo-leetcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2Fgo-leetcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuaanNguyen","download_url":"https://codeload.github.com/LuaanNguyen/go-leetcode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaanNguyen%2Fgo-leetcode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272116856,"owners_count":24876268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","leetcode","leetcode-questions","leetcode-solutions"],"created_at":"2025-01-10T23:26:24.917Z","updated_at":"2025-08-25T19:02:59.253Z","avatar_url":"https://github.com/LuaanNguyen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Daily LeetCode Solutions in Go ✏️\n\nThis repository contains my solutions to LeetCode problems in [Go](https://go.dev/).\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/gist/brudnak/6c21505423e4ff089ab704ec79b5a096/raw/b2d3dec32474b2121b179920734b259323a7c250/go.gif\" alt=\"Go\" width=\"400\"/\u003e\n\u003c/div\u003e\n\n## Folder Structure 🗂️\n\n- `easy/`: Easy level problems.\n- `medium/`: Medium level problems.\n- `hard/`: Hard level problems.\n\n## Unit Testing 🧪\n\nIn your root direction, run:\n\n```bash\ngo test ./...\n```\n\nIf you only want to run tests in a specific problem `(e.g., ./easy/0001_two_sum)`, run:\n\n```bash\ngo test ./easy/0001_two_sum\n```\n\nClean test cache\n\n```bash\ngo clean -testcache\n```\n\n## Solutions (Continue Updating...)\n\n|                                                              Leetcode ID                                                              | Title \u0026 Solution                                                                                                            | Coefficient Of Difficulty |                                             Remarks                                              |                                                                                                        Approach                                                                                                        |\n| :-----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------- | :-----------------------: | :----------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\n|                          [3042](https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/description/)                           | [Count Prefix and Suffix Pairs I](/easy/3042_count_prefix_and_sufix_pairs_I)                                                |           Easy            |                                       _`Array`_ _`String`_                                       |                                                                                                                                                                                                                        |\n|                         [2185](https://leetcode.com/problems/counting-words-with-a-given-prefix/description/)                         | [Counting Words With a Given Prefix](/easy/2185_counting_words_with_a_given_string)                                         |           Easy            |                             _`Array`_ _`String`_ _`String Matching`_                             |                                                                                                                                                                                                                        |\n|       [1400](https://leetcode.com/problems/construct-k-palindrome-strings/description/?envType=daily-question\u0026envId=2025-01-11)       | [Construct K Palindrome Strings](/medium/1400_construct_k_palindrome_strings)                                               |          Medium           |                         _`HashTable`_ _`String`_ _`Greedy`_ _`Counting`_                         |                                                                                                                                                                                                                        |\n| [2116](https://leetcode.com/problems/check-if-a-parentheses-string-can-be-valid/description/?envType=daily-question\u0026envId=2025-01-12) | [Check if a Parentheses String Can Be Valid](/medium/2116_check_if_a_parentheses_string_can_be_valid)                       |          Medium           |                                 _`Stack`_ _`String`_ _`Greedy`_                                  |                                                                                                                                                                                                                        |\n| [3223](https://leetcode.com/problems/minimum-length-of-string-after-operations/description/?envType=daily-question\u0026envId=2025-01-13)  | [Minimum Length of String After Operations](/medium/2116_check_if_a_parentheses_string_can_be_valid)                        |          Medium           |                              _`HashTable`_ _`String`_ _`Counting`_                               |                                                                                                                                                                                                                        |\n| [2657](https://leetcode.com/problems/find-the-prefix-common-array-of-two-arrays/description/?envType=daily-question\u0026envId=2025-01-14) | [Find the Prefix Common Array of Two Arrays](/medium/2657_find_the_prefix_common_array_of_two_arrays)                       |          Medium           |                                     _`HashTable`_ _`Array`_                                      |                                                                                                                                                                                                                        |\n|                [2429](https://leetcode.com/problems/minimize-xor/description/?envType=daily-question\u0026envId=2025-01-15)                | [Minimize XOR](/medium/2429_minimize_XOR)                                                                                   |          Medium           |                                       _`Bit Manipulation`_                                       |                                                                                                                                                                                                                        |\n|                              [2425](https://leetcode.com/problems/neighboring-bitwise-xor/description/)                               | [Bitwise XOR of All Pairings](/medium/2429_minimize_XOR)                                                                    |          Medium           |                              _`Bit Manipulation`_ _`Brain Teaser`_                               |                                                                                                                                                                                                                        |\n|        [2683](https://leetcode.com/problems/bitwise-xor-of-all-pairings/description/?envType=daily-question\u0026envId=2025-01-16)         | [Neighboring Bitwise XOR](/medium/2683_neighboring_bitwise_XOR)                                                             |          Medium           |                                  _`Bit Manipulation`_ _`Array`_                                  |                                                                                                                                                                                                                        |\n| [1368](https://leetcode.com/problems/minimum-cost-to-make-at-least-one-valid-path-in-a-grid/?envType=daily-question\u0026envId=2025-01-18) | [Minimum Cost to Make at Least One Valid Path in a Grid](/hard/1368_minimum_cost_to_make_at_least_one_valid_path_in_a_grid) |           Hard            | _`Breadth First Search`_ _`Graph`_ `Heap(Priority Queue)` _`Matrix`_ _`Shortest Path`_ _`Array`_ |                                                                                                                                                                                                                        |\n|                 [407](https://leetcode.com/problems/trapping-rain-water-ii/?envType=daily-question\u0026envId=2025-01-19)                  | [Trapping Rain Water II](/hard/1368_minimum_cost_to_make_at_least_one_valid_path_in_a_grid)                                 |           Hard            | _`Breadth First Search`_ _`Graph`_ `Heap(Priority Queue)` _`Matrix`_ _`Shortest Path`_ _`Array`_ |                                                                                                                                                                                                                        |\n|   [2661](https://leetcode.com/problems/first-completely-painted-row-or-column/description/?envType=daily-question\u0026envId=2025-01-20)   | [First Completely Painter Row or Column](/medium/2661_first_completely_painted_row_or_column)                               |          medium           |                                _`Matrix`_ _`HashTable`_ _`Array`_                                |                                                                                                                                                                                                                        |\n|                                           [2017](https://leetcode.com/problems/grid-game/)                                            | [Grid Game](/medium/2017_grid_game)                                                                                         |          medium           |                                    _`Matrix`_ _`Prefix Sum`_                                     |                                                                                                                                                                                                                        |\n|            [1765](https://leetcode.com/problems/map-of-highest-peak/description/?envType=daily-question\u0026envId=2025-01-22)             | [Map of Highest Peak](/medium/1765_map_of_highest_peak)                                                                     |          medium           |                                _`Graph`_ _`Breadth-First Search`_                                |                                                                                                                                                                                                                        |\n|       [1267](https://leetcode.com/problems/count-servers-that-communicate/description/?envType=daily-question\u0026envId=2025-01-23)       | [Count Servers that Communicate](/medium/1267_count_servers_that_communicate)                                               |          medium           |                                      _`Counting`_ _`Array`_                                      |                                                                                                                                                                                                                        |\n|          [802](https://leetcode.com/problems/find-eventual-safe-states/description/?envType=daily-question\u0026envId=2025-01-24)          | [Find Eventual Safe States](/medium/802_find_eventual_safe_states)                                                          |          medium           |                            _`Depth-First Search`_ _`Adjacency List`_                             |                                                                                                                                                                                                                        |\n|                                           [75](https://leetcode.com/problems/sort-colors/)                                            | [Sort Colors](/medium/75_sort_colors)                                                                                       |          medium           |                              _`Three Pointers`_ _`DNF Algortithm`_                               |                                    Initalize 3 pointers. Left and mid at 0, high at len(nums) - 1. Do a while loop as long as mid \u003c= high and swap elements based on 3 conditions.                                     |\n|                                 [229](https://leetcode.com/problems/majority-element-ii/description/)                                 | [Sort Colors](/medium/229_majority_element_II)                                                                              |          medium           |                                     _`Counter`_ _`Hashmap`_                                      | There can be at most 2 such elements with floor(n /3). Do a first pass to find all and eliminate all the non-qualify elements, then the second pass check how many time a each candidate appear in the original array. |\n|                          [167](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/)                           | [Two Sum II - Input Array Is Sorted](/medium/167_two_sum_II_input_array_is_sorted)                                          |          medium           |                                         _`Two Pointers`_                                         |                       We know that the array is sorted in asc order. We can track the total sum of 2 pointers left and right and increase or decrease their indices accordingly in a while loop                        |\n|                                         [15](https://leetcode.com/problems/3sum/description/)                                         | [3Sum](/medium/15_3sum)                                                                                                     |          medium           |                                         _`Two Pointers`_                                         |                            Interate through the array, initialize 2 other pointers j = i + 1 and k = n - 1 and check the sum and adjust j and k accordingly. Make sure to check duplicates                             |\n|                 [3375](https://leetcode.com/problems/minimum-operations-to-make-array-values-equal-to-k/description)                  | [3Sum](/easy/3375_minimum_operations_to_make_array_values_equal_to_k)                                                       |          medium           |                                           _`Hashmap`_                                            |                                   There is no solution if a value that smaller than k. If a value is larger than k, we add it to our set and count the length of the set at the end                                    |\n|                                 [680](https://leetcode.com/problems/valid-palindrome-ii/description/)                                 | [Valid Palindrome II](/easy/680_valid_palindrome_II)                                                                        |           easy            |                                         _`Two Pointers`_                                         |                                  Have a helper function which has the same structure as the main function. Use 2 pointers to check the +1 or -1 element whether they are equal or not                                  |\n|                                   [344](https://leetcode.com/problems/reverse-string/description/)                                    | [Reverse String](/easy/344_reverse_string)                                                                                  |           easy            |                                         _`Two Pointers`_                                         |                                                                                                                                                                                                                        |\n|                              [2843](https://leetcode.com/problems/count-symmetric-integers/description/)                              | [Count Symmetric Integers](/easy/2843_count_symmetric_integers)                                                             |           easy            |                                                                                                  |                                                                                                                                                                                                                        |\n|                                         [18](https://leetcode.com/problems/4sum/description/)                                         | [4Sum](/medium/18_4sum)                                                                                                     |          medium           |                                         _`Two pointers`_                                         |                                        Do Two Sum II and 3Sum first since 4Sum is the combination of those problems. There is an extra for loop. Make sure to check duplicates.                                        |\n\n## Workflow 🌊\n\n1. `go.yml`: This workflow runs whenver new code is pushed to main or create a pull request\n\n- Runs all Go tests\n- Checks code formatting with `go fmt`\n- Runs `go vet` for static analysis\n- Runs `staticcheck` for additional code quality checks\n\n2. `update-stats.yml`: This runs whenever you push changes to your solution directory (`easy/medium/hard`). It:\n\n- Counts the number of solutions in each level\n- Update `README.md` with current stats\n- Automaticall commits and pushes the changes\n\n## Statistics 📊\n\n- Easy: 8 solutions\n- Medium: 17 solutions\n- Hard: 2 solutions\n- Total: 27 solutions\n\n## License 🪪\n\n```txt\nMIT License\nCopyright (c) 2025 Luan Nguyen\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluaannguyen%2Fgo-leetcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluaannguyen%2Fgo-leetcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluaannguyen%2Fgo-leetcode/lists"}