diff --git a/.obsidian/plugins/obsidian-style-settings/data.json b/.obsidian/plugins/obsidian-style-settings/data.json index afb4657..cb2487c 100644 --- a/.obsidian/plugins/obsidian-style-settings/data.json +++ b/.obsidian/plugins/obsidian-style-settings/data.json @@ -1,6 +1,6 @@ { - "obsidian-prism-theme@@color-schemes-lt": "pt-color-scheme-periwinkle-lt", - "obsidian-prism-theme@@light-accent-color-preset": "pt-accent-color-purple-lt", + "obsidian-prism-theme@@color-schemes-lt": "pt-color-scheme-pistachio-lt", + "obsidian-prism-theme@@light-accent-color-preset": "pt-accent-color-green-lt", "obsidian-prism-theme@@color-schemes-dt": "pt-color-scheme-indigo-dt", "obsidian-prism-theme@@pt-disable-blur": true, "obsidian-prism-theme@@pt-disable-animations": true, diff --git a/OJ notes/OJ-index.md b/OJ notes/OJ-index.md index 834df19..ac5efad 100644 --- a/OJ notes/OJ-index.md +++ b/OJ notes/OJ-index.md @@ -33,6 +33,12 @@ This is where I store notes about CS #CS_list_need_practicing ``` +#### Topics that needs care + +- #sliding_window +- #Kadane_s_algorithm +- #greedy + ## Websites #### [leetcode.com](https://leetcode.com) diff --git a/OJ notes/pages/Leetcode Subarray-Sum-Equals-K.md b/OJ notes/pages/Leetcode Subarray-Sum-Equals-K.md index 1ea15fb..2a74981 100644 --- a/OJ notes/pages/Leetcode Subarray-Sum-Equals-K.md +++ b/OJ notes/pages/Leetcode Subarray-Sum-Equals-K.md @@ -4,11 +4,11 @@ > ##### Algorithms: > -> #algorithm #sliding_window #hash_table +> #algorithm #hash_table > > ##### Data structures: > -> #DS +> #DS #array > > ##### Difficulty: > @@ -55,13 +55,16 @@ A subarray is a contiguous **non-empty** sequence of elements within an array. ### Thoughts > [!summary] -> This can be solved using #sliding_window +> This can be solved using #prefix_sum and #hash_table > I over-complicated the solution by adding stuff like > sorting, but it turn out to be not so difficult. -Since the subsets are **contiguous**, we can use sliding -window here. +> [!tip] +> Tried using sliding window, but it doesn't work because of +> negative numbers. + + ### Solution @@ -100,4 +103,4 @@ public: return count; } }; -``` \ No newline at end of file +``` diff --git a/OJ notes/pages/Two pointers approach.md b/OJ notes/pages/Two pointers approach.md index f70a55f..0a285d9 100644 --- a/OJ notes/pages/Two pointers approach.md +++ b/OJ notes/pages/Two pointers approach.md @@ -14,13 +14,14 @@ ##### Difficulty: -#CS_analysis #difficulty- +#CS_analysis ##### Related problems: ##### Links: - [leetcode](https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/) +- [Two-pointers and sliding windows](https://leetcode.com/problems/subarray-sum-equals-k/discuss/301242/General-summary-of-what-kind-of-problem-can-cannot-solved-by-Two-Pointers) --- @@ -35,3 +36,9 @@ By using two pointers, to in place modify array elements. - There are two arrays, or linked lists - They are sorted, or operation in place will not interfere elements after. + +### When not use it? + +Refer to [this link](https://leetcode.com/problems/subarray-sum-equals-k/discuss/301242/General-summary-of-what-kind-of-problem-can-cannot-solved-by-Two-Pointers) + +#TODO: complete this section \ No newline at end of file