-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
89 lines (75 loc) · 2.2 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package main
import (
"fmt"
"personalfile.app/yao/project_go/dsa/binaryops"
)
func main() {
// dsa.AppendSlices()
// fmt.Println(dsa.ReturnNumOfArray([]int{3, 5, 6, 7}))
// concurrency.Goroutine()
/*
* Topic: Array
*/
// array.RemoveDuplicate([]int{1, 1, 2})
// array.RemoveElement([]int{0, 1, 2, 2, 3, 0, 4, 2}, 2)
// array.BinarySearch([]int{-1, 0, 3, 5, 9, 12}, 9)
// array.MaxProfit([]int{7, 1, 5, 3, 6, 4})
// array.MaxProfitSolution2([]int{7, 1, 5, 3, 6, 4})
// array.MaxProfitSolution3([]int{7, 1, 5, 3, 6, 4})
// array.SortedSquares([]int{-4, -1, 0, 3, 10})
// array.MinSubArrayLen([]int{1, 1, 1}, 4)
// array.GenerateMatrix(3)
// array.ProductExceptSelf([]int{1, 2, 3, 4})
// array.ProductExceptSelfApproach2([]int{1, 2, 3, 4})
// array.MaximumSubarray([]int{-2, 2, 5, -11, 6})
// array.MaximumSubarrayApproach2([]int{-2, 2, 5, -11, 6})
/*
* Topic: Sorting
*/
// sorting.SortedSquares([]int{-4, -1, 0, 3, 10})
/*
* Topic: Searching
*/
// searching.SearchInRotatedSortedArray([]int{4, 5, 6, 7, 0, 1, 2}, 0)
/*
* Topic: String
*/
// str.ReverseString([]byte{0x48, 0x65, 0x6c, 0x6c, 0x6f})
// str.ReverseString2("hello", 2)
// str.ValidAnagram("race", "care")
// str.ValidAnagramApproach2("race", "care")
// str.ValidAnagramApproach3("race", "care")
// str.ValidPalindrome("!043XjqjX043!")
// str.ReverseWords("the y blue is sky")
// str.ReverseWords2(" the y blue is sky")
// str.RepeatedSubstringPattern("aba")
// str.RepeatedSubstringPatternApproach2("aabbccaabbcc")
// str.StrStr("sadbutsad", "sad")
/*
* Topic: Linked List
*/
// head := linkedlist.CreateLinkedList([]int{1, 2, 6, 3, 4, 5, 6})
// linkedlist.PrintList(linkedlist.RemoveElements(head, 6))
// head := linkedlist.CreateLinkedList([]int{1, 2, 3, 4, 5})
// linkedlist.ReverseLinkedList(head)
// linkedlist.ReverseLinkedListRecursively(head)
// linkedlist.HasCycle(head)
// linkedlist.HasCycleApproach2(head)
/*
* Topic: Hash Table
*/
// hashtable.TwoSumApproach3([]int{2, 3, 5, 7}, 9)
/*
* Topic: Queue
*/
// queue.ImplementStackUsingQueues()
/*
* Topic: Stack
*/
// stack.ImplementQueueUsingStacks()
/*
* Topic: Binary
*/
ans := binaryops.BinaryGap(22)
fmt.Println(ans)
}