# Go Solution for Leetcode algorithm problems
[![Build Status](https://travis-ci.org/zwfang/leetcode.svg?branch=master)](https://travis-ci.org/zwfang/leetcode)[![codecov](https://codecov.io/gh/zwfang/leetcode/branch/master/graph/badge.svg)](https://codecov.io/gh/zwfang/leetcode)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/86cf2613fa544ab5b254e2a7e5d9deb8)](https://www.codacy.com/app/zwfang/leetcode?utm_source=github.com&utm_medium=referral&utm_content=zwfang/leetcode&utm_campaign=Badge_Grade)[![Go Report Card](https://goreportcard.com/badge/github.com/zwfang/leetcode)](https://goreportcard.com/report/github.com/zwfang/leetcode)
### 欢迎各位gopher,clean code, 探讨最优解。
#### [仓库地址](https://github.com/zwfang/leetcode)
continually updating ????.
### Array
* [1. Two Sum](https://github.com/zwfang/leetcode/blob/master/src/0001_two_sum/twosum.go) *`lookup table;`* *`hash table`*
* [4. Median of Two Sorted Arrays](https://github.com/zwfang/leetcode/blob/master/src/0004_median_of_two_sorted_arrays/motsa.go) *`binary search;`* *`divide and conquer`*
* [11. Container With Most Water](https://github.com/zwfang/leetcode/blob/master/src/0011_container_with_most_water/container_with_most_water.go) *`double index;`* *`array`*
* [26. Remove Duplicates from Sorted Array](https://github.com/zwfang/leetcode/blob/master/src/0026_remove_duplicates_from_sorted_array/rdfsa.go) *`double index;`* *`array`*
* [27. Remove Element](https://github.com/zwfang/leetcode/blob/master/src/0027_remove_element/remove_element.go) *`double index;`* *`array`*
* [48. Rotate Image](https://github.com/zwfang/leetcode/blob/master/src/0048_rotate_image/rotate_image.go)
* [53. Maximum Subarray](https://github.com/zwfang/leetcode/blob/master/src/0053_maximum_subarray/maximum_subarray.go) *`dynamic programming`*
* [75. Sort Colors](https://github.com/zwfang/leetcode/blob/master/src/0075_sort_colors/sort_colors.go) *`sort;`* *`array`*
* [80. Remove Duplicates from Sorted Array II](https://github.com/zwfang/leetcode/blob/master/src/0080_remove_duplicates_from_sorted_array2/rdfsa2.go) *`double index;`* *`array`*
* [88. Merge Sorted Array](https://github.com/zwfang/leetcode/blob/master/src/0088_merge_sorted_array/msa.go) *`sort;`* *`array`*
* [121. Best Time to Buy and Sell Stock](https://github.com/zwfang/leetcode/blob/master/src/0121_best_time_to_buy_and_sell_stock/maxprofit.go) *`dynamic programming;`* *`array`*
* [122. Best Time to Buy and Sell Stock II](https://github.com/zwfang/leetcode/blob/master/src/0122_best_time_to_buy_and_sell_stock_2/maxprofit.go) *`greedy;`* *`array`*
* [167. Two Sum II - Input array is sorted](https://github.com/zwfang/leetcode/blob/master/src/0167_two_sum2/two_sum2.go) *`double index;`* *`binary search`*
* [179. Largest Number](https://github.com/zwfang/leetcode/blob/master/src/0179_largest_number/ln.go) *`sort`*
* [200. Number of Islands](https://github.com/zwfang/leetcode/blob/master/src/0200_number_of_island/number_of_island.go) *`dfs;`* *`bfs`*
* [209. Minimum Size Subarray Sum](https://github.com/zwfang/leetcode/blob/master/src/0209_minimum_size_subarray_sum/minimum_size_subarray_sum.go) *`sliding window`*
* [215. Kth Largest Element in an Array](https://github.com/zwfang/leetcode/blob/master/src/0215_kth_largest_element_in_an_array/kthleiaa.go) *`sort`*
* [217. Contains Duplicate](https://github.com/zwfang/leetcode/blob/master/src/0217_contains_duplicate/contains_duplicate.go) *`map`*
* [219. Contains Duplicate II](https://github.com/zwfang/leetcode/blob/master/src/0219_contains_duplicate_2/contains_duplicate_2.go) *`map`*
* [283. Move Zeroes(solution1)](https://github.com/zwfang/leetcode/blob/master/src/0283_move_zeroes/move_zeroes.go) *`sliding window`*
* [283. Move Zeroes(solution2)](https://github.com/zwfang/leetcode/blob/master/src/0283_move_zeroes/move_zeroes2.go) *`sliding window`*
* [303. Range Sum Query - Immutable](https://github.com/zwfang/leetcode/blob/master/src/0303_range_sum_query/rsqim.go)
* [347. Top K Frequent Elements](https://github.com/zwfang/leetcode/blob/master/src/0347_top_k_frequent_elements/topkfe.go) *`hash table;`* *`heap`*
* [349. Intersection of Two Arrays](https://github.com/zwfang/leetcode/blob/master/src/0349_intersection_of_2_arrays/intersection_of_two_arrays.go) *`set`*
* [350. Intersection of Two Arrays II](https://github.com/zwfang/leetcode/blob/master/src/0350_intersection_of_two_arrays2/intersection_of_two_arrays2.go) *`hash table`*
* [447. Number of Boomerangs](https://github.com/zwfang/leetcode/blob/master/src/0447_number_of_boomerangs/number_of_boomerangs.go) *`hash table`*
* [454. 4Sum II](https://github.com/zwfang/leetcode/blob/master/src/0454_4sum2/4sum2.go) *`hash table`*
* [674. Longest Continuous Increasing Subsequence](https://github.com/zwfang/leetcode/blob/master/src/0674_longest_continuous_increasing_subsequence/lcis.go)
* [713. Subarray Product Less Than K](https://github.com/zwfang/leetcode/blob/master/src/0713_subarray_product_less_than_k/spltk.go) *`sliding window`* *`array`*
* [717. 1-bit and 2-bit Characters](https://github.com/zwfang/leetcode/blob/master/src/0717_1_bit_and_2_bit_characters/1bitand2bitc.go)
* [747. Largest Number At Least Twice of Others](https://github.com/zwfang/leetcode/blob/master/src/0747_largest_number_at_least_twice_of_others/largest_number_at_least_twice_of_others.go)
### Stack
* [155. Min Stack](https://github.com/zwfang/leetcode/blob/master/src/0155_min_stack/min_stack.go)
* [735. Asteroid Collision](https://github.com/zwfang/leetcode/blob/master/src/0735_asteroid_collision/ac.go)
### String
* [3. Longest Substring Without Repeating Characters](https://github.com/zwfang/leetcode/blob/master/src/0003_longest_substring_without_repeating_characters/longest_substring_without_repeating_characters.go) *`sliding window;`* *`hash table`*
* [14. Longest Common Prefix](https://github.com/zwfang/leetcode/blob/master/src/0014_longest_common_prefix/lcp.go)
* [17. Letter Combinations of a Phone Number](https://github.com/zwfang/leetcode/blob/master/src/0017_letter_combination_of_a_phone_number/letter_combination_of_phone_number.go) *`tree`*
* [20. Valid Parentheses](https://github.com/zwfang/leetcode/blob/master/src/0020_valid_parentheses/valid_parentheses.go) *`stack`*
* [28. Implement strStr()](https://github.com/zwfang/leetcode/blob/master/src/0028_implement_strstr/implement_strstr.go) *`double index`*
* [58. Length of Last Word](https://github.com/zwfang/leetcode/blob/master/src/0058_length_of_last_word/len_of_last_word.go)
* [67. Add Binary](https://github.com/zwfang/leetcode/blob/master/src/0067_add_binary/add_binary.go) *`brute force`*
* [76. Minimum Window Substring](https://github.com/zwfang/leetcode/blob/master/src/0076_minimum_window_substring/minimum_window_substring.go) *`sliding window`*
* [125. Valid Palindrome](https://github.com/zwfang/leetcode/blob/master/src/0125_valid_palindrome/valid_palindrome.go) *`string;`* *`double index`*
* [165. Compare Version Numbers](https://github.com/zwfang/leetcode/blob/master/src/0165_compare_version_numbers/compare_version_numbers.go)
* [344. Reverse String](https://github.com/zwfang/leetcode/blob/master/src/0344_reverse_string/reverse_string.go) *`string;`* *`double index`*
* [345. Reverse Vowels of a String](https://github.com/zwfang/leetcode/blob/master/src/0345_reverse_vowels_of_a_string/reverse_vowels.go) *`string;`* *`double index`*
* [438. Find All Anagrams in a String](https://github.com/zwfang/leetcode/blob/master/src/0438_all_anagrams_in_a_string/all_anagrams_in_a_string.go) *`sliding window`*
* [557. Reverse Words in a String III](https://github.com/zwfang/leetcode/blob/master/src/0557_reverse_words_in_a_string_3/reverse_words_in_a_string_3.go)
### Linked List
* [2. Add Two Numbers](https://github.com/zwfang/leetcode/blob/master/src/0002_add_two_numbers/add_two_numbers.go) *`recursion;`* *`math`*
* [19. Remove Nth Node From End of List](https://github.com/zwfang/leetcode/blob/master/src/0019_remove_nth_node_from_end_of_list/remove_nth_node_from_end_of_list.go) *`two pointers`*
* [21. Merge Two Sorted Lists](https://github.com/zwfang/leetcode/blob/master/src/0021_merge_two_sorted_lists/mergeTwoLists.go)
* [23. Merge k Sorted Lists](https://github.com/zwfang/leetcode/blob/master/src/0023_merge_k_sorted_lists/mksl.go) *`heap`*
* [24. Swap Nodes in Pairs](https://github.com/zwfang/leetcode/blob/master/src/0024_swap_nodes_in_pairs/swap_nodes_in_pairs.go)
* [25. Reverse Nodes in k-Group](https://github.com/zwfang/leetcode/blob/master/src/0025_reverse_nodes_in_k_group/reverse_node_k_group.go)
* [61. Rotate List](https://github.com/zwfang/leetcode/blob/master/src/0061_rotate_list/rotate_list.go)
* [82. Remove Duplicates from Sorted List II](https://github.com/zwfang/leetcode/blob/master/src/0082_remove_duplicates_from_sorted_list_2/rdfsl.go)
* [83. Remove Duplicates from Sorted List](https://github.com/zwfang/leetcode/blob/master/src/0083_remove_duplicates_from_sorted_list/rdfsl.go)
* [86. Partition List](https://github.com/zwfang/leetcode/blob/master/src/0086_partition_list/partition_list.go) *`two pointers`*
* [92. Reverse Linked List II](https://github.com/zwfang/leetcode/blob/master/src/0092_reverse_linked_list_2/reverse_linked_list2.go)
* [203. Remove Linked List Elements](https://github.com/zwfang/leetcode/blob/master/src/0203_remove_linked_list_elements/remove_linked_list_elements.go)
* [206. Reverse Linked List](https://github.com/zwfang/leetcode/blob/master/src/0206_reverse_linked_list/reverse_linked_list.go)
* [237. Delete Node in a Linked List](https://github.com/zwfang/leetcode/blob/master/src/0237_delete_node_in_a_linked_list/dniall.go)
* [328. Odd Even Linked List](https://github.com/zwfang/leetcode/blob/master/src/0328_odd_even_linked_list/odd_even_linked_list.go)
### Dynamic Programming
* [62. Unique Paths](https://github.com/zwfang/leetcode/blob/master/src/0062_unique_paths/unique_paths.go) *`array`*
* [63. Unique Paths 2](https://github.com/zwfang/leetcode/blob/master/src/0063_unique_paths_2/unique_paths2.go) *`array`*
* [64. Minimum Path Sum](https://github.com/zwfang/leetcode/blob/master/src/0064_minimum_path_sum/minimum_path_sum.go) *`array`*
* [70. Climbing Stairs](https://github.com/zwfang/leetcode/blob/master/src/0070_climbing_stairs/climbing_stairs.go)
* [120. Triangle](https://github.com/zwfang/leetcode/blob/master/src/0120_triangle/triangle.go) *`array`*
* [198. House Robber](https://github.com/zwfang/leetcode/blob/master/src/0198_house_robber/house_robber.go)
* [300. Longest Increasing Subsequence](https://github.com/zwfang/leetcode/blob/master/src/0300_longest_increasing_subsequence/lis.go)
* [343. Integer Break](https://github.com/zwfang/leetcode/blob/master/src/0343_integer_break/integer_break.go) *`math`*
* [376. Wiggle Subsequence](https://github.com/zwfang/leetcode/blob/master/src/0376_wiggle_subsequence/wiggle_subsequence.go) *`greedy;`* *`dynamic programming`*
* [416. Partition Equal Subset Sum](https://github.com/zwfang/leetcode/blob/master/src/0416_partition_equal_subset_sum/partition_equal_subset_sum.go) *`0-1 knapsack problem`*
* [435. Non-overlapping Intervals](https://github.com/zwfang/leetcode/blob/master/src/0435_non_overlapping_intervals/dp_solution.go) *`greedy;`* *`dynamic programming`* *`0-1 knapsack problem`*
### Greedy
* [392. Is Subsequence](https://github.com/zwfang/leetcode/blob/master/src/0392_is_subsequence/is_subsequence.go)
* [435. Non-overlapping Intervals](https://github.com/zwfang/leetcode/blob/master/src/0435_non_overlapping_intervals/greedy_solution.go) *`greedy;`* *`dynamic programming`*
* [455. Assign Cookies](https://github.com/zwfang/leetcode/blob/master/src/0455_assign_cookies/assign_cookies.go)
### Backtracking
* [77. Combinations](https://github.com/zwfang/leetcode/blob/master/src/0077_combinations/combinations.go) *`combine`*
* [79. Word Search](https://github.com/zwfang/leetcode/blob/master/src/0079_word_search/word_search.go) *`array`*
### Tree
* [94. Binary Tree Inorder Traversal](https://github.com/zwfang/leetcode/blob/master/src/0094_binary_tree_inorder_traversal/binary_tree_inorder_traversal.go) *`binary tree;`* *`stack`*
* [100. Same Tree](https://github.com/zwfang/leetcode/blob/master/src/0100_same_tree/same_tree.go) *`binary tree;`* *`dfs`*
* [101. Symmetric Tree](https://github.com/zwfang/leetcode/blob/master/src/0101_symmetric_tree/symmetric_tree.go) *`binary tree;`* *`dfs;`* *`bfs;`*
* [102. Binary Tree Level Order Traversal](https://github.com/zwfang/leetcode/blob/master/src/0102_binary_tree_level_order_traversal/binary_tree_level_order_traversal.go) *`binary tree;`* *`dfs`*
* [104. Maximum Depth of Binary Tree](https://github.com/zwfang/leetcode/blob/master/src/0104_maximun_depth_of_binary_tree/maxdobt.go) *`binary tree depth`*
* [107. Binary Tree Level Order Traversal II](https://github.com/zwfang/leetcode/blob/master/src/0107_binary_tree_level_order_traversal_2/binary_tree_level_order_traversal2.go) *`binary tree;`* *`bfs`*
* [111. Minimum Depth of Binary Tree](https://github.com/zwfang/leetcode/blob/master/src/0111_minimum_depth_of_binary_tree/minimum_depth_of_binary_tree.go) *`binary tree;`* *`dfs`*
* [112. Path Sum](https://github.com/zwfang/leetcode/blob/master/src/0112_path_sum/path_sum.go) *`binary tree;`* *`dfs`*
* [144. Binary Tree Preorder Traversal](https://github.com/zwfang/leetcode/blob/master/src/0144_binary_tree_preorder_traversal/binary_tree_preorder_traversal.go) *`binary tree;`* *`pre-order traversal`*
* [226. Invert Binary Tree](https://github.com/zwfang/leetcode/blob/master/src/0226_invert_binary_tree/invert_binary_tree.go) *`binary tree;`*
* [235. Lowest Common Ancestor of a Binary Search Tree](https://github.com/zwfang/leetcode/blob/master/src/0235_lowest_common_ancestor_of_a_binary_search_tree/lcaoabst.go) *`binary tree;`*
* [257. Binary Tree Paths](https://github.com/zwfang/leetcode/blob/master/src/0257_binary_tree_paths/binary_tree_paths.go) *`binary tree`*
* [404. Sum of Left Leaves](https://github.com/zwfang/leetcode/blob/master/src/0404_sum_of_left_leaves/sum_of_left_leaves.go) *`binary tree`*
* [437. Path Sum III](https://github.com/zwfang/leetcode/blob/master/src/0437_path_sum_3/path_sum_3.go) *`binary tree`*
* [872. Leaf-Similar Trees](https://github.com/zwfang/leetcode/blob/master/src/0872_leaf_similar_trees/leaf_similar_trees.go) *`binary tree`*
### Binary Search
* [33. Search in Rotated Sorted Array](https://github.com/zwfang/leetcode/blob/master/src/0033_search_in_rotated_sorted_array/search_in_rotated_sorted_array.go) *`array;`* *`binary search`*
* [34. Find First and Last Position of Element in Sorted Array](https://github.com/zwfang/leetcode/blob/master/src/0034_find_first_and_last_position_of_element_in_sorted_array/find_first_and_last_position_of_element_in_sorted_array.go) *`array;`* *`binary search`*
* [35. Search Insert Position](https://github.com/zwfang/leetcode/blob/master/src/0035_search_insert_position/search_insert_position.go) *`array;`* *`binary search`*
* [69. Sqrt(x)](https://github.com/zwfang/leetcode/blob/master/src/0069_sqrtx/sqrtx.go) *`math;`* *`binary search`*
* [153. Find Minimum in Rotated Sorted Array](https://github.com/zwfang/leetcode/blob/master/src/0153_find_minimum_in_rotated_sorted_array/fmirsa.go)
* [704. Binary Search](https://github.com/zwfang/leetcode/blob/master/src/0704_binary_search/binary_search.go)
### Math
* [7. Reverse Integer](https://github.com/zwfang/leetcode/blob/master/src/0007_reverse_integer/reverse_integer.go)
* [9. Palindrome Number](https://github.com/zwfang/leetcode/blob/master/src/0009_palindrome_number/palindrome_number.go)
* [13. Roman to Integer](https://github.com/zwfang/leetcode/blob/master/src/0013_roman_to_integer/roman_to_integer.go) *`string`*
* [66. Plus One](https://github.com/zwfang/leetcode/blob/master/src/0066_plus_one/plus_one.go) *`array`*
* [150. Evaluate Reverse Polish Notation](https://github.com/zwfang/leetcode/blob/master/src/0150_evaluate_reverse_polish_notation/evaluate_reverse_polish_notation.go) *`stack`*
* [258. Add Digits](https://github.com/zwfang/leetcode/blob/master/src/0258_add_digits/add_digits.go)
<details>
</details>
有疑问加站长微信联系(非本文作者)