/leetcode-go

Go solutions for LeetCode problems

Primary LanguageGoMIT LicenseMIT

Go solutions to LeetCode problems

The purpose of this repository is to serve as a portfolio of my work and to provide a resource for others seeking clear and easy-to-understand solutions to these problems. Every day starting January 17, 2023, I will be adding my solutions to this repository.

Please note that: my solutions are not necessarily optimized for efficiency in terms of time complexity or memory consumption. Instead, my focus is on providing solutions that are clear, and are easy for others to understand and learn from.

If you are seeking more clever or efficient solutions, I recommend checking out these repositories from halfrost and aQuaYi. They contain solutions that are highly optimized in terms of time and memory complexity.

I understand how challenging it can be to work through these problems and I hope that my solutions can provide guidance and direction for those struggling to find their own solutions.

Completion Summary

My LeetCode profile

Difficulty Solved Problems
🟢 Easy 85
🟡 Medium 21
🔴 Hard 1
⚫ Total 107

Solutions

No. Title Solution Acceptance Difficulty Tags
0001 Two Sum Go 49.2% Easy Array Hash Table
0006 Zigzag Conversion Go 44.6% Medium String
0009 Palindrome Number Go 53.1% Easy Math
0012 Integer to Roman Go 61.7% Medium Hash Table Math String
0013 Roman to Integer Go 58.2% Easy Hash Table Math String
0021 Merge Two Sorted Lists Go 62.2% Easy Linked List Recursion
0035 Search Insert Position Go 42.3% Easy Array Binary Search
0041 First Missing Positive Go 36.6% Hard Array Hash Table
0045 Jump Game II Go 39.3% Medium Array Dynamic Programming Greedy
0049 Group Anagrams Go 66.6% Medium Array Hash Table String Sorting
0053 Maximum Subarray Go 50.1% Medium Array Divide and Conquer Dynamic Programming
0062 Unique Paths Go 62.5% Medium Math Dynamic Programming Combinatorics
0067 Add Binary Go 52.3% Easy Math String Bit Manipulation Simulation
0070 Climbing Stairs Go 52.2% Easy Math Dynamic Programming Memoization
0088 Merge Sorted Array Go 46.2% Easy Array Two Pointers Sorting
0098 Validate Binary Search Tree Go 31.9% Medium Tree Depth-First Search Binary Search Tree Binary Tree
0100 Same Tree Go 57.8% Easy Tree Depth-First Search Breadth-First Search Binary Tree
0102 Binary Tree Level Order Traversal Go 63.9% Medium Tree Breadth-First Search Binary Tree
0121 Best Time to Buy and Sell Stock Go 54.3% Easy Array Dynamic Programming
0136 Single Number Go 70.4% Easy Array Bit Manipulation
0142 Linked List Cycle II Go 47.1% Medium Hash Table Linked List Two Pointers
0175 Combine Two Tables SQL 73.6% Easy Database
0176 Second Highest Salary SQL 37.1% Medium Database
0182 Duplicate Emails SQL 70.8% Easy Database
0183 Customers Who Never Order SQL 68.4% Easy Database
0189 Rotate Array Go 39.3% Medium Array Math Two Pointers
0191 Number of 1 Bits Go 66.1% Easy Divide and Conquer Bit Manipulation
0196 Delete Duplicate Emails SQL 59.8% Easy Database
0197 Rising Temperature SQL 44.7% Easy Database
0205 Isomorphic Strings Go 42.7% Easy Hash Table String
0206 Reverse Linked List Go 73.0% Easy Linked List Recursion
0217 Contains Duplicate Go 61.4% Easy Array Hash Table Sorting
0235 Lowest Common Ancestor of a Binary Search Tree Go 61.0% Medium Tree Depth-First Search Binary Search Tree Binary Tree
0242 Valid Anagram Go 62.9% Easy Hash Table String Sorting
0278 First Bad Version Go 43.1% Easy Binary Search Interactive
0283 Move Zeroes Go 61.4% Easy Array Two Pointers
0290 Word Pattern Go 41.7% Easy Hash Table String
0299 Bulls and Cows Go 49.1% Medium Hash Table String Counting
0344 Reverse String Go 76.5% Easy Two Pointers String
0349 Intersection of Two Arrays Go 70.6% Easy Array Hash Table Two Pointers Binary Search Sorting
0350 Intersection of Two Arrays II Go 55.8% Easy Array Hash Table Two Pointers Binary Search Sorting
0383 Ransom Note Go 57.9% Easy Hash Table String Counting
0387 First Unique Character in a String Go 59.3% Easy Hash Table String Queue Counting
0392 Is Subsequence Go 48.3% Easy Two Pointers String Dynamic Programming
0394 Decode String Go 57.9% Medium String Stack Recursion
0409 Longest Palindrome Go 54.5% Easy Hash Table String Greedy
0412 Fizz Buzz Go 69.6% Easy Math String Simulation
0438 Find All Anagrams in a String Go 50.1% Medium Hash Table String Sliding Window
0442 Find All Duplicates in an Array Go 73.4% Medium Array Hash Table
0509 Fibonacci Number Go 69.5% Easy Math Dynamic Programming Recursion Memoization
0557 Reverse Words in a String III Go 81.8% Easy Two Pointers String
0567 Permutation in String Go 44.3% Medium Hash Table Two Pointers String Sliding Window
0584 Find Customer Referee SQL 69.7% Easy Database
0589 N-ary Tree Preorder Traversal Go 76.1% Easy Stack Tree Depth-First Search
0595 Big Countries SQL 71.9% Easy Database
0607 Sales Person SQL 70.6% Easy Database
0608 Tree Node SQL 71.8% Medium Database
0627 Swap Salary SQL 83.2% Easy Database
0704 Binary Search Go 55.2% Easy Array Binary Search
0724 Find Pivot Index Go 54.0% Easy Array Prefix Sum
0746 Min Cost Climbing Stairs Go 62.9% Easy Array Dynamic Programming
0771 Jewels and Stones Go 88.1% Easy Hash Table String
0844 Backspace String Compare Go 48.0% Easy Two Pointers String Stack Simulation
0876 Middle of the Linked List Go 75.1% Easy Linked List Two Pointers
0904 Fruit Into Baskets Go 43.6% Medium Array Hash Table Sliding Window
0953 Verifying an Alien Dictionary Go 54.3% Easy Array Hash Table String
0976 Largest Perimeter Triangle Go 54.6% Easy Array Math Greedy Sorting
0977 Squares of a Sorted Array Go 71.9% Easy Array Two Pointers Sorting
0989 Add to Array-Form of Integer Go 47.2% Easy Array Math
1071 Greatest Common Divisor of Strings Go 54.7% Easy Math String
1108 Defanging an IP Address Go 89.3% Easy String
1141 User Activity for the Past 30 Days I SQL 49.2% Easy Database
1148 Article Views I SQL 76.7% Easy Database
1281 Subtract the Product and Sum of Digits of an Integer Go 86.7% Easy Math
1282 Group the People Given the Group Size They Belong To Go 85.7% Medium Array Hash Table
1365 How Many Numbers Are Smaller Than the Current Number Go 86.7% Easy Array Hash Table Sorting Counting
1393 Capital Gain/Loss SQL 89.7% Medium Database
1431 Kids With the Greatest Number of Candies Go 87.4% Easy Array
1470 Shuffle the Array Go 88.5% Easy Array
1480 Running Sum of 1d Array Go 88.7% Easy Array Prefix Sum
1484 Group Sold Products By The Date SQL 81.8% Easy Database
1491 Average Salary Excluding the Minimum and Maximum Salary Go 61.9% Easy Array Sorting
1512 Number of Good Pairs Go 88.2% Easy Array Hash Table Math Counting
1523 Count Odd Numbers in an Interval Range Go 46.0% Easy Math
1527 Patients With a Condition SQL 41.5% Easy Database
1528 Shuffle String Go 85.5% Easy Array String
1581 Customer Who Visited but Did Not Make Any Transactions SQL 86.8% Easy Database
1587 Bank Account Summary II SQL 88.2% Easy Database
1667 Fix Names in a Table SQL 66.1% Easy Database
1672 Richest Customer Wealth Go 88.1% Easy Array Matrix
1693 Daily Leads and Partners SQL 89.3% Easy Database
1729 Find Followers Count SQL 71.3% Easy Database
1741 Find Total Time Spent by Each Employee SQL 90.8% Easy Database
1757 Recyclable and Low Fat Products SQL 93.2% Easy Database
1779 Find Nearest Point That Has the Same X or Y Coordinate Go 67.4% Easy Array
1795 Rearrange Products Table SQL 88.1% Easy Database
1873 Calculate Special Bonus SQL 61.4% Easy Database
1920 Build Array from Permutation Go 91.0% Easy Array Simulation
1929 Concatenation of Array Go 90.9% Easy Array
1965 Employees With Missing Information SQL 78.0% Easy Databases
2011 Final Value of Variable After Performing Operations Go 88.8% Easy Array String Simulation
2032 Two Out of Three Go 73.0% Easy Array Hash Table
2114 Maximum Number of Words Found in Sentences Go 87.8% Easy Array String
2235 Add Two Integers Go 89.2% Easy Math
2413 Smallest Even Multiple Go 87.6% Easy Math Number Theory
2441 Largest Positive Integer That Exists With Its Negative Go 67.8% Easy Array Hash Table
2469 Convert the Temperature Go 89.8% Easy Math

Not added yet: 1129 2477 1162 2306 783 1011 502 1675

Resources

https://leetcode.com/