MCPcopy Create free account

hub / github.com/austingebauer/go-leetcode / functions

Functions430 in github.com/austingebauer/go-leetcode

FunctionbuildTree0
Initial solution, which was off. Mostly prototyping around incomplete idea.
construct_binary_tree_from_preorder_and_inorder_traversal_105/solution.go:57
FunctionbuildTree1
First attempt, getting closer, but still didn't see key to unlock solving the problem.
construct_binary_tree_from_preorder_and_inorder_traversal_105/solution.go:30
FunctioncharacterReplacement0
Note: Close but incorrect
longest_repeating_character_replacement_424/solution.go:95
FunctioncharacterReplacement1
Really close, but too slow.
longest_repeating_character_replacement_424/solution.go:30
FunctioncoinChangeBottomUp1
Version 2: Bottom-up approach using MaxInt32 for min comparison
coin_change_322/solution.go:42
FunctioncoinChangeTopDown
Version 1: Top-down approach using recursion
coin_change_322/solution.go:72
FunctioneraseOverlapIntervals0
Initial solution, which failed to recognize that the removal order isn't necessarily a part of the start sorted sequence.
non_overlapping_intervals_435/solution.go:86
FunctioneraseOverlapIntervals1
Second solution, which is correct but time limit exceeded.
non_overlapping_intervals_435/solution.go:45
Functionexplore1
This approach is slow (exponential runtime). It works, but times out on leetcode. We can do better.
longest_increasing_subsequence_300/solution.go:99
Functionexplore2
This approach is also slow (O(2^n) runtime. It works, but times out on leetcode. We can do better.
longest_increasing_subsequence_300/solution.go:82
FunctiongroupAnagrams0
Note: Wrong approach. Good lessons though!
group_anagrams_49/solution.go:72
FunctiongroupAnagrams1
Second solution based on sorting the strings
group_anagrams_49/solution.go:42
Functioninsert0
Note: good attempt with 152 / 154 test cases passed. This got messy. Tried to merge newInterval into intervals. Can do better!
insert_interval_57/solution.go:82
FunctionisSymmetricWrong
Based on in-order traversal being a palindrome. Wrong approach but good lesson on array appending in recursive function.
symmetric_tree_101/solution.go:39
FunctionlengthOfLISOther
(nums []int)
longest_increasing_subsequence_300/solution.go:35
FunctionlevelOrder0
Note: study again.
binary_tree_level_order_traversal_102/solution.go:45
FunctionlongestCommonSubsequence1
Note: first attempt that passed test cases in description examples. Isn't correct in all cases.
longest_common_subsequence_1143/solution.go:80
FunctionmaxProduct0
First, O(n^2) solution.
maximum_product_subarray_152/solution.go:29
Functionmerge0
First solution
merge_intervals_56/solution.go:38
Functionmerge0
Note: original solution with array shifting
merge_sorted_array_88/solution.go:56
Functionmerge2
Note: solution from rotate_string_796 interview that stumped me for a bit. Wanted to solve without shifting and was tricky.
merge_sorted_array_88/solution.go:24
FunctionmergeTwoLists1
(l1 *ListNode, l2 *ListNode)
merge_two_sorted_lists_21/solution.go:32
FunctionminWindow0
Initial solution. Pretty close, but overly complicated and assumed that duplicates of t were not allowed, meaning the substring of s must have exactly
minimum_window_substring_76/solution.go:59
FunctionmoveZeroes2
(nums []int)
move_zeroes_283/solution.go:19
FunctionreverseList1
Reverses the passed list without creating a new list by prepending front nodes to the end.
reverse_linked_list_206/solution.go:34
FunctionreverseStrOrig
Note: original solution from mock interview. I learned how to reverse string in place by using []rune or []byte. Having to reverse by string concatena
reverse_string_ii_541/solution.go:32
Functionsearch0
Note: Study again
search_in_rotated_sorted_array_33/solution.go:77
FunctionsetZeroes1
Note: this was accepted into leetcode and uses O(1) space. There is a different solution that was hinted at that works better with ALL input. This alg
set_matrix_zeros_73/solution.go:65
FunctionthreeSum0
(nums []int)
three_sum_15/solution.go:50
FunctiontwoSumSortedInput
twoSumSortedInput assumes that nums is sorted.
two_sum_1/solution.go:25
← previous401–430 of 430, ranked by callers