-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
226 lines (192 loc) · 10.4 KB
/
CMakeLists.txt
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
cmake_minimum_required(VERSION 3.21)
project(dsa)
find_program(CCACHE_PROGRAM ccache)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
if(CCACHE_PROGRAM)
MESSAGE("CCACHE support enabled")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
endif()
set(CMAKE_C_STANDARD 20)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_BUILD_TYPE "Debug")
#add_compile_options(-fsanitize=address)
#add_compile_options(-fsanitize=undefined)
#add_compile_options(-fsanitize=leak)
# add_compile_definitions(DEBUG)
function(add_code name path)
add_executable(${name} ${path})
target_link_libraries(${name})
target_include_directories(${name} PRIVATE src/)
target_compile_definitions(${name} PRIVATE DEBUG=1)
endfunction()
set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
add_code(HelloWorld "src/HelloWorld.cpp")
#add_code(BW94_Q1 "src/leetcode/biweekly/BW94/BW94_Q1.cpp")
#add_code(BW94_Q2 "src/leetcode/biweekly/BW94/BW94_Q2.cpp")
#add_code(BW94_Q3 "src/leetcode/biweekly/BW94/BW94_Q3.cpp")
#add_code(BW94_Q4 "src/leetcode/biweekly/BW94/BW94_Q4.cpp")
#add_code(W325_Q1 "src/leetcode/weekly/W325/W325_Q1.cpp")
#add_code(W325_Q2 "src/leetcode/weekly/W325/W325_Q2.cpp")
#add_code(W325_Q3 "src/leetcode/weekly/W325/W325_Q3.cpp")
#add_code(W325_Q4 "src/leetcode/weekly/W325/W325_Q4.cpp")
#add_code(W326_Q1 "src/leetcode/weekly/W326/W326_Q1.cpp")
#add_code(W326_Q2 "src/leetcode/weekly/W326/W326_Q2.cpp")
#add_code(W326_Q3 "src/leetcode/weekly/W326/W326_Q3.cpp")
#add_code(W326_Q4 "src/leetcode/weekly/W326/W326_Q4.cpp")
#add_code(W352_Q1 "src/leetcode/weekly/W352/W352_Q1.cpp")
#add_code(W352_Q2 "src/leetcode/weekly/W352/W352_Q2.cpp")
#add_code(W352_Q3 "src/leetcode/weekly/W352/W352_Q3.cpp")
#add_code(W352_Q4 "src/leetcode/weekly/W352/W352_Q4.cpp")
add_code(W361_Q1 "src/leetcode/weekly/W361/W361_Q1.cpp")
add_code(W361_Q2 "src/leetcode/weekly/W361/W361_Q2.cpp")
add_code(W361_Q3 "src/leetcode/weekly/W361/W361_Q3.cpp")
add_code(W361_Q4 "src/leetcode/weekly/W361/W361_Q4.cpp")
add_code(W366_Q1 "src/leetcode/weekly/W366/W366_Q1.cpp")
add_code(W366_Q2 "src/leetcode/weekly/W366/W366_Q2.cpp")
add_code(W366_Q3 "src/leetcode/weekly/W366/W366_Q3.cpp")
add_code(W366_Q4 "src/leetcode/weekly/W366/W366_Q4.cpp")
add_code(BW109_Q1 "src/leetcode/biweekly/BW109/BW109_Q1.cpp")
add_code(BW109_Q2 "src/leetcode/biweekly/BW109/BW109_Q2.cpp")
add_code(BW109_Q3 "src/leetcode/biweekly/BW109/BW109_Q3.cpp")
add_code(BW109_Q4 "src/leetcode/biweekly/BW109/BW109_Q4.cpp")
add_code(BW114_Q1 "src/leetcode/biweekly/BW114/BW114_Q1.cpp")
add_code(BW114_Q2 "src/leetcode/biweekly/BW114/BW114_Q2.cpp")
add_code(BW114_Q3 "src/leetcode/biweekly/BW114/BW114_Q3.cpp")
add_code(BW114_Q4 "src/leetcode/biweekly/BW114/BW114_Q4.cpp")
add_code(BW116_Q1 "src/leetcode/biweekly/BW116/BW116_Q1.cpp")
add_code(BW116_Q2 "src/leetcode/biweekly/BW116/BW116_Q2.cpp")
add_code(BW116_Q3 "src/leetcode/biweekly/BW116/BW116_Q3.cpp")
add_code(BW116_Q4 "src/leetcode/biweekly/BW116/BW116_Q4.cpp")
# Swiggy
add_code(SW_Q1 "src/swiggy/SW_Q1.cpp")
add_code(SW_Q2 "src/swiggy/SW_Q2.cpp")
#Array
add_code(TwoSum "src/patterns/array/TwoSum.cpp")
add_code(BuySellStocks "src/patterns/array/BuySellStocks.cpp")
add_code(MajorityElement "src/patterns/array/MajorityElement.cpp")
add_code(ContainsDuplicate "src/patterns/array/ContainsDuplicate.cpp")
add_code(MeetingRooms "src/patterns/array/MeetingRooms.cpp")
add_code(MoveZeros "src/patterns/array/MoveZeros.cpp")
add_code(SortedSquares "src/patterns/array/SortedSquares.cpp")
add_code(InsertInterval "src/patterns/array/InsertInterval.cpp")
add_code(ThreeSum "src/patterns/array/ThreeSum.cpp")
add_code(ProductExceptSelf "src/patterns/array/ProductExceptSelf.cpp")
add_code(CombinationSum "src/patterns/array/CombinationSum.cpp")
add_code(MergeIntervals "src/patterns/array/MergeIntervals.cpp")
add_code(SortColors "src/patterns/array/SortColors.cpp")
add_code(MaxArea "src/patterns/array/MaxArea.cpp")
add_code(GasStation "src/patterns/array/GasStation.cpp")
add_code(LCS "src/patterns/array/LCS.cpp")
add_code(RotateArray "src/patterns/array/RotateArray.cpp")
add_code(ContiguousArray "src/patterns/array/ContiguousArray.cpp")
add_code(SubArraySumK "src/patterns/array/SubArraySumK.cpp")
add_code(MeetingRooms2 "src/patterns/array/MeetingRooms2.cpp")
#Stack
add_code(ValidParentheses "src/patterns/stack/ValidParentheses.cpp")
add_code(AddBinary "src/patterns/binary/AddBinary.cpp")
add_code(FindDuplicateNumber "src/patterns/binary/FindDuplicateNumber.cpp")
add_code(CountingBits "src/patterns/binary/CountingBits.cpp")
add_code(HammingWeight "src/patterns/binary/HammingWeight.cpp")
add_code(ReverseBits "src/patterns/binary/ReverseBits.cpp")
add_code(SingleNumber "src/patterns/binary/SingleNumber.cpp")
add_code(MissingNumber "src/patterns/binary/MissingNumber.cpp")
add_code(MaximumSubarray "src/patterns/dp/MaximumSubarray.cpp")
add_code(CoinChange "src/patterns/dp/CoinChange.cpp")
add_code(ClimbingStairs "src/patterns/dp/ClimbingStairs.cpp")
add_code(PartitionEqualSubsetSum "src/patterns/dp/PartitionEqualSubsetSum.cpp")
add_code(UniquePaths "src/patterns/dp/UniquePaths.cpp")
add_code(HouseRobber "src/patterns/dp/HouseRobber.cpp")
add_code(MaximumProductSubarray "src/patterns/dp/MaximumProductSubarray.cpp")
add_code(LongestIncreasingSubsequence "src/patterns/dp/LongestIncreasingSubsequence.cpp")
add_code(JumpGame "src/patterns/dp/JumpGame.cpp")
add_code(MaximalSquare "src/patterns/dp/MaximalSquare.cpp")
add_code(DecodeWays "src/patterns/dp/DecodeWays.cpp")
add_code(CombinationSumIV "src/patterns/dp/CombinationSumIV.cpp")
add_code(RansomNote "src/patterns/hash/RansomNote.cpp")
add_code(InsertDeleteGetRandom "src/patterns/hash/InsertDeleteGetRandom.cpp")
# STRINGS
add_code(ValidPalindrome "src/patterns/string/ValidPalindrome.cpp")
add_code(ValidAnagram "src/patterns/string/ValidAnagram.cpp")
add_code(LongestSubtring "src/patterns/string/LongestSubtring.cpp")
add_code(LongestPalindrome "src/patterns/string/LongestPalindrome.cpp")
add_code(StringToInteger "src/patterns/string/StringToInteger.cpp")
add_code(LongestPalindromicSubstring "src/patterns/string/LongestPalindromicSubstring.cpp")
add_code(FindAnagrams "src/patterns/string/FindAnagrams.cpp")
add_code(GroupAnagrams "src/patterns/string/GroupAnagrams.cpp")
add_code(CharacterReplacement "src/patterns/string/CharacterReplacement.cpp")
add_code(LargestNumber "src/patterns/string/LargestNumber.cpp")
#add_code(EncodeDecodeString "src/patterns/string/EncodeDecodeString.cpp")
add_code(LongestCommonPrefix "src/patterns/string/LongestCommonPrefix.cpp")
add_code(RomanToInteger "src/patterns/math/RomanToInteger.cpp")
add_code(PalindromeNumber "src/patterns/math/PalindromeNumber.cpp")
add_code(RandomPickWeight "src/patterns/math/RandomPickWeight.cpp")
add_code(ReverseInteger "src/patterns/math/ReverseInteger.cpp")
add_code(Pow "src/patterns/math/Pow.cpp")
add_code(HitCounter "src/patterns/queue/HitCounter.cpp")
add_code(SpiralMatrix "src/patterns/matrix/SpiralMatrix.cpp")
add_code(RotateImage "src/patterns/matrix/RotateImage.cpp")
add_code(SetMatrixZeroes "src/patterns/matrix/SetMatrixZeroes.cpp")
#Lists
add_code(MergeTwoSortedLists "src/patterns/list/MergeTwoSortedLists.cpp")
add_code(LinkedListCycle "src/patterns/list/LinkedListCycle.cpp")
add_code(ReverseLinkedList "src/patterns/list/ReverseLinkedList.cpp")
add_code(MiddleLinkedList "src/patterns/list/MiddleLinkedList.cpp")
add_code(LRUCache "src/patterns/list/LRUCache.cpp")
add_code(RemoveNthEndList "src/patterns/list/RemoveNthEndList.cpp")
add_code(SwapAlternateNodes "src/patterns/list/SwapAlternateNodes.cpp")
add_code(OddEvenLinkedList "src/patterns/list/OddEvenLinkedList.cpp")
add_code(AddTwoNumbersList "src/patterns/list/AddTwoNumbersList.cpp")
add_code(SortLinkedList "src/patterns/list/SortLinkedList.cpp")
add_code(PalindromeLinkedList "src/patterns/list/PalindromeLinkedList.cpp")
add_code(ReorderList "src/patterns/list/ReorderList.cpp")
add_code(RotateRightList "src/patterns/list/RotateRightList.cpp")
#Binary Search
add_code(BinarySearch "src/patterns/bsearch/BinarySearch.cpp")
#Heap
add_code(KClosestPoints "src/patterns/heap/KClosestPoints.cpp")
add_code(MedianFinder "src/patterns/heap/MedianFinder.cpp")
add_code(MergeKLists "src/patterns/heap/MergeKLists.cpp")
add_code(TaskScheduler "src/patterns/heap/TaskScheduler.cpp")
add_code(KFrequentWords "src/patterns/heap/KFrequentWords.cpp")
add_code(KClosestElements "src/patterns/heap/KClosestElements.cpp")
add_code(KthLargest "src/patterns/heap/KthLargest.cpp")
#Tree
add_code(InvertBinaryTree "src/patterns/tree/InvertBinaryTree.cpp")
add_code(BalancedBinaryTree "src/patterns/tree/BalancedBinaryTree.cpp")
add_code(DiameterBinaryTree "src/patterns/tree/DiameterBinaryTree.cpp")
add_code(LevelOrderTraversal "src/patterns/tree/LevelOrderTraversal.cpp")
add_code(LCA "src/patterns/tree/LCA.cpp")
add_code(BTreeSerialize "src/patterns/tree/BTreeSerialize.cpp")
add_code(BTRightView "src/patterns/tree/BTRightView.cpp")
add_code(BTMaxDepth "src/patterns/tree/BTMaxDepth.cpp")
add_code(SameTree "src/patterns/tree/SameTree.cpp")
add_code(SymmetricTree "src/patterns/tree/SymmetricTree.cpp")
add_code(SubTree "src/patterns/tree/SubTree.cpp")
add_code(BuildTree "src/patterns/tree/BuildTree.cpp")
add_code(PathSum2 "src/patterns/tree/PathSum2.cpp")
add_code(BTMaxWidth "src/patterns/tree/BTMaxWidth.cpp")
add_code(BTZigZag "src/patterns/tree/BTZigZag.cpp")
add_code(PathSum3 "src/patterns/tree/PathSum3.cpp")
#BST
add_code(BSTreeLCA "src/patterns/bst/BSTreeLCA.cpp")
#Graph
add_code(FloodFill "src/patterns/graph/FloodFill.cpp")
add_code(01Matrix "src/patterns/graph/01Matrix.cpp")
add_code(CloneGraph "src/patterns/graph/CloneGraph.cpp")
add_code(CourseSchedule "src/patterns/graph/CourseSchedule.cpp")
add_code(CourseSchedule2 "src/patterns/graph/CourseSchedule2.cpp")
add_code(NumberOfIslands "src/patterns/graph/NumberOfIslands.cpp")
add_code(RottingOranges "src/patterns/graph/RottingOranges.cpp")
add_code(WordSearch "src/patterns/graph/WordSearch.cpp")
add_code(AccountsMerge "src/patterns/graph/AccountsMerge.cpp")
add_code(GraphComponentCount "src/patterns/graph/GraphComponentCount.cpp")
add_code(MinimumHeightTree "src/patterns/graph/MinimumHeightTree.cpp")
add_code(WaterFlow "src/patterns/graph/WaterFlow.cpp")
add_code(ShortestpathToFood "src/patterns/graph/ShortestpathToFood.cpp")
add_code(GraphValidTree "src/patterns/graph/GraphValidTree.cpp")