From c67841fe07d29ab03315f9815f6b818d017cab3c Mon Sep 17 00:00:00 2001 From: Wong Ding Feng Date: Fri, 5 Jun 2026 22:32:49 +0800 Subject: [PATCH] upd --- org/study_deck_02/.dir-locals.el | 5 +- org/study_deck_02/add-lc-problem.py | 74 +++++++++++++++++++ .../0005-longest-palindromic-substring.org | 4 +- .../0070-climbing-stairs.org | 4 +- .../0091-decode-ways.org | 4 +- .../0139-word-break.org | 4 +- .../0152-maximum-product-subarray.org | 4 +- .../0198-house-robber.org | 4 +- .../0213-house-robber-ii.org | 4 +- .../0300-longest-increasing-subsequence.org | 4 +- .../0322-coin-change.org | 4 +- .../0416-partition-equal-subset-sum.org | 4 +- .../0647-palindromic-substrings.org | 4 +- .../0656-coin-path.org | 4 +- .../0746-min-cost-climbing-stairs.org | 4 +- .../0010-regular-expression-matching.org | 4 +- .../0062-unique-paths.org | 4 +- .../0072-edit-distance.org | 4 +- .../0097-interleaving-string.org | 4 +- .../0115-distinct-subsequences.org | 4 +- ...me-to-buy-and-sell-stock-with-cooldown.org | 4 +- .../0312-burst-balloons.org | 4 +- ...29-longest-increasing-path-in-a-matrix.org | 4 +- .../0494-target-sum.org | 4 +- .../0518-coin-change-ii.org | 4 +- .../1143-longest-common-subsequence.org | 4 +- .../1220-count-vowels-permutation.org | 4 +- ...11-maximum-alternating-subsequence-sum.org | 4 +- .../advanced-graphs/0269-alien-dictionary.org | 4 +- .../0332-reconstruct-itinerary.org | 4 +- .../0743-network-delay-time.org | 4 +- .../0778-swim-in-rising-water.org | 4 +- .../0787-cheapest-flights-within-k-stops.org | 4 +- .../1584-min-cost-to-connect-all-points.org | 4 +- ...odes-into-the-maximum-number-of-groups.org | 4 +- .../2812-find-the-safest-path-in-a-grid.org | 4 +- .../dsa/arrays-hashing/0001-two-sum.org | 4 +- .../dsa/arrays-hashing/0036-valid-sudoku.org | 4 +- .../arrays-hashing/0049-group-anagrams.org | 4 +- .../0128-longest-consecutive-sequence.org | 4 +- .../0217-contains-duplicate.org | 4 +- .../0238-product-of-array-except-self.org | 4 +- .../dsa/arrays-hashing/0242-valid-anagram.org | 4 +- .../0271-encode-and-decode-strings.org | 4 +- .../0347-top-k-frequent-elements.org | 2 +- .../1408-string-matching-in-an-array.org | 4 +- ...erations-to-move-all-balls-to-each-box.org | 4 +- .../2678-number-of-senior-citizens.org | 4 +- ...-letter-combinations-of-a-phone-number.org | 4 +- .../0022-generate-parentheses.org | 4 +- .../dsa/backtracking/0039-combination-sum.org | 4 +- .../backtracking/0040-combination-sum-ii.org | 4 +- .../dsa/backtracking/0046-permutations.org | 4 +- .../dsa/backtracking/0051-n-queens.org | 4 +- .../dsa/backtracking/0052-n-queens-ii.org | 4 +- .../dsa/backtracking/0077-combinations.org | 4 +- .../dsa/backtracking/0078-subsets.org | 4 +- .../dsa/backtracking/0079-word-search.org | 4 +- .../dsa/backtracking/0090-subsets-ii.org | 4 +- .../0131-palindrome-partitioning.org | 4 +- .../0351-android-unlock-patterns.org | 4 +- .../1079-letter-tile-possibilities.org | 4 +- .../1863-sum-of-all-subsets-xor-total.org | 4 +- .../0004-median-of-two-sorted-arrays.org | 4 +- .../0033-search-in-rotated-sorted-array.org | 4 +- .../binary-search/0074-search-a-2d-matrix.org | 4 +- ...3-find-minimum-in-rotated-sorted-array.org | 4 +- .../dsa/binary-search/0704-binary-search.org | 4 +- .../0719-find-k-th-smallest-pair-distance.org | 4 +- .../0875-koko-eating-bananas.org | 4 +- .../0981-time-based-key-value-store.org | 4 +- ...successful-pairs-of-spells-and-potions.org | 4 +- .../bit-manipulation/0007-reverse-integer.org | 4 +- .../bit-manipulation/0136-single-number.org | 4 +- .../bit-manipulation/0190-reverse-bits.org | 4 +- .../0191-number-of-1-bits.org | 4 +- .../bit-manipulation/0231-power-of-two.org | 4 +- .../0260-single-number-iii.org | 4 +- .../bit-manipulation/0268-missing-number.org | 4 +- .../bit-manipulation/0338-counting-bits.org | 4 +- .../0371-sum-of-two-integers.org | 4 +- ...20-minimum-bit-flips-to-convert-number.org | 4 +- .../dsa/graphs/0127-word-ladder.org | 4 +- .../dsa/graphs/0130-surrounded-regions.org | 4 +- .../dsa/graphs/0133-clone-graph.org | 4 +- .../dsa/graphs/0200-number-of-islands.org | 4 +- .../dsa/graphs/0207-course-schedule.org | 4 +- .../dsa/graphs/0210-course-schedule-ii.org | 4 +- .../dsa/graphs/0261-graph-valid-tree.org | 4 +- .../dsa/graphs/0286-walls-and-gates.org | 4 +- ...cted-components-in-an-undirected-graph.org | 4 +- .../0417-pacific-atlantic-water-flow.org | 4 +- .../dsa/graphs/0684-redundant-connection.org | 4 +- .../dsa/graphs/0695-max-area-of-island.org | 4 +- .../graphs/0802-find-eventual-safe-states.org | 4 +- .../dsa/graphs/0994-rotting-oranges.org | 4 +- .../dsa/graphs/1905-count-sub-islands.org | 4 +- .../2092-find-all-people-with-secret.org | 4 +- .../2658-maximum-number-of-fish-in-a-grid.org | 4 +- .../dsa/graphs/2924-find-champion-ii.org | 4 +- .../dsa/greedy/0045-jump-game-ii.org | 4 +- .../dsa/greedy/0053-maximum-subarray.org | 4 +- .../dsa/greedy/0055-jump-game.org | 4 +- .../dsa/greedy/0134-gas-station.org | 4 +- .../greedy/0678-valid-parenthesis-string.org | 4 +- .../dsa/greedy/0763-partition-labels.org | 4 +- .../dsa/greedy/0846-hand-of-straights.org | 4 +- ...minimum-increment-to-make-array-unique.org | 4 +- .../0978-longest-turbulent-subarray.org | 4 +- .../dsa/greedy/1871-jump-game-vii.org | 4 +- ...-merge-triplets-to-form-target-triplet.org | 4 +- .../0215-kth-largest-element-in-an-array.org | 4 +- .../0295-find-median-from-data-stream.org | 4 +- .../0355-design-twitter.org | 4 +- .../0621-task-scheduler.org | 4 +- .../0703-kth-largest-element-in-a-stream.org | 4 +- .../0973-k-closest-points-to-origin.org | 4 +- .../1046-last-stone-weight.org | 4 +- .../dsa/intervals/0056-merge-intervals.org | 4 +- .../dsa/intervals/0057-insert-interval.org | 4 +- .../dsa/intervals/0252-meeting-rooms.org | 4 +- .../dsa/intervals/0253-meeting-rooms-ii.org | 4 +- .../0435-non-overlapping-intervals.org | 4 +- .../0986-interval-list-intersections.org | 4 +- ...minimum-interval-to-include-each-query.org | 4 +- .../dsa/linked-list/0002-add-two-numbers.org | 4 +- .../0019-remove-nth-node-from-end-of-list.org | 4 +- .../0021-merge-two-sorted-lists.org | 4 +- .../linked-list/0023-merge-k-sorted-lists.org | 4 +- .../0025-reverse-nodes-in-k-group.org | 4 +- .../0138-copy-list-with-random-pointer.org | 4 +- .../linked-list/0141-linked-list-cycle.org | 4 +- .../dsa/linked-list/0143-reorder-list.org | 4 +- .../dsa/linked-list/0146-lru-cache.org | 4 +- .../linked-list/0206-reverse-linked-list.org | 4 +- .../0287-find-the-duplicate-number.org | 4 +- .../0725-split-linked-list-in-parts.org | 4 +- .../1472-design-browser-history.org | 4 +- .../1721-swapping-nodes-in-a-linked-list.org | 4 +- .../2487-remove-nodes-from-linked-list.org | 4 +- .../math-geometry/0009-palindrome-number.org | 4 +- .../math-geometry/0012-integer-to-roman.org | 4 +- .../math-geometry/0043-multiply-strings.org | 4 +- .../dsa/math-geometry/0048-rotate-image.org | 4 +- .../dsa/math-geometry/0050-pow-x-n.org | 4 +- .../dsa/math-geometry/0054-spiral-matrix.org | 4 +- .../dsa/math-geometry/0066-plus-one.org | 4 +- .../math-geometry/0073-set-matrix-zeroes.org | 4 +- .../dsa/math-geometry/0202-happy-number.org | 4 +- .../math-geometry/0296-best-meeting-point.org | 4 +- .../0840-magic-squares-in-grid.org | 4 +- ...-if-number-is-a-sum-of-powers-of-three.org | 4 +- .../dsa/math-geometry/2013-detect-squares.org | 4 +- .../math-geometry/2326-spiral-matrix-iv.org | 4 +- ...nd-the-punishment-number-of-an-integer.org | 4 +- ...substring-without-repeating-characters.org | 4 +- .../0076-minimum-window-substring.org | 4 +- .../0121-best-time-to-buy-and-sell-stock.org | 4 +- .../0239-sliding-window-maximum.org | 4 +- ...ongest-repeating-character-replacement.org | 4 +- .../0567-permutation-in-string.org | 4 +- ...aining-every-vowel-and-k-consonants-ii.org | 4 +- .../dsa/stack/0020-valid-parentheses.org | 4 +- .../0084-largest-rectangle-in-histogram.org | 4 +- .../0150-evaluate-reverse-polish-notation.org | 4 +- .../dsa/stack/0155-min-stack.org | 4 +- .../dsa/stack/0682-baseball-game.org | 4 +- .../dsa/stack/0726-number-of-atoms.org | 4 +- .../dsa/stack/0739-daily-temperatures.org | 4 +- .../dsa/stack/0853-car-fleet.org | 4 +- .../dsa/stack/0901-online-stock-span.org | 4 +- .../dsa/stack/1544-make-the-string-great.org | 4 +- .../0098-validate-binary-search-tree.org | 4 +- .../dsa/trees/0100-same-tree.org | 4 +- ...0102-binary-tree-level-order-traversal.org | 4 +- .../0104-maximum-depth-of-binary-tree.org | 4 +- ...ee-from-preorder-and-inorder-traversal.org | 4 +- .../dsa/trees/0110-balanced-binary-tree.org | 4 +- .../0124-binary-tree-maximum-path-sum.org | 4 +- .../0199-binary-tree-right-side-view.org | 4 +- .../dsa/trees/0226-invert-binary-tree.org | 4 +- .../0230-kth-smallest-element-in-a-bst.org | 4 +- ...ommon-ancestor-of-a-binary-search-tree.org | 4 +- ...-serialize-and-deserialize-binary-tree.org | 4 +- .../trees/0543-diameter-of-binary-tree.org | 4 +- .../trees/0572-subtree-of-another-tree.org | 4 +- .../0590-n-ary-tree-postorder-traversal.org | 4 +- ...recover-a-tree-from-preorder-traversal.org | 4 +- ...76-time-needed-to-inform-all-employees.org | 4 +- .../1448-count-good-nodes-in-binary-tree.org | 4 +- .../tries/0208-implement-trie-prefix-tree.org | 4 +- ...gn-add-and-search-words-data-structure.org | 4 +- .../dsa/tries/0212-word-search-ii.org | 4 +- .../dsa/tries/1166-design-file-system.org | 4 +- .../0011-container-with-most-water.org | 4 +- .../dsa/two-pointers/0015-3sum.org | 4 +- .../two-pointers/0042-trapping-rain-water.org | 4 +- .../two-pointers/0125-valid-palindrome.org | 4 +- .../0167-two-sum-ii-input-array-is-sorted.org | 4 +- .../dsa/two-pointers/0259-3sum-smaller.org | 4 +- .../dsa/two-pointers/0344-reverse-string.org | 4 +- org/study_deck_02/lc-org.el | 28 ++++++- 202 files changed, 498 insertions(+), 403 deletions(-) create mode 100644 org/study_deck_02/add-lc-problem.py diff --git a/org/study_deck_02/.dir-locals.el b/org/study_deck_02/.dir-locals.el index 94f0656..74db2f8 100644 --- a/org/study_deck_02/.dir-locals.el +++ b/org/study_deck_02/.dir-locals.el @@ -1,4 +1,5 @@ ((org-mode . ((org-todo-keywords . ((sequence "TODO" | "DONE" "TOO_EASY"))) (eval . (let ((lc-el (expand-file-name "lc-org.el" (dir-locals-find-file default-directory)))) - (when (and lc-el (file-exists-p lc-el) (not (featurep 'lc-org))) - (load-file lc-el))))))) + (when (and lc-el (file-exists-p lc-el)) + (load-file lc-el) + (lc-org-mode 1))))))) diff --git a/org/study_deck_02/add-lc-problem.py b/org/study_deck_02/add-lc-problem.py new file mode 100644 index 0000000..95a0b8f --- /dev/null +++ b/org/study_deck_02/add-lc-problem.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Add :lc-problem to org source blocks in leetcode problem files.""" + +import re +import sys +from pathlib import Path + + +def process_file(path: Path, dry_run: bool = False) -> bool: + """Add :lc-problem to src blocks that don't already have it. Returns True if modified.""" + m = re.match(r"(\d{4})-", path.stem) + if not m: + return False + problem_num = str(int(m.group(1))) # strip leading zeros: "0015" -> "15" + + text = path.read_text() + original = text + + # Match #+begin_src where lang is python or cpp + def fix_src_block(match: re.Match) -> str: + full = match.group(0) + lang = match.group(1) + suffix = match.group(2) or "" + + # If already has :lc-problem, fix leading zeros + if ":lc-problem" in suffix: + suffix = re.sub(r":lc-problem 0+(\d)", rf":lc-problem \1", suffix) + return f"#+begin_src {lang}{suffix}" + + # Add :lc-problem + extra = f" :lc-problem {problem_num}" + if lang == "python": + extra += " :lc-lang python3" + return f"#+begin_src {lang}{extra}{suffix}" + + text = re.sub( + r"#\+begin_src (python|cpp)([^\n]*)", + fix_src_block, + text, + ) + + if text != original: + if dry_run: + print(f" would modify: {path.name}") + else: + path.write_text(text) + print(f" modified: {path.name}") + return True + return False + + +def main(): + dry_run = "--dry-run" in sys.argv + base = Path(__file__).parent / "dsa" + if not base.exists(): + print(f"dsa/ directory not found at {base}") + sys.exit(1) + + org_files = sorted(base.rglob("*.org")) + print(f"Found {len(org_files)} org files in dsa/") + + modified = 0 + skipped = 0 + for f in org_files: + if process_file(f, dry_run): + modified += 1 + else: + skipped += 1 + + print(f"\nDone: {modified} modified, {skipped} unchanged") + + +if __name__ == "__main__": + main() diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0005-longest-palindromic-substring.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0005-longest-palindromic-substring.org index 3410026..8d22404 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0005-longest-palindromic-substring.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0005-longest-palindromic-substring.org @@ -35,13 +35,13 @@ Output: "bb" Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 5 :lc-lang python3 class Solution: def longestPalindrome(self, s: str) -> str: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 5 class Solution { public: string longestPalindrome(string s) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0070-climbing-stairs.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0070-climbing-stairs.org index 17d125f..92ee602 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0070-climbing-stairs.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0070-climbing-stairs.org @@ -41,13 +41,13 @@ Explanation: There are three ways to climb to the top. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 70 :lc-lang python3 class Solution: def climbStairs(self, n: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 70 class Solution { public: int climbStairs(int n) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0091-decode-ways.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0091-decode-ways.org index 822751d..b774af8 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0091-decode-ways.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0091-decode-ways.org @@ -72,13 +72,13 @@ The test cases are generated so that the answer fits in a *32-bit* integer. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 91 :lc-lang python3 class Solution: def numDecodings(self, s: str) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 91 class Solution { public: int numDecodings(string s) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0139-word-break.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0139-word-break.org index 1c11db6..b83fa2e 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0139-word-break.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0139-word-break.org @@ -54,13 +54,13 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 139 :lc-lang python3 class Solution: def wordBreak(self, s: str, wordDict: List[str]) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 139 class Solution { public: bool wordBreak(string s, vector& wordDict) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0152-maximum-product-subarray.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0152-maximum-product-subarray.org index ce356e3..e61adf7 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0152-maximum-product-subarray.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0152-maximum-product-subarray.org @@ -42,13 +42,13 @@ Explanation: The result cannot be 2, because [-2,-1] is not a subarray. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 152 :lc-lang python3 class Solution: def maxProduct(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 152 class Solution { public: int maxProduct(vector& nums) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0198-house-robber.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0198-house-robber.org index 3fd85b6..5eb917c 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0198-house-robber.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0198-house-robber.org @@ -40,13 +40,13 @@ Total amount you can rob = 2 + 9 + 1 = 12. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 198 :lc-lang python3 class Solution: def rob(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 198 class Solution { public: int rob(vector& nums) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0213-house-robber-ii.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0213-house-robber-ii.org index 9c58751..3370dce 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0213-house-robber-ii.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0213-house-robber-ii.org @@ -48,13 +48,13 @@ Output: 3 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 213 :lc-lang python3 class Solution: def rob(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 213 class Solution { public: int rob(vector& nums) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0300-longest-increasing-subsequence.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0300-longest-increasing-subsequence.org index 0af275c..e3c5dbf 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0300-longest-increasing-subsequence.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0300-longest-increasing-subsequence.org @@ -46,13 +46,13 @@ Follow up: Can you come up with an algorithm that runs in ~O(n log(n))~ time com Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 300 :lc-lang python3 class Solution: def lengthOfLIS(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 300 class Solution { public: int lengthOfLIS(vector& nums) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0322-coin-change.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0322-coin-change.org index 5408d95..31200f1 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0322-coin-change.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0322-coin-change.org @@ -50,13 +50,13 @@ Output: 0 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 322 :lc-lang python3 class Solution: def coinChange(self, coins: List[int], amount: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 322 class Solution { public: int coinChange(vector& coins, int amount) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0416-partition-equal-subset-sum.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0416-partition-equal-subset-sum.org index 7e17c28..f9c606b 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0416-partition-equal-subset-sum.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0416-partition-equal-subset-sum.org @@ -36,13 +36,13 @@ Explanation: The array cannot be partitioned into equal sum subsets. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 416 :lc-lang python3 class Solution: def canPartition(self, nums: List[int]) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 416 class Solution { public: bool canPartition(vector& nums) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0647-palindromic-substrings.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0647-palindromic-substrings.org index 6ce3ed8..e9b4f23 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0647-palindromic-substrings.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0647-palindromic-substrings.org @@ -40,13 +40,13 @@ Explanation: Six palindromic strings: "a", "a", "a", "aa", "aa", "aaa". Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 647 :lc-lang python3 class Solution: def countSubstrings(self, s: str) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 647 class Solution { public: int countSubstrings(string s) { diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0656-coin-path.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0656-coin-path.org index 71401b0..4d6eb8b 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0656-coin-path.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0656-coin-path.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 656 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 656 #+end_src diff --git a/org/study_deck_02/dsa/1-d-dynamic-programming/0746-min-cost-climbing-stairs.org b/org/study_deck_02/dsa/1-d-dynamic-programming/0746-min-cost-climbing-stairs.org index ca66c88..b9c09f8 100644 --- a/org/study_deck_02/dsa/1-d-dynamic-programming/0746-min-cost-climbing-stairs.org +++ b/org/study_deck_02/dsa/1-d-dynamic-programming/0746-min-cost-climbing-stairs.org @@ -49,13 +49,13 @@ The total cost is 6. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 746 :lc-lang python3 class Solution: def minCostClimbingStairs(self, cost: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 746 class Solution { public: int minCostClimbingStairs(vector& cost) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0010-regular-expression-matching.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0010-regular-expression-matching.org index 18b2eb4..c852755 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0010-regular-expression-matching.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0010-regular-expression-matching.org @@ -58,13 +58,13 @@ Explanation: ".*" means "zero or more (*) of any character (.)". Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 10 :lc-lang python3 class Solution: def isMatch(self, s: str, p: str) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 10 class Solution { public: bool isMatch(string s, string p) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0062-unique-paths.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0062-unique-paths.org index cb22770..84bf8b9 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0062-unique-paths.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0062-unique-paths.org @@ -40,13 +40,13 @@ Explanation: From the top-left corner, there are a total of 3 ways to reach the Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 62 :lc-lang python3 class Solution: def uniquePaths(self, m: int, n: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 62 class Solution { public: int uniquePaths(int m, int n) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0072-edit-distance.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0072-edit-distance.org index 809c361..d92660b 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0072-edit-distance.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0072-edit-distance.org @@ -52,13 +52,13 @@ exection -> execution (insert 'u') Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 72 :lc-lang python3 class Solution: def minDistance(self, word1: str, word2: str) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 72 class Solution { public: int minDistance(string word1, string word2) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0097-interleaving-string.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0097-interleaving-string.org index f2ee9f8..fa893d6 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0097-interleaving-string.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0097-interleaving-string.org @@ -64,13 +64,13 @@ Output: true Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 97 :lc-lang python3 class Solution: def isInterleave(self, s1: str, s2: str, s3: str) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 97 class Solution { public: bool isInterleave(string s1, string s2, string s3) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0115-distinct-subsequences.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0115-distinct-subsequences.org index 7ae813e..e770588 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0115-distinct-subsequences.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0115-distinct-subsequences.org @@ -48,13 +48,13 @@ babgbag Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 115 :lc-lang python3 class Solution: def numDistinct(self, s: str, t: str) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 115 class Solution { public: int numDistinct(string s, string t) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0309-best-time-to-buy-and-sell-stock-with-cooldown.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0309-best-time-to-buy-and-sell-stock-with-cooldown.org index ef27edd..ee052f7 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0309-best-time-to-buy-and-sell-stock-with-cooldown.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0309-best-time-to-buy-and-sell-stock-with-cooldown.org @@ -41,13 +41,13 @@ Output: 0 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 309 :lc-lang python3 class Solution: def maxProfit(self, prices: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 309 class Solution { public: int maxProfit(vector& prices) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0312-burst-balloons.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0312-burst-balloons.org index cc91a51..8af0c70 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0312-burst-balloons.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0312-burst-balloons.org @@ -43,13 +43,13 @@ Output: 10 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 312 :lc-lang python3 class Solution: def maxCoins(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 312 class Solution { public: int maxCoins(vector& nums) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0329-longest-increasing-path-in-a-matrix.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0329-longest-increasing-path-in-a-matrix.org index c65ae6a..5e25cb2 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0329-longest-increasing-path-in-a-matrix.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0329-longest-increasing-path-in-a-matrix.org @@ -51,13 +51,13 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 329 :lc-lang python3 class Solution: def longestIncreasingPath(self, matrix: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 329 class Solution { public: int longestIncreasingPath(vector>& matrix) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0494-target-sum.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0494-target-sum.org index 9fb1437..027935f 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0494-target-sum.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0494-target-sum.org @@ -50,13 +50,13 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 494 :lc-lang python3 class Solution: def findTargetSumWays(self, nums: List[int], target: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 494 class Solution { public: int findTargetSumWays(vector& nums, int target) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/0518-coin-change-ii.org b/org/study_deck_02/dsa/2-d-dynamic-programming/0518-coin-change-ii.org index f93d12f..ec42757 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/0518-coin-change-ii.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/0518-coin-change-ii.org @@ -59,13 +59,13 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 518 :lc-lang python3 class Solution: def change(self, amount: int, coins: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 518 class Solution { public: int change(int amount, vector& coins) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/1143-longest-common-subsequence.org b/org/study_deck_02/dsa/2-d-dynamic-programming/1143-longest-common-subsequence.org index d534cfc..3e08bb9 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/1143-longest-common-subsequence.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/1143-longest-common-subsequence.org @@ -52,13 +52,13 @@ Explanation: There is no such common subsequence, so the result is 0. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1143 :lc-lang python3 class Solution: def longestCommonSubsequence(self, text1: str, text2: str) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1143 class Solution { public: int longestCommonSubsequence(string text1, string text2) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/1220-count-vowels-permutation.org b/org/study_deck_02/dsa/2-d-dynamic-programming/1220-count-vowels-permutation.org index 7535ac2..c5b5b51 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/1220-count-vowels-permutation.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/1220-count-vowels-permutation.org @@ -57,13 +57,13 @@ Output: 68 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1220 :lc-lang python3 class Solution: def countVowelPermutation(self, n: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1220 class Solution { public: int countVowelPermutation(int n) { diff --git a/org/study_deck_02/dsa/2-d-dynamic-programming/1911-maximum-alternating-subsequence-sum.org b/org/study_deck_02/dsa/2-d-dynamic-programming/1911-maximum-alternating-subsequence-sum.org index a6c9d8e..fea0a67 100644 --- a/org/study_deck_02/dsa/2-d-dynamic-programming/1911-maximum-alternating-subsequence-sum.org +++ b/org/study_deck_02/dsa/2-d-dynamic-programming/1911-maximum-alternating-subsequence-sum.org @@ -52,13 +52,13 @@ Explanation: It is optimal to choose the subsequence [6,1,5] with alternating su Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1911 :lc-lang python3 class Solution: def maxAlternatingSum(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1911 class Solution { public: long long maxAlternatingSum(vector& nums) { diff --git a/org/study_deck_02/dsa/advanced-graphs/0269-alien-dictionary.org b/org/study_deck_02/dsa/advanced-graphs/0269-alien-dictionary.org index b0ee24c..c9a88ad 100644 --- a/org/study_deck_02/dsa/advanced-graphs/0269-alien-dictionary.org +++ b/org/study_deck_02/dsa/advanced-graphs/0269-alien-dictionary.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 269 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 269 #+end_src diff --git a/org/study_deck_02/dsa/advanced-graphs/0332-reconstruct-itinerary.org b/org/study_deck_02/dsa/advanced-graphs/0332-reconstruct-itinerary.org index 0eb0d0b..4aaf560 100644 --- a/org/study_deck_02/dsa/advanced-graphs/0332-reconstruct-itinerary.org +++ b/org/study_deck_02/dsa/advanced-graphs/0332-reconstruct-itinerary.org @@ -49,13 +49,13 @@ Explanation: Another possible reconstruction is ["JFK","SFO","ATL","JFK","ATL"," Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 332 :lc-lang python3 class Solution: def findItinerary(self, tickets: List[List[str]]) -> List[str]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 332 class Solution { public: vector findItinerary(vector>& tickets) { diff --git a/org/study_deck_02/dsa/advanced-graphs/0743-network-delay-time.org b/org/study_deck_02/dsa/advanced-graphs/0743-network-delay-time.org index fac7a79..403a08b 100644 --- a/org/study_deck_02/dsa/advanced-graphs/0743-network-delay-time.org +++ b/org/study_deck_02/dsa/advanced-graphs/0743-network-delay-time.org @@ -55,13 +55,13 @@ Output: -1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 743 :lc-lang python3 class Solution: def networkDelayTime(self, times: List[List[int]], n: int, k: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 743 class Solution { public: int networkDelayTime(vector>& times, int n, int k) { diff --git a/org/study_deck_02/dsa/advanced-graphs/0778-swim-in-rising-water.org b/org/study_deck_02/dsa/advanced-graphs/0778-swim-in-rising-water.org index e7f9e55..22f2567 100644 --- a/org/study_deck_02/dsa/advanced-graphs/0778-swim-in-rising-water.org +++ b/org/study_deck_02/dsa/advanced-graphs/0778-swim-in-rising-water.org @@ -53,13 +53,13 @@ We need to wait until time 16 so that (0, 0) and (4, 4) are connected. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 778 :lc-lang python3 class Solution: def swimInWater(self, grid: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 778 class Solution { public: int swimInWater(vector>& grid) { diff --git a/org/study_deck_02/dsa/advanced-graphs/0787-cheapest-flights-within-k-stops.org b/org/study_deck_02/dsa/advanced-graphs/0787-cheapest-flights-within-k-stops.org index d7b0e05..b0dc766 100644 --- a/org/study_deck_02/dsa/advanced-graphs/0787-cheapest-flights-within-k-stops.org +++ b/org/study_deck_02/dsa/advanced-graphs/0787-cheapest-flights-within-k-stops.org @@ -69,13 +69,13 @@ The optimal path with no stops from city 0 to 2 is marked in red and has cost 50 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 787 :lc-lang python3 class Solution: def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, k: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 787 class Solution { public: int findCheapestPrice(int n, vector>& flights, int src, int dst, int k) { diff --git a/org/study_deck_02/dsa/advanced-graphs/1584-min-cost-to-connect-all-points.org b/org/study_deck_02/dsa/advanced-graphs/1584-min-cost-to-connect-all-points.org index dd6a678..0cff18f 100644 --- a/org/study_deck_02/dsa/advanced-graphs/1584-min-cost-to-connect-all-points.org +++ b/org/study_deck_02/dsa/advanced-graphs/1584-min-cost-to-connect-all-points.org @@ -44,13 +44,13 @@ Output: 18 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1584 :lc-lang python3 class Solution: def minCostConnectPoints(self, points: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1584 class Solution { public: int minCostConnectPoints(vector>& points) { diff --git a/org/study_deck_02/dsa/advanced-graphs/2493-divide-nodes-into-the-maximum-number-of-groups.org b/org/study_deck_02/dsa/advanced-graphs/2493-divide-nodes-into-the-maximum-number-of-groups.org index 440875d..5ab7d08 100644 --- a/org/study_deck_02/dsa/advanced-graphs/2493-divide-nodes-into-the-maximum-number-of-groups.org +++ b/org/study_deck_02/dsa/advanced-graphs/2493-divide-nodes-into-the-maximum-number-of-groups.org @@ -61,13 +61,13 @@ It can be shown that no grouping is possible. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2493 :lc-lang python3 class Solution: def magnificentSets(self, n: int, edges: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2493 class Solution { public: int magnificentSets(int n, vector>& edges) { diff --git a/org/study_deck_02/dsa/advanced-graphs/2812-find-the-safest-path-in-a-grid.org b/org/study_deck_02/dsa/advanced-graphs/2812-find-the-safest-path-in-a-grid.org index 632292f..5ef9da8 100644 --- a/org/study_deck_02/dsa/advanced-graphs/2812-find-the-safest-path-in-a-grid.org +++ b/org/study_deck_02/dsa/advanced-graphs/2812-find-the-safest-path-in-a-grid.org @@ -69,13 +69,13 @@ It can be shown that there are no other paths with a higher safeness factor. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2812 :lc-lang python3 class Solution: def maximumSafenessFactor(self, grid: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2812 class Solution { public: int maximumSafenessFactor(vector>& grid) { diff --git a/org/study_deck_02/dsa/arrays-hashing/0001-two-sum.org b/org/study_deck_02/dsa/arrays-hashing/0001-two-sum.org index 6bb54ec..1ab48bd 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0001-two-sum.org +++ b/org/study_deck_02/dsa/arrays-hashing/0001-two-sum.org @@ -54,7 +54,7 @@ Output: [0,1] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1 :lc-lang python3 class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: sb = {} @@ -66,7 +66,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1 class Solution { public: vector twoSum(vector& nums, int target) { diff --git a/org/study_deck_02/dsa/arrays-hashing/0036-valid-sudoku.org b/org/study_deck_02/dsa/arrays-hashing/0036-valid-sudoku.org index 07c5568..1811745 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0036-valid-sudoku.org +++ b/org/study_deck_02/dsa/arrays-hashing/0036-valid-sudoku.org @@ -67,13 +67,13 @@ Explanation: Same as Example 1, except with the 5 in the top left corner being m Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 36 :lc-lang python3 class Solution: def isValidSudoku(self, board: List[List[str]]) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 36 class Solution { public: bool isValidSudoku(vector>& board) { diff --git a/org/study_deck_02/dsa/arrays-hashing/0049-group-anagrams.org b/org/study_deck_02/dsa/arrays-hashing/0049-group-anagrams.org index ff1c23d..c767712 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0049-group-anagrams.org +++ b/org/study_deck_02/dsa/arrays-hashing/0049-group-anagrams.org @@ -44,13 +44,13 @@ Given an array of strings ~strs~, group the anagrams together. You can return th Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 49 :lc-lang python3 class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 49 class Solution { public: vector> groupAnagrams(vector& strs) { diff --git a/org/study_deck_02/dsa/arrays-hashing/0128-longest-consecutive-sequence.org b/org/study_deck_02/dsa/arrays-hashing/0128-longest-consecutive-sequence.org index cca3581..7bf4003 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0128-longest-consecutive-sequence.org +++ b/org/study_deck_02/dsa/arrays-hashing/0128-longest-consecutive-sequence.org @@ -46,13 +46,13 @@ Output: 3 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 128 :lc-lang python3 class Solution: def longestConsecutive(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 128 class Solution { public: int longestConsecutive(vector& nums) { diff --git a/org/study_deck_02/dsa/arrays-hashing/0217-contains-duplicate.org b/org/study_deck_02/dsa/arrays-hashing/0217-contains-duplicate.org index 8968db4..9a925e7 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0217-contains-duplicate.org +++ b/org/study_deck_02/dsa/arrays-hashing/0217-contains-duplicate.org @@ -42,7 +42,7 @@ All elements are distinct. Write your approach here. ** DONE Python -#+begin_src python +#+begin_src python :lc-problem 217 :lc-lang python3 class Solution: def containsDuplicate(self, nums: List[int]) -> bool: s = set() @@ -54,7 +54,7 @@ class Solution: #+end_src ** DONE C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 217 #include #include class Solution { diff --git a/org/study_deck_02/dsa/arrays-hashing/0238-product-of-array-except-self.org b/org/study_deck_02/dsa/arrays-hashing/0238-product-of-array-except-self.org index baceca3..d60352a 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0238-product-of-array-except-self.org +++ b/org/study_deck_02/dsa/arrays-hashing/0238-product-of-array-except-self.org @@ -40,13 +40,13 @@ Output: [0,0,9,0,0] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 238 :lc-lang python3 class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 238 class Solution { public: vector productExceptSelf(vector& nums) { diff --git a/org/study_deck_02/dsa/arrays-hashing/0242-valid-anagram.org b/org/study_deck_02/dsa/arrays-hashing/0242-valid-anagram.org index f54bde7..4271781 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0242-valid-anagram.org +++ b/org/study_deck_02/dsa/arrays-hashing/0242-valid-anagram.org @@ -30,13 +30,13 @@ Given two strings ~s~ and ~t~, return ~true~ if ~t~ is an anagram of ~s~, and ~f Write your approach here. ** DONE Python -#+begin_src python +#+begin_src python :lc-problem 242 :lc-lang python3 class Solution: def isAnagram(self, s: str, t: str) -> bool: #+end_src ** DONE C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 242 #include #include class Solution { diff --git a/org/study_deck_02/dsa/arrays-hashing/0271-encode-and-decode-strings.org b/org/study_deck_02/dsa/arrays-hashing/0271-encode-and-decode-strings.org index 44dde18..36116b2 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0271-encode-and-decode-strings.org +++ b/org/study_deck_02/dsa/arrays-hashing/0271-encode-and-decode-strings.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 271 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 271 #+end_src diff --git a/org/study_deck_02/dsa/arrays-hashing/0347-top-k-frequent-elements.org b/org/study_deck_02/dsa/arrays-hashing/0347-top-k-frequent-elements.org index 8448016..b9d0bf0 100644 --- a/org/study_deck_02/dsa/arrays-hashing/0347-top-k-frequent-elements.org +++ b/org/study_deck_02/dsa/arrays-hashing/0347-top-k-frequent-elements.org @@ -48,7 +48,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 347 class Solution { public: vector topKFrequent(vector& nums, int k) { diff --git a/org/study_deck_02/dsa/arrays-hashing/1408-string-matching-in-an-array.org b/org/study_deck_02/dsa/arrays-hashing/1408-string-matching-in-an-array.org index c9f4664..27f4233 100644 --- a/org/study_deck_02/dsa/arrays-hashing/1408-string-matching-in-an-array.org +++ b/org/study_deck_02/dsa/arrays-hashing/1408-string-matching-in-an-array.org @@ -51,7 +51,7 @@ Explanation: No string of words is substring of another string. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1408 :lc-lang python3 from collections import defaultdict as dd class Solution: def stringMatching(self, words: List[str]) -> List[str]: @@ -87,7 +87,7 @@ class Solution: ** ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1408 class Solution { public: vector stringMatching(vector& words) { diff --git a/org/study_deck_02/dsa/arrays-hashing/1769-minimum-number-of-operations-to-move-all-balls-to-each-box.org b/org/study_deck_02/dsa/arrays-hashing/1769-minimum-number-of-operations-to-move-all-balls-to-each-box.org index 726e2db..6ba0f9f 100644 --- a/org/study_deck_02/dsa/arrays-hashing/1769-minimum-number-of-operations-to-move-all-balls-to-each-box.org +++ b/org/study_deck_02/dsa/arrays-hashing/1769-minimum-number-of-operations-to-move-all-balls-to-each-box.org @@ -46,13 +46,13 @@ Output: [11,8,5,4,3,4] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1769 :lc-lang python3 class Solution: def minOperations(self, boxes: str) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1769 class Solution { public: vector minOperations(string boxes) { diff --git a/org/study_deck_02/dsa/arrays-hashing/2678-number-of-senior-citizens.org b/org/study_deck_02/dsa/arrays-hashing/2678-number-of-senior-citizens.org index e4a5805..769c876 100644 --- a/org/study_deck_02/dsa/arrays-hashing/2678-number-of-senior-citizens.org +++ b/org/study_deck_02/dsa/arrays-hashing/2678-number-of-senior-citizens.org @@ -52,13 +52,13 @@ Explanation: None of the passengers are older than 60. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2678 :lc-lang python3 class Solution: def countSeniors(self, details: List[str]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2678 class Solution { public: int countSeniors(vector& details) { diff --git a/org/study_deck_02/dsa/backtracking/0017-letter-combinations-of-a-phone-number.org b/org/study_deck_02/dsa/backtracking/0017-letter-combinations-of-a-phone-number.org index a41f610..819170b 100644 --- a/org/study_deck_02/dsa/backtracking/0017-letter-combinations-of-a-phone-number.org +++ b/org/study_deck_02/dsa/backtracking/0017-letter-combinations-of-a-phone-number.org @@ -36,13 +36,13 @@ Output: ["a","b","c"] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 17 :lc-lang python3 class Solution: def letterCombinations(self, digits: str) -> List[str]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 17 class Solution { public: vector letterCombinations(string digits) { diff --git a/org/study_deck_02/dsa/backtracking/0022-generate-parentheses.org b/org/study_deck_02/dsa/backtracking/0022-generate-parentheses.org index 63813ed..f8918c9 100644 --- a/org/study_deck_02/dsa/backtracking/0022-generate-parentheses.org +++ b/org/study_deck_02/dsa/backtracking/0022-generate-parentheses.org @@ -30,13 +30,13 @@ Output: ["()"] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 22 :lc-lang python3 class Solution: def generateParenthesis(self, n: int) -> List[str]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 22 class Solution { public: vector generateParenthesis(int n) { diff --git a/org/study_deck_02/dsa/backtracking/0039-combination-sum.org b/org/study_deck_02/dsa/backtracking/0039-combination-sum.org index 028daf9..d6849f1 100644 --- a/org/study_deck_02/dsa/backtracking/0039-combination-sum.org +++ b/org/study_deck_02/dsa/backtracking/0039-combination-sum.org @@ -55,13 +55,13 @@ Output: [] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 39 :lc-lang python3 class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 39 class Solution { public: vector> combinationSum(vector& candidates, int target) { diff --git a/org/study_deck_02/dsa/backtracking/0040-combination-sum-ii.org b/org/study_deck_02/dsa/backtracking/0040-combination-sum-ii.org index 03dfb33..4eae39e 100644 --- a/org/study_deck_02/dsa/backtracking/0040-combination-sum-ii.org +++ b/org/study_deck_02/dsa/backtracking/0040-combination-sum-ii.org @@ -50,13 +50,13 @@ Output: Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 40 :lc-lang python3 class Solution: def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 40 class Solution { public: vector> combinationSum2(vector& candidates, int target) { diff --git a/org/study_deck_02/dsa/backtracking/0046-permutations.org b/org/study_deck_02/dsa/backtracking/0046-permutations.org index a3d2116..3562443 100644 --- a/org/study_deck_02/dsa/backtracking/0046-permutations.org +++ b/org/study_deck_02/dsa/backtracking/0046-permutations.org @@ -41,13 +41,13 @@ Output: [[1]] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 46 :lc-lang python3 class Solution: def permute(self, nums: List[int]) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 46 class Solution { public: vector> permute(vector& nums) { diff --git a/org/study_deck_02/dsa/backtracking/0051-n-queens.org b/org/study_deck_02/dsa/backtracking/0051-n-queens.org index 9f8149f..29ce302 100644 --- a/org/study_deck_02/dsa/backtracking/0051-n-queens.org +++ b/org/study_deck_02/dsa/backtracking/0051-n-queens.org @@ -37,13 +37,13 @@ Output: [["Q"]] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 51 :lc-lang python3 class Solution: def solveNQueens(self, n: int) -> List[List[str]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 51 class Solution { public: vector> solveNQueens(int n) { diff --git a/org/study_deck_02/dsa/backtracking/0052-n-queens-ii.org b/org/study_deck_02/dsa/backtracking/0052-n-queens-ii.org index bd08bee..76460ab 100644 --- a/org/study_deck_02/dsa/backtracking/0052-n-queens-ii.org +++ b/org/study_deck_02/dsa/backtracking/0052-n-queens-ii.org @@ -35,13 +35,13 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 52 :lc-lang python3 class Solution: def totalNQueens(self, n: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 52 class Solution { public: int totalNQueens(int n) { diff --git a/org/study_deck_02/dsa/backtracking/0077-combinations.org b/org/study_deck_02/dsa/backtracking/0077-combinations.org index 40ffb02..6959152 100644 --- a/org/study_deck_02/dsa/backtracking/0077-combinations.org +++ b/org/study_deck_02/dsa/backtracking/0077-combinations.org @@ -39,13 +39,13 @@ Explanation: There is 1 choose 1 = 1 total combination. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 77 :lc-lang python3 class Solution: def combine(self, n: int, k: int) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 77 class Solution { public: vector> combine(int n, int k) { diff --git a/org/study_deck_02/dsa/backtracking/0078-subsets.org b/org/study_deck_02/dsa/backtracking/0078-subsets.org index 6c80c31..f572842 100644 --- a/org/study_deck_02/dsa/backtracking/0078-subsets.org +++ b/org/study_deck_02/dsa/backtracking/0078-subsets.org @@ -38,13 +38,13 @@ Output: [[],[0]] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 78 :lc-lang python3 class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 78 class Solution { public: vector> subsets(vector& nums) { diff --git a/org/study_deck_02/dsa/backtracking/0079-word-search.org b/org/study_deck_02/dsa/backtracking/0079-word-search.org index c04732e..38d1609 100644 --- a/org/study_deck_02/dsa/backtracking/0079-word-search.org +++ b/org/study_deck_02/dsa/backtracking/0079-word-search.org @@ -53,13 +53,13 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 79 :lc-lang python3 class Solution: def exist(self, board: List[List[str]], word: str) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 79 class Solution { public: bool exist(vector>& board, string word) { diff --git a/org/study_deck_02/dsa/backtracking/0090-subsets-ii.org b/org/study_deck_02/dsa/backtracking/0090-subsets-ii.org index cbb5cc9..2f1431b 100644 --- a/org/study_deck_02/dsa/backtracking/0090-subsets-ii.org +++ b/org/study_deck_02/dsa/backtracking/0090-subsets-ii.org @@ -34,13 +34,13 @@ Output: [[],[0]] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 90 :lc-lang python3 class Solution: def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 90 class Solution { public: vector> subsetsWithDup(vector& nums) { diff --git a/org/study_deck_02/dsa/backtracking/0131-palindrome-partitioning.org b/org/study_deck_02/dsa/backtracking/0131-palindrome-partitioning.org index 2df255d..5171b00 100644 --- a/org/study_deck_02/dsa/backtracking/0131-palindrome-partitioning.org +++ b/org/study_deck_02/dsa/backtracking/0131-palindrome-partitioning.org @@ -32,13 +32,13 @@ Output: [["a"]] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 131 :lc-lang python3 class Solution: def partition(self, s: str) -> List[List[str]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 131 class Solution { public: vector> partition(string s) { diff --git a/org/study_deck_02/dsa/backtracking/0351-android-unlock-patterns.org b/org/study_deck_02/dsa/backtracking/0351-android-unlock-patterns.org index c428761..90d8181 100644 --- a/org/study_deck_02/dsa/backtracking/0351-android-unlock-patterns.org +++ b/org/study_deck_02/dsa/backtracking/0351-android-unlock-patterns.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 351 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 351 #+end_src diff --git a/org/study_deck_02/dsa/backtracking/1079-letter-tile-possibilities.org b/org/study_deck_02/dsa/backtracking/1079-letter-tile-possibilities.org index b07ddb6..17cf121 100644 --- a/org/study_deck_02/dsa/backtracking/1079-letter-tile-possibilities.org +++ b/org/study_deck_02/dsa/backtracking/1079-letter-tile-possibilities.org @@ -46,13 +46,13 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1079 :lc-lang python3 class Solution: def numTilePossibilities(self, tiles: str) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1079 class Solution { public: int numTilePossibilities(string tiles) { diff --git a/org/study_deck_02/dsa/backtracking/1863-sum-of-all-subsets-xor-total.org b/org/study_deck_02/dsa/backtracking/1863-sum-of-all-subsets-xor-total.org index 7ba99c8..a5d413c 100644 --- a/org/study_deck_02/dsa/backtracking/1863-sum-of-all-subsets-xor-total.org +++ b/org/study_deck_02/dsa/backtracking/1863-sum-of-all-subsets-xor-total.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1863 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1863 #+end_src diff --git a/org/study_deck_02/dsa/binary-search/0004-median-of-two-sorted-arrays.org b/org/study_deck_02/dsa/binary-search/0004-median-of-two-sorted-arrays.org index 61a58e0..b322d8c 100644 --- a/org/study_deck_02/dsa/binary-search/0004-median-of-two-sorted-arrays.org +++ b/org/study_deck_02/dsa/binary-search/0004-median-of-two-sorted-arrays.org @@ -46,13 +46,13 @@ Explanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 4 :lc-lang python3 class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 4 class Solution { public: double findMedianSortedArrays(vector& nums1, vector& nums2) { diff --git a/org/study_deck_02/dsa/binary-search/0033-search-in-rotated-sorted-array.org b/org/study_deck_02/dsa/binary-search/0033-search-in-rotated-sorted-array.org index 8fab337..9508bf5 100644 --- a/org/study_deck_02/dsa/binary-search/0033-search-in-rotated-sorted-array.org +++ b/org/study_deck_02/dsa/binary-search/0033-search-in-rotated-sorted-array.org @@ -51,13 +51,13 @@ Output: -1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 33 :lc-lang python3 class Solution: def search(self, nums: List[int], target: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 33 class Solution { public: int search(vector& nums, int target) { diff --git a/org/study_deck_02/dsa/binary-search/0074-search-a-2d-matrix.org b/org/study_deck_02/dsa/binary-search/0074-search-a-2d-matrix.org index 21e1eb3..829bb18 100644 --- a/org/study_deck_02/dsa/binary-search/0074-search-a-2d-matrix.org +++ b/org/study_deck_02/dsa/binary-search/0074-search-a-2d-matrix.org @@ -46,13 +46,13 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 74 :lc-lang python3 class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 74 class Solution { public: bool searchMatrix(vector>& matrix, int target) { diff --git a/org/study_deck_02/dsa/binary-search/0153-find-minimum-in-rotated-sorted-array.org b/org/study_deck_02/dsa/binary-search/0153-find-minimum-in-rotated-sorted-array.org index a7d0d17..6514626 100644 --- a/org/study_deck_02/dsa/binary-search/0153-find-minimum-in-rotated-sorted-array.org +++ b/org/study_deck_02/dsa/binary-search/0153-find-minimum-in-rotated-sorted-array.org @@ -62,13 +62,13 @@ Explanation: The original array was [11,13,15,17] and it was rotated 4 times. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 153 :lc-lang python3 class Solution: def findMin(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 153 class Solution { public: int findMin(vector& nums) { diff --git a/org/study_deck_02/dsa/binary-search/0704-binary-search.org b/org/study_deck_02/dsa/binary-search/0704-binary-search.org index 6c93c05..33f870e 100644 --- a/org/study_deck_02/dsa/binary-search/0704-binary-search.org +++ b/org/study_deck_02/dsa/binary-search/0704-binary-search.org @@ -42,13 +42,13 @@ Explanation: 2 does not exist in nums so return -1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 704 :lc-lang python3 class Solution: def search(self, nums: List[int], target: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 704 class Solution { public: int search(vector& nums, int target) { diff --git a/org/study_deck_02/dsa/binary-search/0719-find-k-th-smallest-pair-distance.org b/org/study_deck_02/dsa/binary-search/0719-find-k-th-smallest-pair-distance.org index 1ebba44..c3e1bb5 100644 --- a/org/study_deck_02/dsa/binary-search/0719-find-k-th-smallest-pair-distance.org +++ b/org/study_deck_02/dsa/binary-search/0719-find-k-th-smallest-pair-distance.org @@ -54,13 +54,13 @@ Output: 5 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 719 :lc-lang python3 class Solution: def smallestDistancePair(self, nums: List[int], k: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 719 class Solution { public: int smallestDistancePair(vector& nums, int k) { diff --git a/org/study_deck_02/dsa/binary-search/0875-koko-eating-bananas.org b/org/study_deck_02/dsa/binary-search/0875-koko-eating-bananas.org index 0168af3..7c00e41 100644 --- a/org/study_deck_02/dsa/binary-search/0875-koko-eating-bananas.org +++ b/org/study_deck_02/dsa/binary-search/0875-koko-eating-bananas.org @@ -51,13 +51,13 @@ Output: 23 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 875 :lc-lang python3 class Solution: def minEatingSpeed(self, piles: List[int], h: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 875 class Solution { public: int minEatingSpeed(vector& piles, int h) { diff --git a/org/study_deck_02/dsa/binary-search/0981-time-based-key-value-store.org b/org/study_deck_02/dsa/binary-search/0981-time-based-key-value-store.org index cfcab6c..62ca92f 100644 --- a/org/study_deck_02/dsa/binary-search/0981-time-based-key-value-store.org +++ b/org/study_deck_02/dsa/binary-search/0981-time-based-key-value-store.org @@ -51,7 +51,7 @@ timeMap.get("foo", 5); // return "bar2" Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 981 :lc-lang python3 class TimeMap: def __init__(self): @@ -71,7 +71,7 @@ class TimeMap: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 981 class TimeMap { public: TimeMap() { diff --git a/org/study_deck_02/dsa/binary-search/2300-successful-pairs-of-spells-and-potions.org b/org/study_deck_02/dsa/binary-search/2300-successful-pairs-of-spells-and-potions.org index 1a17401..f452e9a 100644 --- a/org/study_deck_02/dsa/binary-search/2300-successful-pairs-of-spells-and-potions.org +++ b/org/study_deck_02/dsa/binary-search/2300-successful-pairs-of-spells-and-potions.org @@ -54,13 +54,13 @@ Thus, [2,0,2] is returned. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2300 :lc-lang python3 class Solution: def successfulPairs(self, spells: List[int], potions: List[int], success: int) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2300 class Solution { public: vector successfulPairs(vector& spells, vector& potions, long long success) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0007-reverse-integer.org b/org/study_deck_02/dsa/bit-manipulation/0007-reverse-integer.org index f181aba..ca9b4ec 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0007-reverse-integer.org +++ b/org/study_deck_02/dsa/bit-manipulation/0007-reverse-integer.org @@ -43,13 +43,13 @@ Output: 21 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 7 :lc-lang python3 class Solution: def reverse(self, x: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 7 class Solution { public: int reverse(int x) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0136-single-number.org b/org/study_deck_02/dsa/bit-manipulation/0136-single-number.org index 4a7cb64..d0ce047 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0136-single-number.org +++ b/org/study_deck_02/dsa/bit-manipulation/0136-single-number.org @@ -38,13 +38,13 @@ You must implement a solution with a linear runtime complexity and use only cons Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 136 :lc-lang python3 class Solution: def singleNumber(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 136 class Solution { public: int singleNumber(vector& nums) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0190-reverse-bits.org b/org/study_deck_02/dsa/bit-manipulation/0190-reverse-bits.org index 3b56eb1..55c036f 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0190-reverse-bits.org +++ b/org/study_deck_02/dsa/bit-manipulation/0190-reverse-bits.org @@ -52,13 +52,13 @@ Reverse bits of a given 32 bits signed integer. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 190 :lc-lang python3 class Solution: def reverseBits(self, n: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 190 class Solution { public: int reverseBits(int n) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0191-number-of-1-bits.org b/org/study_deck_02/dsa/bit-manipulation/0191-number-of-1-bits.org index 6ac3a06..e961382 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0191-number-of-1-bits.org +++ b/org/study_deck_02/dsa/bit-manipulation/0191-number-of-1-bits.org @@ -46,13 +46,13 @@ The input binary string *1111111111111111111111111111101* has a total of thirty Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 191 :lc-lang python3 class Solution: def hammingWeight(self, n: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 191 class Solution { public: int hammingWeight(int n) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0231-power-of-two.org b/org/study_deck_02/dsa/bit-manipulation/0231-power-of-two.org index dfdfcf5..b01925b 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0231-power-of-two.org +++ b/org/study_deck_02/dsa/bit-manipulation/0231-power-of-two.org @@ -47,13 +47,13 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 231 :lc-lang python3 class Solution: def isPowerOfTwo(self, n: int) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 231 class Solution { public: bool isPowerOfTwo(int n) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0260-single-number-iii.org b/org/study_deck_02/dsa/bit-manipulation/0260-single-number-iii.org index ee09552..8eaab86 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0260-single-number-iii.org +++ b/org/study_deck_02/dsa/bit-manipulation/0260-single-number-iii.org @@ -48,13 +48,13 @@ Output: [1,0] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 260 :lc-lang python3 class Solution: def singleNumber(self, nums: List[int]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 260 class Solution { public: vector singleNumber(vector& nums) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0268-missing-number.org b/org/study_deck_02/dsa/bit-manipulation/0268-missing-number.org index 57cbeb2..d527f9c 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0268-missing-number.org +++ b/org/study_deck_02/dsa/bit-manipulation/0268-missing-number.org @@ -52,13 +52,13 @@ Given an array ~nums~ containing ~n~ distinct numbers in the range ~[0, n]~, ret Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 268 :lc-lang python3 class Solution: def missingNumber(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 268 class Solution { public: int missingNumber(vector& nums) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0338-counting-bits.org b/org/study_deck_02/dsa/bit-manipulation/0338-counting-bits.org index 4a9301d..aa5a15c 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0338-counting-bits.org +++ b/org/study_deck_02/dsa/bit-manipulation/0338-counting-bits.org @@ -49,13 +49,13 @@ Explanation: Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 338 :lc-lang python3 class Solution: def countBits(self, n: int) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 338 class Solution { public: vector countBits(int n) { diff --git a/org/study_deck_02/dsa/bit-manipulation/0371-sum-of-two-integers.org b/org/study_deck_02/dsa/bit-manipulation/0371-sum-of-two-integers.org index 24aa674..e6c9892 100644 --- a/org/study_deck_02/dsa/bit-manipulation/0371-sum-of-two-integers.org +++ b/org/study_deck_02/dsa/bit-manipulation/0371-sum-of-two-integers.org @@ -30,13 +30,13 @@ Output: 5 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 371 :lc-lang python3 class Solution: def getSum(self, a: int, b: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 371 class Solution { public: int getSum(int a, int b) { diff --git a/org/study_deck_02/dsa/bit-manipulation/2220-minimum-bit-flips-to-convert-number.org b/org/study_deck_02/dsa/bit-manipulation/2220-minimum-bit-flips-to-convert-number.org index 3ffe0be..a8850c9 100644 --- a/org/study_deck_02/dsa/bit-manipulation/2220-minimum-bit-flips-to-convert-number.org +++ b/org/study_deck_02/dsa/bit-manipulation/2220-minimum-bit-flips-to-convert-number.org @@ -48,13 +48,13 @@ It can be shown we cannot convert 3 to 4 in less than 3 steps. Hence, we return Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2220 :lc-lang python3 class Solution: def minBitFlips(self, start: int, goal: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2220 class Solution { public: int minBitFlips(int start, int goal) { diff --git a/org/study_deck_02/dsa/graphs/0127-word-ladder.org b/org/study_deck_02/dsa/graphs/0127-word-ladder.org index 8a72af2..635fad6 100644 --- a/org/study_deck_02/dsa/graphs/0127-word-ladder.org +++ b/org/study_deck_02/dsa/graphs/0127-word-ladder.org @@ -54,13 +54,13 @@ Explanation: The endWord "cog" is not in wordList, therefore there is no valid t Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 127 :lc-lang python3 class Solution: def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 127 class Solution { public: int ladderLength(string beginWord, string endWord, vector& wordList) { diff --git a/org/study_deck_02/dsa/graphs/0130-surrounded-regions.org b/org/study_deck_02/dsa/graphs/0130-surrounded-regions.org index 0cd67a4..ec37ac9 100644 --- a/org/study_deck_02/dsa/graphs/0130-surrounded-regions.org +++ b/org/study_deck_02/dsa/graphs/0130-surrounded-regions.org @@ -44,7 +44,7 @@ In the above diagram, the bottom region is not captured because it is on the edg Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 130 :lc-lang python3 class Solution: def solve(self, board: List[List[str]]) -> None: """ @@ -53,7 +53,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 130 class Solution { public: void solve(vector>& board) { diff --git a/org/study_deck_02/dsa/graphs/0133-clone-graph.org b/org/study_deck_02/dsa/graphs/0133-clone-graph.org index 546c215..78c33d2 100644 --- a/org/study_deck_02/dsa/graphs/0133-clone-graph.org +++ b/org/study_deck_02/dsa/graphs/0133-clone-graph.org @@ -77,7 +77,7 @@ Explanation: This an empty graph, it does not have any nodes. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 133 :lc-lang python3 """ # Definition for a Node. class Node: @@ -92,7 +92,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 133 /* // Definition for a Node. class Node { diff --git a/org/study_deck_02/dsa/graphs/0200-number-of-islands.org b/org/study_deck_02/dsa/graphs/0200-number-of-islands.org index df39783..baa9e15 100644 --- a/org/study_deck_02/dsa/graphs/0200-number-of-islands.org +++ b/org/study_deck_02/dsa/graphs/0200-number-of-islands.org @@ -50,13 +50,13 @@ Output: 3 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 200 :lc-lang python3 class Solution: def numIslands(self, grid: List[List[str]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 200 class Solution { public: int numIslands(vector>& grid) { diff --git a/org/study_deck_02/dsa/graphs/0207-course-schedule.org b/org/study_deck_02/dsa/graphs/0207-course-schedule.org index e9c6e7e..3a97653 100644 --- a/org/study_deck_02/dsa/graphs/0207-course-schedule.org +++ b/org/study_deck_02/dsa/graphs/0207-course-schedule.org @@ -48,13 +48,13 @@ To take course 1 you should have finished course 0, and to take course 0 you sho Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 207 :lc-lang python3 class Solution: def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 207 class Solution { public: bool canFinish(int numCourses, vector>& prerequisites) { diff --git a/org/study_deck_02/dsa/graphs/0210-course-schedule-ii.org b/org/study_deck_02/dsa/graphs/0210-course-schedule-ii.org index 2afbf77..c11483c 100644 --- a/org/study_deck_02/dsa/graphs/0210-course-schedule-ii.org +++ b/org/study_deck_02/dsa/graphs/0210-course-schedule-ii.org @@ -58,13 +58,13 @@ Output: [0] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 210 :lc-lang python3 class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 210 class Solution { public: vector findOrder(int numCourses, vector>& prerequisites) { diff --git a/org/study_deck_02/dsa/graphs/0261-graph-valid-tree.org b/org/study_deck_02/dsa/graphs/0261-graph-valid-tree.org index 2246c70..5429b48 100644 --- a/org/study_deck_02/dsa/graphs/0261-graph-valid-tree.org +++ b/org/study_deck_02/dsa/graphs/0261-graph-valid-tree.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 261 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 261 #+end_src diff --git a/org/study_deck_02/dsa/graphs/0286-walls-and-gates.org b/org/study_deck_02/dsa/graphs/0286-walls-and-gates.org index c117c1f..4bd062d 100644 --- a/org/study_deck_02/dsa/graphs/0286-walls-and-gates.org +++ b/org/study_deck_02/dsa/graphs/0286-walls-and-gates.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 286 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 286 #+end_src diff --git a/org/study_deck_02/dsa/graphs/0323-number-of-connected-components-in-an-undirected-graph.org b/org/study_deck_02/dsa/graphs/0323-number-of-connected-components-in-an-undirected-graph.org index ba1ec88..68fd731 100644 --- a/org/study_deck_02/dsa/graphs/0323-number-of-connected-components-in-an-undirected-graph.org +++ b/org/study_deck_02/dsa/graphs/0323-number-of-connected-components-in-an-undirected-graph.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 323 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 323 #+end_src diff --git a/org/study_deck_02/dsa/graphs/0417-pacific-atlantic-water-flow.org b/org/study_deck_02/dsa/graphs/0417-pacific-atlantic-water-flow.org index c253a32..ad5afcd 100644 --- a/org/study_deck_02/dsa/graphs/0417-pacific-atlantic-water-flow.org +++ b/org/study_deck_02/dsa/graphs/0417-pacific-atlantic-water-flow.org @@ -61,13 +61,13 @@ Explanation: The water can flow from the only cell to the Pacific and Atlantic o Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 417 :lc-lang python3 class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 417 class Solution { public: vector> pacificAtlantic(vector>& heights) { diff --git a/org/study_deck_02/dsa/graphs/0684-redundant-connection.org b/org/study_deck_02/dsa/graphs/0684-redundant-connection.org index c6459c2..5d09e9b 100644 --- a/org/study_deck_02/dsa/graphs/0684-redundant-connection.org +++ b/org/study_deck_02/dsa/graphs/0684-redundant-connection.org @@ -48,13 +48,13 @@ Output: [1,4] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 684 :lc-lang python3 class Solution: def findRedundantConnection(self, edges: List[List[int]]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 684 class Solution { public: vector findRedundantConnection(vector>& edges) { diff --git a/org/study_deck_02/dsa/graphs/0695-max-area-of-island.org b/org/study_deck_02/dsa/graphs/0695-max-area-of-island.org index fc4e9f8..dc78a4c 100644 --- a/org/study_deck_02/dsa/graphs/0695-max-area-of-island.org +++ b/org/study_deck_02/dsa/graphs/0695-max-area-of-island.org @@ -43,13 +43,13 @@ Output: 0 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 695 :lc-lang python3 class Solution: def maxAreaOfIsland(self, grid: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 695 class Solution { public: int maxAreaOfIsland(vector>& grid) { diff --git a/org/study_deck_02/dsa/graphs/0802-find-eventual-safe-states.org b/org/study_deck_02/dsa/graphs/0802-find-eventual-safe-states.org index 340abac..27f5080 100644 --- a/org/study_deck_02/dsa/graphs/0802-find-eventual-safe-states.org +++ b/org/study_deck_02/dsa/graphs/0802-find-eventual-safe-states.org @@ -53,13 +53,13 @@ Only node 4 is a terminal node, and every path starting at node 4 leads to node Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 802 :lc-lang python3 class Solution: def eventualSafeNodes(self, graph: List[List[int]]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 802 class Solution { public: vector eventualSafeNodes(vector>& graph) { diff --git a/org/study_deck_02/dsa/graphs/0994-rotting-oranges.org b/org/study_deck_02/dsa/graphs/0994-rotting-oranges.org index 741cb24..0762ac5 100644 --- a/org/study_deck_02/dsa/graphs/0994-rotting-oranges.org +++ b/org/study_deck_02/dsa/graphs/0994-rotting-oranges.org @@ -59,13 +59,13 @@ Explanation: Since there are already no fresh oranges at minute 0, the answer is Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 994 :lc-lang python3 class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 994 class Solution { public: int orangesRotting(vector>& grid) { diff --git a/org/study_deck_02/dsa/graphs/1905-count-sub-islands.org b/org/study_deck_02/dsa/graphs/1905-count-sub-islands.org index f3757e2..1c3ee34 100644 --- a/org/study_deck_02/dsa/graphs/1905-count-sub-islands.org +++ b/org/study_deck_02/dsa/graphs/1905-count-sub-islands.org @@ -46,13 +46,13 @@ The 1s colored red in grid2 are those considered to be part of a sub-island. The Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1905 :lc-lang python3 class Solution: def countSubIslands(self, grid1: List[List[int]], grid2: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1905 class Solution { public: int countSubIslands(vector>& grid1, vector>& grid2) { diff --git a/org/study_deck_02/dsa/graphs/2092-find-all-people-with-secret.org b/org/study_deck_02/dsa/graphs/2092-find-all-people-with-secret.org index e48d433..349e1bd 100644 --- a/org/study_deck_02/dsa/graphs/2092-find-all-people-with-secret.org +++ b/org/study_deck_02/dsa/graphs/2092-find-all-people-with-secret.org @@ -76,13 +76,13 @@ Thus, people 0, 1, 2, 3, and 4 know the secret after all the meetings. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2092 :lc-lang python3 class Solution: def findAllPeople(self, n: int, meetings: List[List[int]], firstPerson: int) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2092 class Solution { public: vector findAllPeople(int n, vector>& meetings, int firstPerson) { diff --git a/org/study_deck_02/dsa/graphs/2658-maximum-number-of-fish-in-a-grid.org b/org/study_deck_02/dsa/graphs/2658-maximum-number-of-fish-in-a-grid.org index 82d3730..f923b6c 100644 --- a/org/study_deck_02/dsa/graphs/2658-maximum-number-of-fish-in-a-grid.org +++ b/org/study_deck_02/dsa/graphs/2658-maximum-number-of-fish-in-a-grid.org @@ -54,13 +54,13 @@ Explanation: The fisher can start at cells (0,0) or (3,3) and collect a single f Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2658 :lc-lang python3 class Solution: def findMaxFish(self, grid: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2658 class Solution { public: int findMaxFish(vector>& grid) { diff --git a/org/study_deck_02/dsa/graphs/2924-find-champion-ii.org b/org/study_deck_02/dsa/graphs/2924-find-champion-ii.org index 2a23a86..a337914 100644 --- a/org/study_deck_02/dsa/graphs/2924-find-champion-ii.org +++ b/org/study_deck_02/dsa/graphs/2924-find-champion-ii.org @@ -62,13 +62,13 @@ Explanation: Team 2 is weaker than team 0 and team 1. Team 3 is weaker than team Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2924 :lc-lang python3 class Solution: def findChampion(self, n: int, edges: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2924 class Solution { public: int findChampion(int n, vector>& edges) { diff --git a/org/study_deck_02/dsa/greedy/0045-jump-game-ii.org b/org/study_deck_02/dsa/greedy/0045-jump-game-ii.org index 732bd92..92673fa 100644 --- a/org/study_deck_02/dsa/greedy/0045-jump-game-ii.org +++ b/org/study_deck_02/dsa/greedy/0045-jump-game-ii.org @@ -45,13 +45,13 @@ Output: 2 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 45 :lc-lang python3 class Solution: def jump(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 45 class Solution { public: int jump(vector& nums) { diff --git a/org/study_deck_02/dsa/greedy/0053-maximum-subarray.org b/org/study_deck_02/dsa/greedy/0053-maximum-subarray.org index dae5143..6689eb2 100644 --- a/org/study_deck_02/dsa/greedy/0053-maximum-subarray.org +++ b/org/study_deck_02/dsa/greedy/0053-maximum-subarray.org @@ -48,13 +48,13 @@ Explanation: The subarray [5,4,-1,7,8] has the largest sum 23. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 53 :lc-lang python3 class Solution: def maxSubArray(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 53 class Solution { public: int maxSubArray(vector& nums) { diff --git a/org/study_deck_02/dsa/greedy/0055-jump-game.org b/org/study_deck_02/dsa/greedy/0055-jump-game.org index 9bab65c..11b8e05 100644 --- a/org/study_deck_02/dsa/greedy/0055-jump-game.org +++ b/org/study_deck_02/dsa/greedy/0055-jump-game.org @@ -38,13 +38,13 @@ Explanation: You will always arrive at index 3 no matter what. Its maximum jump Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 55 :lc-lang python3 class Solution: def canJump(self, nums: List[int]) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 55 class Solution { public: bool canJump(vector& nums) { diff --git a/org/study_deck_02/dsa/greedy/0134-gas-station.org b/org/study_deck_02/dsa/greedy/0134-gas-station.org index 341e5d6..99c8b65 100644 --- a/org/study_deck_02/dsa/greedy/0134-gas-station.org +++ b/org/study_deck_02/dsa/greedy/0134-gas-station.org @@ -57,13 +57,13 @@ Therefore, you can't travel around the circuit once no matter where you star Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 134 :lc-lang python3 class Solution: def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 134 class Solution { public: int canCompleteCircuit(vector& gas, vector& cost) { diff --git a/org/study_deck_02/dsa/greedy/0678-valid-parenthesis-string.org b/org/study_deck_02/dsa/greedy/0678-valid-parenthesis-string.org index 56d93b8..01b2d20 100644 --- a/org/study_deck_02/dsa/greedy/0678-valid-parenthesis-string.org +++ b/org/study_deck_02/dsa/greedy/0678-valid-parenthesis-string.org @@ -49,13 +49,13 @@ Output: true Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 678 :lc-lang python3 class Solution: def checkValidString(self, s: str) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 678 class Solution { public: bool checkValidString(string s) { diff --git a/org/study_deck_02/dsa/greedy/0763-partition-labels.org b/org/study_deck_02/dsa/greedy/0763-partition-labels.org index 2aa4417..a37b233 100644 --- a/org/study_deck_02/dsa/greedy/0763-partition-labels.org +++ b/org/study_deck_02/dsa/greedy/0763-partition-labels.org @@ -42,13 +42,13 @@ Output: [10] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 763 :lc-lang python3 class Solution: def partitionLabels(self, s: str) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 763 class Solution { public: vector partitionLabels(string s) { diff --git a/org/study_deck_02/dsa/greedy/0846-hand-of-straights.org b/org/study_deck_02/dsa/greedy/0846-hand-of-straights.org index 1e33cd8..b58cf6f 100644 --- a/org/study_deck_02/dsa/greedy/0846-hand-of-straights.org +++ b/org/study_deck_02/dsa/greedy/0846-hand-of-straights.org @@ -42,13 +42,13 @@ Explanation: Alice's hand can not be rearranged into groups of 4. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 846 :lc-lang python3 class Solution: def isNStraightHand(self, hand: List[int], groupSize: int) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 846 class Solution { public: bool isNStraightHand(vector& hand, int groupSize) { diff --git a/org/study_deck_02/dsa/greedy/0945-minimum-increment-to-make-array-unique.org b/org/study_deck_02/dsa/greedy/0945-minimum-increment-to-make-array-unique.org index 4a8d726..e7959e7 100644 --- a/org/study_deck_02/dsa/greedy/0945-minimum-increment-to-make-array-unique.org +++ b/org/study_deck_02/dsa/greedy/0945-minimum-increment-to-make-array-unique.org @@ -41,13 +41,13 @@ It can be shown that it is impossible for the array to have all unique values wi Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 945 :lc-lang python3 class Solution: def minIncrementForUnique(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 945 class Solution { public: int minIncrementForUnique(vector& nums) { diff --git a/org/study_deck_02/dsa/greedy/0978-longest-turbulent-subarray.org b/org/study_deck_02/dsa/greedy/0978-longest-turbulent-subarray.org index 74c8663..a44e232 100644 --- a/org/study_deck_02/dsa/greedy/0978-longest-turbulent-subarray.org +++ b/org/study_deck_02/dsa/greedy/0978-longest-turbulent-subarray.org @@ -60,13 +60,13 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 978 :lc-lang python3 class Solution: def maxTurbulenceSize(self, arr: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 978 class Solution { public: int maxTurbulenceSize(vector& arr) { diff --git a/org/study_deck_02/dsa/greedy/1871-jump-game-vii.org b/org/study_deck_02/dsa/greedy/1871-jump-game-vii.org index 99eb408..4330383 100644 --- a/org/study_deck_02/dsa/greedy/1871-jump-game-vii.org +++ b/org/study_deck_02/dsa/greedy/1871-jump-game-vii.org @@ -47,13 +47,13 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1871 :lc-lang python3 class Solution: def canReach(self, s: str, minJump: int, maxJump: int) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1871 class Solution { public: bool canReach(string s, int minJump, int maxJump) { diff --git a/org/study_deck_02/dsa/greedy/1899-merge-triplets-to-form-target-triplet.org b/org/study_deck_02/dsa/greedy/1899-merge-triplets-to-form-target-triplet.org index e6c36db..b4ad71f 100644 --- a/org/study_deck_02/dsa/greedy/1899-merge-triplets-to-form-target-triplet.org +++ b/org/study_deck_02/dsa/greedy/1899-merge-triplets-to-form-target-triplet.org @@ -61,13 +61,13 @@ The target triplet [5,5,5] is now an element of triplets. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1899 :lc-lang python3 class Solution: def mergeTriplets(self, triplets: List[List[int]], target: List[int]) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1899 class Solution { public: bool mergeTriplets(vector>& triplets, vector& target) { diff --git a/org/study_deck_02/dsa/heap-priority-queue/0215-kth-largest-element-in-an-array.org b/org/study_deck_02/dsa/heap-priority-queue/0215-kth-largest-element-in-an-array.org index 4ad671a..7e1255b 100644 --- a/org/study_deck_02/dsa/heap-priority-queue/0215-kth-largest-element-in-an-array.org +++ b/org/study_deck_02/dsa/heap-priority-queue/0215-kth-largest-element-in-an-array.org @@ -36,13 +36,13 @@ Output: 4 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 215 :lc-lang python3 class Solution: def findKthLargest(self, nums: List[int], k: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 215 class Solution { public: int findKthLargest(vector& nums, int k) { diff --git a/org/study_deck_02/dsa/heap-priority-queue/0295-find-median-from-data-stream.org b/org/study_deck_02/dsa/heap-priority-queue/0295-find-median-from-data-stream.org index c600871..1bbc849 100644 --- a/org/study_deck_02/dsa/heap-priority-queue/0295-find-median-from-data-stream.org +++ b/org/study_deck_02/dsa/heap-priority-queue/0295-find-median-from-data-stream.org @@ -56,7 +56,7 @@ medianFinder.findMedian(); // return 2.0 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 295 :lc-lang python3 class MedianFinder: def __init__(self): @@ -76,7 +76,7 @@ class MedianFinder: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 295 class MedianFinder { public: MedianFinder() { diff --git a/org/study_deck_02/dsa/heap-priority-queue/0355-design-twitter.org b/org/study_deck_02/dsa/heap-priority-queue/0355-design-twitter.org index ae3101d..a7027b1 100644 --- a/org/study_deck_02/dsa/heap-priority-queue/0355-design-twitter.org +++ b/org/study_deck_02/dsa/heap-priority-queue/0355-design-twitter.org @@ -56,7 +56,7 @@ twitter.getNewsFeed(1); // User 1's news feed should return a list with 1 t Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 355 :lc-lang python3 class Twitter: def __init__(self): @@ -84,7 +84,7 @@ class Twitter: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 355 class Twitter { public: Twitter() { diff --git a/org/study_deck_02/dsa/heap-priority-queue/0621-task-scheduler.org b/org/study_deck_02/dsa/heap-priority-queue/0621-task-scheduler.org index cc137e6..312e88d 100644 --- a/org/study_deck_02/dsa/heap-priority-queue/0621-task-scheduler.org +++ b/org/study_deck_02/dsa/heap-priority-queue/0621-task-scheduler.org @@ -50,13 +50,13 @@ There are only two types of tasks, A and B, which need to be separated by 3 inte Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 621 :lc-lang python3 class Solution: def leastInterval(self, tasks: List[str], n: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 621 class Solution { public: int leastInterval(vector& tasks, int n) { diff --git a/org/study_deck_02/dsa/heap-priority-queue/0703-kth-largest-element-in-a-stream.org b/org/study_deck_02/dsa/heap-priority-queue/0703-kth-largest-element-in-a-stream.org index 859b47f..397478d 100644 --- a/org/study_deck_02/dsa/heap-priority-queue/0703-kth-largest-element-in-a-stream.org +++ b/org/study_deck_02/dsa/heap-priority-queue/0703-kth-largest-element-in-a-stream.org @@ -76,7 +76,7 @@ kthLargest.add(9); // return 8 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 703 :lc-lang python3 class KthLargest: def __init__(self, k: int, nums: List[int]): @@ -92,7 +92,7 @@ class KthLargest: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 703 class KthLargest { public: KthLargest(int k, vector& nums) { diff --git a/org/study_deck_02/dsa/heap-priority-queue/0973-k-closest-points-to-origin.org b/org/study_deck_02/dsa/heap-priority-queue/0973-k-closest-points-to-origin.org index 2f29d59..ea55c46 100644 --- a/org/study_deck_02/dsa/heap-priority-queue/0973-k-closest-points-to-origin.org +++ b/org/study_deck_02/dsa/heap-priority-queue/0973-k-closest-points-to-origin.org @@ -44,13 +44,13 @@ Explanation: The answer [[-2,4],[3,3]] would also be accepted. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 973 :lc-lang python3 class Solution: def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 973 class Solution { public: vector> kClosest(vector>& points, int k) { diff --git a/org/study_deck_02/dsa/heap-priority-queue/1046-last-stone-weight.org b/org/study_deck_02/dsa/heap-priority-queue/1046-last-stone-weight.org index 90e8f0f..39ed79e 100644 --- a/org/study_deck_02/dsa/heap-priority-queue/1046-last-stone-weight.org +++ b/org/study_deck_02/dsa/heap-priority-queue/1046-last-stone-weight.org @@ -49,13 +49,13 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1046 :lc-lang python3 class Solution: def lastStoneWeight(self, stones: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1046 class Solution { public: int lastStoneWeight(vector& stones) { diff --git a/org/study_deck_02/dsa/intervals/0056-merge-intervals.org b/org/study_deck_02/dsa/intervals/0056-merge-intervals.org index 8b84f71..f8a7e4c 100644 --- a/org/study_deck_02/dsa/intervals/0056-merge-intervals.org +++ b/org/study_deck_02/dsa/intervals/0056-merge-intervals.org @@ -48,13 +48,13 @@ Explanation: Intervals [1,4] and [4,7] are considered overlapping. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 56 :lc-lang python3 class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 56 class Solution { public: vector> merge(vector>& intervals) { diff --git a/org/study_deck_02/dsa/intervals/0057-insert-interval.org b/org/study_deck_02/dsa/intervals/0057-insert-interval.org index d810e00..5dc6d06 100644 --- a/org/study_deck_02/dsa/intervals/0057-insert-interval.org +++ b/org/study_deck_02/dsa/intervals/0057-insert-interval.org @@ -49,13 +49,13 @@ Explanation: Because the new interval [4,8] overlaps with [3,5],[6,7],[8,10]. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 57 :lc-lang python3 class Solution: def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 57 class Solution { public: vector> insert(vector>& intervals, vector& newInterval) { diff --git a/org/study_deck_02/dsa/intervals/0252-meeting-rooms.org b/org/study_deck_02/dsa/intervals/0252-meeting-rooms.org index bbacce6..d3e57d2 100644 --- a/org/study_deck_02/dsa/intervals/0252-meeting-rooms.org +++ b/org/study_deck_02/dsa/intervals/0252-meeting-rooms.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 252 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 252 #+end_src diff --git a/org/study_deck_02/dsa/intervals/0253-meeting-rooms-ii.org b/org/study_deck_02/dsa/intervals/0253-meeting-rooms-ii.org index ac4f7d5..26f268a 100644 --- a/org/study_deck_02/dsa/intervals/0253-meeting-rooms-ii.org +++ b/org/study_deck_02/dsa/intervals/0253-meeting-rooms-ii.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 253 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 253 #+end_src diff --git a/org/study_deck_02/dsa/intervals/0435-non-overlapping-intervals.org b/org/study_deck_02/dsa/intervals/0435-non-overlapping-intervals.org index 41bd809..a633f95 100644 --- a/org/study_deck_02/dsa/intervals/0435-non-overlapping-intervals.org +++ b/org/study_deck_02/dsa/intervals/0435-non-overlapping-intervals.org @@ -50,13 +50,13 @@ Explanation: You don't need to remove any of the intervals since they're Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 435 :lc-lang python3 class Solution: def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 435 class Solution { public: int eraseOverlapIntervals(vector>& intervals) { diff --git a/org/study_deck_02/dsa/intervals/0986-interval-list-intersections.org b/org/study_deck_02/dsa/intervals/0986-interval-list-intersections.org index 3070cdc..3283403 100644 --- a/org/study_deck_02/dsa/intervals/0986-interval-list-intersections.org +++ b/org/study_deck_02/dsa/intervals/0986-interval-list-intersections.org @@ -48,13 +48,13 @@ Output: [] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 986 :lc-lang python3 class Solution: def intervalIntersection(self, firstList: List[List[int]], secondList: List[List[int]]) -> List[List[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 986 class Solution { public: vector> intervalIntersection(vector>& firstList, vector>& secondList) { diff --git a/org/study_deck_02/dsa/intervals/1851-minimum-interval-to-include-each-query.org b/org/study_deck_02/dsa/intervals/1851-minimum-interval-to-include-each-query.org index f2f19d2..a244f9d 100644 --- a/org/study_deck_02/dsa/intervals/1851-minimum-interval-to-include-each-query.org +++ b/org/study_deck_02/dsa/intervals/1851-minimum-interval-to-include-each-query.org @@ -54,13 +54,13 @@ Explanation: The queries are processed as follows: Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1851 :lc-lang python3 class Solution: def minInterval(self, intervals: List[List[int]], queries: List[int]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1851 class Solution { public: vector minInterval(vector>& intervals, vector& queries) { diff --git a/org/study_deck_02/dsa/linked-list/0002-add-two-numbers.org b/org/study_deck_02/dsa/linked-list/0002-add-two-numbers.org index 1a6e88c..d5b4f62 100644 --- a/org/study_deck_02/dsa/linked-list/0002-add-two-numbers.org +++ b/org/study_deck_02/dsa/linked-list/0002-add-two-numbers.org @@ -48,7 +48,7 @@ Output: [8,9,9,9,0,0,0,1] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -59,7 +59,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/0019-remove-nth-node-from-end-of-list.org b/org/study_deck_02/dsa/linked-list/0019-remove-nth-node-from-end-of-list.org index 7ce86b2..a7e0401 100644 --- a/org/study_deck_02/dsa/linked-list/0019-remove-nth-node-from-end-of-list.org +++ b/org/study_deck_02/dsa/linked-list/0019-remove-nth-node-from-end-of-list.org @@ -49,7 +49,7 @@ Output: [1] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 19 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -60,7 +60,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 19 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/0021-merge-two-sorted-lists.org b/org/study_deck_02/dsa/linked-list/0021-merge-two-sorted-lists.org index 0f77e7a..707fe5e 100644 --- a/org/study_deck_02/dsa/linked-list/0021-merge-two-sorted-lists.org +++ b/org/study_deck_02/dsa/linked-list/0021-merge-two-sorted-lists.org @@ -49,7 +49,7 @@ Output: [0] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 21 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -60,7 +60,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 21 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/0023-merge-k-sorted-lists.org b/org/study_deck_02/dsa/linked-list/0023-merge-k-sorted-lists.org index 0fe1087..0f45570 100644 --- a/org/study_deck_02/dsa/linked-list/0023-merge-k-sorted-lists.org +++ b/org/study_deck_02/dsa/linked-list/0023-merge-k-sorted-lists.org @@ -61,7 +61,7 @@ Output: [] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 23 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -72,7 +72,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 23 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/0025-reverse-nodes-in-k-group.org b/org/study_deck_02/dsa/linked-list/0025-reverse-nodes-in-k-group.org index 1c1b415..79304b2 100644 --- a/org/study_deck_02/dsa/linked-list/0025-reverse-nodes-in-k-group.org +++ b/org/study_deck_02/dsa/linked-list/0025-reverse-nodes-in-k-group.org @@ -42,7 +42,7 @@ Output: [3,2,1,4,5] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 25 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -53,7 +53,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 25 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/0138-copy-list-with-random-pointer.org b/org/study_deck_02/dsa/linked-list/0138-copy-list-with-random-pointer.org index 4b48af7..7a22b9a 100644 --- a/org/study_deck_02/dsa/linked-list/0138-copy-list-with-random-pointer.org +++ b/org/study_deck_02/dsa/linked-list/0138-copy-list-with-random-pointer.org @@ -61,7 +61,7 @@ Output: [[3,null],[3,0],[3,null]] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 138 :lc-lang python3 """ # Definition for a Node. class Node: @@ -76,7 +76,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 138 /* // Definition for a Node. class Node { diff --git a/org/study_deck_02/dsa/linked-list/0141-linked-list-cycle.org b/org/study_deck_02/dsa/linked-list/0141-linked-list-cycle.org index a8a7ab6..3e00b45 100644 --- a/org/study_deck_02/dsa/linked-list/0141-linked-list-cycle.org +++ b/org/study_deck_02/dsa/linked-list/0141-linked-list-cycle.org @@ -54,7 +54,7 @@ Explanation: There is no cycle in the linked list. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 141 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): @@ -66,7 +66,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 141 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/0143-reorder-list.org b/org/study_deck_02/dsa/linked-list/0143-reorder-list.org index 5e45faf..3ef7d05 100644 --- a/org/study_deck_02/dsa/linked-list/0143-reorder-list.org +++ b/org/study_deck_02/dsa/linked-list/0143-reorder-list.org @@ -50,7 +50,7 @@ Output: [1,5,2,4,3] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 143 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -64,7 +64,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 143 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/0146-lru-cache.org b/org/study_deck_02/dsa/linked-list/0146-lru-cache.org index 7e5aeeb..3641099 100644 --- a/org/study_deck_02/dsa/linked-list/0146-lru-cache.org +++ b/org/study_deck_02/dsa/linked-list/0146-lru-cache.org @@ -54,7 +54,7 @@ lRUCache.get(4); // return 4 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 146 :lc-lang python3 class LRUCache: def __init__(self, capacity: int): @@ -74,7 +74,7 @@ class LRUCache: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 146 class LRUCache { public: LRUCache(int capacity) { diff --git a/org/study_deck_02/dsa/linked-list/0206-reverse-linked-list.org b/org/study_deck_02/dsa/linked-list/0206-reverse-linked-list.org index d9a323e..a1ef849 100644 --- a/org/study_deck_02/dsa/linked-list/0206-reverse-linked-list.org +++ b/org/study_deck_02/dsa/linked-list/0206-reverse-linked-list.org @@ -45,7 +45,7 @@ Output: [] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 206 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -56,7 +56,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 206 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/0287-find-the-duplicate-number.org b/org/study_deck_02/dsa/linked-list/0287-find-the-duplicate-number.org index 47228ac..1553537 100644 --- a/org/study_deck_02/dsa/linked-list/0287-find-the-duplicate-number.org +++ b/org/study_deck_02/dsa/linked-list/0287-find-the-duplicate-number.org @@ -57,13 +57,13 @@ Follow up: Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 287 :lc-lang python3 class Solution: def findDuplicate(self, nums: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 287 class Solution { public: int findDuplicate(vector& nums) { diff --git a/org/study_deck_02/dsa/linked-list/0725-split-linked-list-in-parts.org b/org/study_deck_02/dsa/linked-list/0725-split-linked-list-in-parts.org index 396eed2..3190a64 100644 --- a/org/study_deck_02/dsa/linked-list/0725-split-linked-list-in-parts.org +++ b/org/study_deck_02/dsa/linked-list/0725-split-linked-list-in-parts.org @@ -47,7 +47,7 @@ The input has been split into consecutive parts with size difference at most 1, Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 725 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -58,7 +58,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 725 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/1472-design-browser-history.org b/org/study_deck_02/dsa/linked-list/1472-design-browser-history.org index f4d6f76..76056c6 100644 --- a/org/study_deck_02/dsa/linked-list/1472-design-browser-history.org +++ b/org/study_deck_02/dsa/linked-list/1472-design-browser-history.org @@ -57,7 +57,7 @@ browserHistory.back(7); // You are in "google.com", you can mo Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1472 :lc-lang python3 class BrowserHistory: def __init__(self, homepage: str): @@ -81,7 +81,7 @@ class BrowserHistory: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1472 class BrowserHistory { public: BrowserHistory(string homepage) { diff --git a/org/study_deck_02/dsa/linked-list/1721-swapping-nodes-in-a-linked-list.org b/org/study_deck_02/dsa/linked-list/1721-swapping-nodes-in-a-linked-list.org index 9af6c99..4953df2 100644 --- a/org/study_deck_02/dsa/linked-list/1721-swapping-nodes-in-a-linked-list.org +++ b/org/study_deck_02/dsa/linked-list/1721-swapping-nodes-in-a-linked-list.org @@ -38,7 +38,7 @@ Output: [7,9,6,6,8,7,3,0,9,5] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1721 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -49,7 +49,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1721 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/linked-list/2487-remove-nodes-from-linked-list.org b/org/study_deck_02/dsa/linked-list/2487-remove-nodes-from-linked-list.org index 10a329d..e85408e 100644 --- a/org/study_deck_02/dsa/linked-list/2487-remove-nodes-from-linked-list.org +++ b/org/study_deck_02/dsa/linked-list/2487-remove-nodes-from-linked-list.org @@ -43,7 +43,7 @@ Explanation: Every node has value 1, so no nodes are removed. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2487 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -54,7 +54,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2487 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/math-geometry/0009-palindrome-number.org b/org/study_deck_02/dsa/math-geometry/0009-palindrome-number.org index 24887ec..4e02205 100644 --- a/org/study_deck_02/dsa/math-geometry/0009-palindrome-number.org +++ b/org/study_deck_02/dsa/math-geometry/0009-palindrome-number.org @@ -46,13 +46,13 @@ Explanation: Reads 01 from right to left. Therefore it is not a palindrome. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 9 :lc-lang python3 class Solution: def isPalindrome(self, x: int) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 9 class Solution { public: bool isPalindrome(int x) { diff --git a/org/study_deck_02/dsa/math-geometry/0012-integer-to-roman.org b/org/study_deck_02/dsa/math-geometry/0012-integer-to-roman.org index 5373380..1cbe6e4 100644 --- a/org/study_deck_02/dsa/math-geometry/0012-integer-to-roman.org +++ b/org/study_deck_02/dsa/math-geometry/0012-integer-to-roman.org @@ -98,13 +98,13 @@ Note: 49 is not 1 (I) less of 50 (L) because the conversion is based on decimal Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 12 :lc-lang python3 class Solution: def intToRoman(self, num: int) -> str: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 12 class Solution { public: string intToRoman(int num) { diff --git a/org/study_deck_02/dsa/math-geometry/0043-multiply-strings.org b/org/study_deck_02/dsa/math-geometry/0043-multiply-strings.org index fd47e39..d0a0f2a 100644 --- a/org/study_deck_02/dsa/math-geometry/0043-multiply-strings.org +++ b/org/study_deck_02/dsa/math-geometry/0043-multiply-strings.org @@ -36,13 +36,13 @@ Output: "56088" Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 43 :lc-lang python3 class Solution: def multiply(self, num1: str, num2: str) -> str: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 43 class Solution { public: string multiply(string num1, string num2) { diff --git a/org/study_deck_02/dsa/math-geometry/0048-rotate-image.org b/org/study_deck_02/dsa/math-geometry/0048-rotate-image.org index 94a75a0..26a35d4 100644 --- a/org/study_deck_02/dsa/math-geometry/0048-rotate-image.org +++ b/org/study_deck_02/dsa/math-geometry/0048-rotate-image.org @@ -38,7 +38,7 @@ Output: [[15,13,2,5],[14,3,4,1],[12,6,8,9],[16,7,10,11]] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 48 :lc-lang python3 class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ @@ -47,7 +47,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 48 class Solution { public: void rotate(vector>& matrix) { diff --git a/org/study_deck_02/dsa/math-geometry/0050-pow-x-n.org b/org/study_deck_02/dsa/math-geometry/0050-pow-x-n.org index 543fff2..b6e29dc 100644 --- a/org/study_deck_02/dsa/math-geometry/0050-pow-x-n.org +++ b/org/study_deck_02/dsa/math-geometry/0050-pow-x-n.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 50 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 50 #+end_src diff --git a/org/study_deck_02/dsa/math-geometry/0054-spiral-matrix.org b/org/study_deck_02/dsa/math-geometry/0054-spiral-matrix.org index 1474ae9..1b30549 100644 --- a/org/study_deck_02/dsa/math-geometry/0054-spiral-matrix.org +++ b/org/study_deck_02/dsa/math-geometry/0054-spiral-matrix.org @@ -38,13 +38,13 @@ Output: [1,2,3,4,8,12,11,10,9,5,6,7] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 54 :lc-lang python3 class Solution: def spiralOrder(self, matrix: List[List[int]]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 54 class Solution { public: vector spiralOrder(vector>& matrix) { diff --git a/org/study_deck_02/dsa/math-geometry/0066-plus-one.org b/org/study_deck_02/dsa/math-geometry/0066-plus-one.org index ee7f35d..a5a7bd6 100644 --- a/org/study_deck_02/dsa/math-geometry/0066-plus-one.org +++ b/org/study_deck_02/dsa/math-geometry/0066-plus-one.org @@ -56,13 +56,13 @@ Thus, the result should be [1,0]. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 66 :lc-lang python3 class Solution: def plusOne(self, digits: List[int]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 66 class Solution { public: vector plusOne(vector& digits) { diff --git a/org/study_deck_02/dsa/math-geometry/0073-set-matrix-zeroes.org b/org/study_deck_02/dsa/math-geometry/0073-set-matrix-zeroes.org index 626ce3d..953305b 100644 --- a/org/study_deck_02/dsa/math-geometry/0073-set-matrix-zeroes.org +++ b/org/study_deck_02/dsa/math-geometry/0073-set-matrix-zeroes.org @@ -48,7 +48,7 @@ Output: [[0,0,0,0],[0,4,5,0],[0,3,1,0]] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 73 :lc-lang python3 class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """ @@ -57,7 +57,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 73 class Solution { public: void setZeroes(vector>& matrix) { diff --git a/org/study_deck_02/dsa/math-geometry/0202-happy-number.org b/org/study_deck_02/dsa/math-geometry/0202-happy-number.org index abb283f..dc0c94c 100644 --- a/org/study_deck_02/dsa/math-geometry/0202-happy-number.org +++ b/org/study_deck_02/dsa/math-geometry/0202-happy-number.org @@ -47,13 +47,13 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 202 :lc-lang python3 class Solution: def isHappy(self, n: int) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 202 class Solution { public: bool isHappy(int n) { diff --git a/org/study_deck_02/dsa/math-geometry/0296-best-meeting-point.org b/org/study_deck_02/dsa/math-geometry/0296-best-meeting-point.org index aa4cc38..34b4c06 100644 --- a/org/study_deck_02/dsa/math-geometry/0296-best-meeting-point.org +++ b/org/study_deck_02/dsa/math-geometry/0296-best-meeting-point.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 296 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 296 #+end_src diff --git a/org/study_deck_02/dsa/math-geometry/0840-magic-squares-in-grid.org b/org/study_deck_02/dsa/math-geometry/0840-magic-squares-in-grid.org index 0966611..b7f6c06 100644 --- a/org/study_deck_02/dsa/math-geometry/0840-magic-squares-in-grid.org +++ b/org/study_deck_02/dsa/math-geometry/0840-magic-squares-in-grid.org @@ -48,13 +48,13 @@ Output: 0 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 840 :lc-lang python3 class Solution: def numMagicSquaresInside(self, grid: List[List[int]]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 840 class Solution { public: int numMagicSquaresInside(vector>& grid) { diff --git a/org/study_deck_02/dsa/math-geometry/1780-check-if-number-is-a-sum-of-powers-of-three.org b/org/study_deck_02/dsa/math-geometry/1780-check-if-number-is-a-sum-of-powers-of-three.org index 693deb1..e952353 100644 --- a/org/study_deck_02/dsa/math-geometry/1780-check-if-number-is-a-sum-of-powers-of-three.org +++ b/org/study_deck_02/dsa/math-geometry/1780-check-if-number-is-a-sum-of-powers-of-three.org @@ -45,13 +45,13 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1780 :lc-lang python3 class Solution: def checkPowersOfThree(self, n: int) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1780 class Solution { public: bool checkPowersOfThree(int n) { diff --git a/org/study_deck_02/dsa/math-geometry/2013-detect-squares.org b/org/study_deck_02/dsa/math-geometry/2013-detect-squares.org index eaa5aed..870bffd 100644 --- a/org/study_deck_02/dsa/math-geometry/2013-detect-squares.org +++ b/org/study_deck_02/dsa/math-geometry/2013-detect-squares.org @@ -57,7 +57,7 @@ detectSquares.count([11, 10]); // return 2. You can choose: Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2013 :lc-lang python3 class DetectSquares: def __init__(self): @@ -77,7 +77,7 @@ class DetectSquares: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2013 class DetectSquares { public: DetectSquares() { diff --git a/org/study_deck_02/dsa/math-geometry/2326-spiral-matrix-iv.org b/org/study_deck_02/dsa/math-geometry/2326-spiral-matrix-iv.org index 47fa323..16e79e7 100644 --- a/org/study_deck_02/dsa/math-geometry/2326-spiral-matrix-iv.org +++ b/org/study_deck_02/dsa/math-geometry/2326-spiral-matrix-iv.org @@ -48,7 +48,7 @@ The last space in the matrix is set to -1. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2326 :lc-lang python3 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): @@ -59,7 +59,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2326 /** * Definition for singly-linked list. * struct ListNode { diff --git a/org/study_deck_02/dsa/math-geometry/2698-find-the-punishment-number-of-an-integer.org b/org/study_deck_02/dsa/math-geometry/2698-find-the-punishment-number-of-an-integer.org index b2e3cdb..68f4eca 100644 --- a/org/study_deck_02/dsa/math-geometry/2698-find-the-punishment-number-of-an-integer.org +++ b/org/study_deck_02/dsa/math-geometry/2698-find-the-punishment-number-of-an-integer.org @@ -49,13 +49,13 @@ Hence, the punishment number of 37 is 1 + 81 + 100 + 1296 = 1478 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 2698 :lc-lang python3 class Solution: def punishmentNumber(self, n: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 2698 class Solution { public: int punishmentNumber(int n) { diff --git a/org/study_deck_02/dsa/sliding-window/0003-longest-substring-without-repeating-characters.org b/org/study_deck_02/dsa/sliding-window/0003-longest-substring-without-repeating-characters.org index bc90f04..8402ae4 100644 --- a/org/study_deck_02/dsa/sliding-window/0003-longest-substring-without-repeating-characters.org +++ b/org/study_deck_02/dsa/sliding-window/0003-longest-substring-without-repeating-characters.org @@ -47,13 +47,13 @@ Notice that the answer must be a substring, "pwke" is a subsequence and not a su Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 3 :lc-lang python3 class Solution: def lengthOfLongestSubstring(self, s: str) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 3 class Solution { public: int lengthOfLongestSubstring(string s) { diff --git a/org/study_deck_02/dsa/sliding-window/0076-minimum-window-substring.org b/org/study_deck_02/dsa/sliding-window/0076-minimum-window-substring.org index 1f56978..0e6f271 100644 --- a/org/study_deck_02/dsa/sliding-window/0076-minimum-window-substring.org +++ b/org/study_deck_02/dsa/sliding-window/0076-minimum-window-substring.org @@ -55,13 +55,13 @@ Since the largest window of s only has one 'a', return empty string. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 76 :lc-lang python3 class Solution: def minWindow(self, s: str, t: str) -> str: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 76 class Solution { public: string minWindow(string s, string t) { diff --git a/org/study_deck_02/dsa/sliding-window/0121-best-time-to-buy-and-sell-stock.org b/org/study_deck_02/dsa/sliding-window/0121-best-time-to-buy-and-sell-stock.org index 2feb06b..1248a43 100644 --- a/org/study_deck_02/dsa/sliding-window/0121-best-time-to-buy-and-sell-stock.org +++ b/org/study_deck_02/dsa/sliding-window/0121-best-time-to-buy-and-sell-stock.org @@ -41,13 +41,13 @@ Explanation: In this case, no transactions are done and the max profit = 0. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 121 :lc-lang python3 class Solution: def maxProfit(self, prices: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 121 class Solution { public: int maxProfit(vector& prices) { diff --git a/org/study_deck_02/dsa/sliding-window/0239-sliding-window-maximum.org b/org/study_deck_02/dsa/sliding-window/0239-sliding-window-maximum.org index 25e88d8..7dcee38 100644 --- a/org/study_deck_02/dsa/sliding-window/0239-sliding-window-maximum.org +++ b/org/study_deck_02/dsa/sliding-window/0239-sliding-window-maximum.org @@ -47,13 +47,13 @@ Output: [1] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 239 :lc-lang python3 class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 239 class Solution { public: vector maxSlidingWindow(vector& nums, int k) { diff --git a/org/study_deck_02/dsa/sliding-window/0424-longest-repeating-character-replacement.org b/org/study_deck_02/dsa/sliding-window/0424-longest-repeating-character-replacement.org index 43e550f..91d70a1 100644 --- a/org/study_deck_02/dsa/sliding-window/0424-longest-repeating-character-replacement.org +++ b/org/study_deck_02/dsa/sliding-window/0424-longest-repeating-character-replacement.org @@ -42,13 +42,13 @@ There may exists other ways to achieve this answer too. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 424 :lc-lang python3 class Solution: def characterReplacement(self, s: str, k: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 424 class Solution { public: int characterReplacement(string s, int k) { diff --git a/org/study_deck_02/dsa/sliding-window/0567-permutation-in-string.org b/org/study_deck_02/dsa/sliding-window/0567-permutation-in-string.org index d12f7cf..5839891 100644 --- a/org/study_deck_02/dsa/sliding-window/0567-permutation-in-string.org +++ b/org/study_deck_02/dsa/sliding-window/0567-permutation-in-string.org @@ -37,13 +37,13 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 567 :lc-lang python3 class Solution: def checkInclusion(self, s1: str, s2: str) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 567 class Solution { public: bool checkInclusion(string s1, string s2) { diff --git a/org/study_deck_02/dsa/sliding-window/3306-count-of-substrings-containing-every-vowel-and-k-consonants-ii.org b/org/study_deck_02/dsa/sliding-window/3306-count-of-substrings-containing-every-vowel-and-k-consonants-ii.org index 6910413..bfbe0aa 100644 --- a/org/study_deck_02/dsa/sliding-window/3306-count-of-substrings-containing-every-vowel-and-k-consonants-ii.org +++ b/org/study_deck_02/dsa/sliding-window/3306-count-of-substrings-containing-every-vowel-and-k-consonants-ii.org @@ -56,13 +56,13 @@ The substrings with every vowel and one consonant are: Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 3306 :lc-lang python3 class Solution: def countOfSubstrings(self, word: str, k: int) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 3306 class Solution { public: long long countOfSubstrings(string word, int k) { diff --git a/org/study_deck_02/dsa/stack/0020-valid-parentheses.org b/org/study_deck_02/dsa/stack/0020-valid-parentheses.org index bc27d89..d61f7f7 100644 --- a/org/study_deck_02/dsa/stack/0020-valid-parentheses.org +++ b/org/study_deck_02/dsa/stack/0020-valid-parentheses.org @@ -54,13 +54,13 @@ An input string is valid if: Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 20 :lc-lang python3 class Solution: def isValid(self, s: str) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 20 class Solution { public: bool isValid(string s) { diff --git a/org/study_deck_02/dsa/stack/0084-largest-rectangle-in-histogram.org b/org/study_deck_02/dsa/stack/0084-largest-rectangle-in-histogram.org index c1fbe22..b7a464a 100644 --- a/org/study_deck_02/dsa/stack/0084-largest-rectangle-in-histogram.org +++ b/org/study_deck_02/dsa/stack/0084-largest-rectangle-in-histogram.org @@ -36,13 +36,13 @@ Output: 4 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 84 :lc-lang python3 class Solution: def largestRectangleArea(self, heights: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 84 class Solution { public: int largestRectangleArea(vector& heights) { diff --git a/org/study_deck_02/dsa/stack/0150-evaluate-reverse-polish-notation.org b/org/study_deck_02/dsa/stack/0150-evaluate-reverse-polish-notation.org index 8a8f1c1..c8b0050 100644 --- a/org/study_deck_02/dsa/stack/0150-evaluate-reverse-polish-notation.org +++ b/org/study_deck_02/dsa/stack/0150-evaluate-reverse-polish-notation.org @@ -68,13 +68,13 @@ Explanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 150 :lc-lang python3 class Solution: def evalRPN(self, tokens: List[str]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 150 class Solution { public: int evalRPN(vector& tokens) { diff --git a/org/study_deck_02/dsa/stack/0155-min-stack.org b/org/study_deck_02/dsa/stack/0155-min-stack.org index cdee1a1..925b5fe 100644 --- a/org/study_deck_02/dsa/stack/0155-min-stack.org +++ b/org/study_deck_02/dsa/stack/0155-min-stack.org @@ -55,7 +55,7 @@ minStack.getMin(); // return -2 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 155 :lc-lang python3 class MinStack: def __init__(self): @@ -83,7 +83,7 @@ class MinStack: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 155 class MinStack { public: MinStack() { diff --git a/org/study_deck_02/dsa/stack/0682-baseball-game.org b/org/study_deck_02/dsa/stack/0682-baseball-game.org index 8f90af1..e1f345a 100644 --- a/org/study_deck_02/dsa/stack/0682-baseball-game.org +++ b/org/study_deck_02/dsa/stack/0682-baseball-game.org @@ -90,13 +90,13 @@ Since the record is empty, the total sum is 0. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 682 :lc-lang python3 class Solution: def calPoints(self, operations: List[str]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 682 class Solution { public: int calPoints(vector& operations) { diff --git a/org/study_deck_02/dsa/stack/0726-number-of-atoms.org b/org/study_deck_02/dsa/stack/0726-number-of-atoms.org index 3cb93ee..d6f936a 100644 --- a/org/study_deck_02/dsa/stack/0726-number-of-atoms.org +++ b/org/study_deck_02/dsa/stack/0726-number-of-atoms.org @@ -66,13 +66,13 @@ Explanation: The count of elements are {'K': 4, 'N': 2, 'O&# Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 726 :lc-lang python3 class Solution: def countOfAtoms(self, formula: str) -> str: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 726 class Solution { public: string countOfAtoms(string formula) { diff --git a/org/study_deck_02/dsa/stack/0739-daily-temperatures.org b/org/study_deck_02/dsa/stack/0739-daily-temperatures.org index 158734e..7d0b5c6 100644 --- a/org/study_deck_02/dsa/stack/0739-daily-temperatures.org +++ b/org/study_deck_02/dsa/stack/0739-daily-temperatures.org @@ -39,13 +39,13 @@ Output: [1,1,0] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 739 :lc-lang python3 class Solution: def dailyTemperatures(self, temperatures: List[int]) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 739 class Solution { public: vector dailyTemperatures(vector& temperatures) { diff --git a/org/study_deck_02/dsa/stack/0853-car-fleet.org b/org/study_deck_02/dsa/stack/0853-car-fleet.org index c654a76..a604c9d 100644 --- a/org/study_deck_02/dsa/stack/0853-car-fleet.org +++ b/org/study_deck_02/dsa/stack/0853-car-fleet.org @@ -70,13 +70,13 @@ There is only one car, hence there is only one fleet. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 853 :lc-lang python3 class Solution: def carFleet(self, target: int, position: List[int], speed: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 853 class Solution { public: int carFleet(int target, vector& position, vector& speed) { diff --git a/org/study_deck_02/dsa/stack/0901-online-stock-span.org b/org/study_deck_02/dsa/stack/0901-online-stock-span.org index aa3bc8a..d471ef0 100644 --- a/org/study_deck_02/dsa/stack/0901-online-stock-span.org +++ b/org/study_deck_02/dsa/stack/0901-online-stock-span.org @@ -50,7 +50,7 @@ stockSpanner.next(85); // return 6 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 901 :lc-lang python3 class StockSpanner: def __init__(self): @@ -66,7 +66,7 @@ class StockSpanner: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 901 class StockSpanner { public: StockSpanner() { diff --git a/org/study_deck_02/dsa/stack/1544-make-the-string-great.org b/org/study_deck_02/dsa/stack/1544-make-the-string-great.org index 95fb110..3bb493a 100644 --- a/org/study_deck_02/dsa/stack/1544-make-the-string-great.org +++ b/org/study_deck_02/dsa/stack/1544-make-the-string-great.org @@ -59,13 +59,13 @@ Output: "s" Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1544 :lc-lang python3 class Solution: def makeGood(self, s: str) -> str: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1544 class Solution { public: string makeGood(string s) { diff --git a/org/study_deck_02/dsa/trees/0098-validate-binary-search-tree.org b/org/study_deck_02/dsa/trees/0098-validate-binary-search-tree.org index 95b551e..785f699 100644 --- a/org/study_deck_02/dsa/trees/0098-validate-binary-search-tree.org +++ b/org/study_deck_02/dsa/trees/0098-validate-binary-search-tree.org @@ -43,7 +43,7 @@ Explanation: The root node's value is 5 but its right child's value is 4 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 98 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -55,7 +55,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 98 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0100-same-tree.org b/org/study_deck_02/dsa/trees/0100-same-tree.org index bdcee07..90964bf 100644 --- a/org/study_deck_02/dsa/trees/0100-same-tree.org +++ b/org/study_deck_02/dsa/trees/0100-same-tree.org @@ -45,7 +45,7 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 100 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -57,7 +57,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 100 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0102-binary-tree-level-order-traversal.org b/org/study_deck_02/dsa/trees/0102-binary-tree-level-order-traversal.org index d9d5965..2854ac1 100644 --- a/org/study_deck_02/dsa/trees/0102-binary-tree-level-order-traversal.org +++ b/org/study_deck_02/dsa/trees/0102-binary-tree-level-order-traversal.org @@ -43,7 +43,7 @@ Output: [] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 102 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -55,7 +55,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 102 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0104-maximum-depth-of-binary-tree.org b/org/study_deck_02/dsa/trees/0104-maximum-depth-of-binary-tree.org index d577f31..0f2faaf 100644 --- a/org/study_deck_02/dsa/trees/0104-maximum-depth-of-binary-tree.org +++ b/org/study_deck_02/dsa/trees/0104-maximum-depth-of-binary-tree.org @@ -36,7 +36,7 @@ Output: 2 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 104 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -48,7 +48,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 104 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0105-construct-binary-tree-from-preorder-and-inorder-traversal.org b/org/study_deck_02/dsa/trees/0105-construct-binary-tree-from-preorder-and-inorder-traversal.org index 216dc0b..a6b1858 100644 --- a/org/study_deck_02/dsa/trees/0105-construct-binary-tree-from-preorder-and-inorder-traversal.org +++ b/org/study_deck_02/dsa/trees/0105-construct-binary-tree-from-preorder-and-inorder-traversal.org @@ -44,7 +44,7 @@ Output: [-1] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 105 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -56,7 +56,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 105 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0110-balanced-binary-tree.org b/org/study_deck_02/dsa/trees/0110-balanced-binary-tree.org index 46abefa..f18d9d7 100644 --- a/org/study_deck_02/dsa/trees/0110-balanced-binary-tree.org +++ b/org/study_deck_02/dsa/trees/0110-balanced-binary-tree.org @@ -43,7 +43,7 @@ Output: true Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 110 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -55,7 +55,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 110 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0124-binary-tree-maximum-path-sum.org b/org/study_deck_02/dsa/trees/0124-binary-tree-maximum-path-sum.org index aa4c5ae..89de955 100644 --- a/org/study_deck_02/dsa/trees/0124-binary-tree-maximum-path-sum.org +++ b/org/study_deck_02/dsa/trees/0124-binary-tree-maximum-path-sum.org @@ -40,7 +40,7 @@ Explanation: The optimal path is 15 -> 20 -> 7 with a path sum of 15 + 20 + 7 = Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 124 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -52,7 +52,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 124 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0199-binary-tree-right-side-view.org b/org/study_deck_02/dsa/trees/0199-binary-tree-right-side-view.org index 1c96e68..f5271d4 100644 --- a/org/study_deck_02/dsa/trees/0199-binary-tree-right-side-view.org +++ b/org/study_deck_02/dsa/trees/0199-binary-tree-right-side-view.org @@ -44,7 +44,7 @@ Given the ~root~ of a binary tree, imagine yourself standing on the *right side* Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 199 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -56,7 +56,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 199 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0226-invert-binary-tree.org b/org/study_deck_02/dsa/trees/0226-invert-binary-tree.org index a345c93..9ce0845 100644 --- a/org/study_deck_02/dsa/trees/0226-invert-binary-tree.org +++ b/org/study_deck_02/dsa/trees/0226-invert-binary-tree.org @@ -43,7 +43,7 @@ Output: [] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 226 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -55,7 +55,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 226 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0230-kth-smallest-element-in-a-bst.org b/org/study_deck_02/dsa/trees/0230-kth-smallest-element-in-a-bst.org index e06f0ed..58a7a67 100644 --- a/org/study_deck_02/dsa/trees/0230-kth-smallest-element-in-a-bst.org +++ b/org/study_deck_02/dsa/trees/0230-kth-smallest-element-in-a-bst.org @@ -38,7 +38,7 @@ Output: 3 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 230 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -50,7 +50,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 230 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0235-lowest-common-ancestor-of-a-binary-search-tree.org b/org/study_deck_02/dsa/trees/0235-lowest-common-ancestor-of-a-binary-search-tree.org index 7156571..24a7030 100644 --- a/org/study_deck_02/dsa/trees/0235-lowest-common-ancestor-of-a-binary-search-tree.org +++ b/org/study_deck_02/dsa/trees/0235-lowest-common-ancestor-of-a-binary-search-tree.org @@ -53,7 +53,7 @@ Output: 2 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 235 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): @@ -66,7 +66,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 235 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0297-serialize-and-deserialize-binary-tree.org b/org/study_deck_02/dsa/trees/0297-serialize-and-deserialize-binary-tree.org index 68f8643..e303aa1 100644 --- a/org/study_deck_02/dsa/trees/0297-serialize-and-deserialize-binary-tree.org +++ b/org/study_deck_02/dsa/trees/0297-serialize-and-deserialize-binary-tree.org @@ -38,7 +38,7 @@ Output: [] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 297 :lc-lang python3 # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): @@ -71,7 +71,7 @@ class Codec: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 297 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0543-diameter-of-binary-tree.org b/org/study_deck_02/dsa/trees/0543-diameter-of-binary-tree.org index 054c40e..c7a5515 100644 --- a/org/study_deck_02/dsa/trees/0543-diameter-of-binary-tree.org +++ b/org/study_deck_02/dsa/trees/0543-diameter-of-binary-tree.org @@ -39,7 +39,7 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 543 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -51,7 +51,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 543 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0572-subtree-of-another-tree.org b/org/study_deck_02/dsa/trees/0572-subtree-of-another-tree.org index e682d94..c400d2d 100644 --- a/org/study_deck_02/dsa/trees/0572-subtree-of-another-tree.org +++ b/org/study_deck_02/dsa/trees/0572-subtree-of-another-tree.org @@ -40,7 +40,7 @@ Output: false Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 572 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -52,7 +52,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 572 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/0590-n-ary-tree-postorder-traversal.org b/org/study_deck_02/dsa/trees/0590-n-ary-tree-postorder-traversal.org index 3cee02f..5b86fb3 100644 --- a/org/study_deck_02/dsa/trees/0590-n-ary-tree-postorder-traversal.org +++ b/org/study_deck_02/dsa/trees/0590-n-ary-tree-postorder-traversal.org @@ -40,7 +40,7 @@ Output: [2,6,14,11,7,3,12,8,4,13,9,10,5,1] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 590 :lc-lang python3 """ # Definition for a Node. class Node: @@ -54,7 +54,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 590 /* // Definition for a Node. class Node { diff --git a/org/study_deck_02/dsa/trees/1028-recover-a-tree-from-preorder-traversal.org b/org/study_deck_02/dsa/trees/1028-recover-a-tree-from-preorder-traversal.org index 8f109e9..3411b2c 100644 --- a/org/study_deck_02/dsa/trees/1028-recover-a-tree-from-preorder-traversal.org +++ b/org/study_deck_02/dsa/trees/1028-recover-a-tree-from-preorder-traversal.org @@ -49,7 +49,7 @@ Output: [1,401,null,349,88,90] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1028 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -61,7 +61,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1028 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/trees/1376-time-needed-to-inform-all-employees.org b/org/study_deck_02/dsa/trees/1376-time-needed-to-inform-all-employees.org index 5713ef4..a7ca3d6 100644 --- a/org/study_deck_02/dsa/trees/1376-time-needed-to-inform-all-employees.org +++ b/org/study_deck_02/dsa/trees/1376-time-needed-to-inform-all-employees.org @@ -59,13 +59,13 @@ The tree structure of the employees in the company is shown. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1376 :lc-lang python3 class Solution: def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1376 class Solution { public: int numOfMinutes(int n, int headID, vector& manager, vector& informTime) { diff --git a/org/study_deck_02/dsa/trees/1448-count-good-nodes-in-binary-tree.org b/org/study_deck_02/dsa/trees/1448-count-good-nodes-in-binary-tree.org index 7f5accc..606d0eb 100644 --- a/org/study_deck_02/dsa/trees/1448-count-good-nodes-in-binary-tree.org +++ b/org/study_deck_02/dsa/trees/1448-count-good-nodes-in-binary-tree.org @@ -56,7 +56,7 @@ Explanation: Root is considered as good. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1448 :lc-lang python3 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): @@ -68,7 +68,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1448 /** * Definition for a binary tree node. * struct TreeNode { diff --git a/org/study_deck_02/dsa/tries/0208-implement-trie-prefix-tree.org b/org/study_deck_02/dsa/tries/0208-implement-trie-prefix-tree.org index 7d186b1..5f39f42 100644 --- a/org/study_deck_02/dsa/tries/0208-implement-trie-prefix-tree.org +++ b/org/study_deck_02/dsa/tries/0208-implement-trie-prefix-tree.org @@ -49,7 +49,7 @@ trie.search("app"); // return True Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 208 :lc-lang python3 class Trie: def __init__(self): @@ -73,7 +73,7 @@ class Trie: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 208 class Trie { public: Trie() { diff --git a/org/study_deck_02/dsa/tries/0211-design-add-and-search-words-data-structure.org b/org/study_deck_02/dsa/tries/0211-design-add-and-search-words-data-structure.org index 03f06c2..1ffbb13 100644 --- a/org/study_deck_02/dsa/tries/0211-design-add-and-search-words-data-structure.org +++ b/org/study_deck_02/dsa/tries/0211-design-add-and-search-words-data-structure.org @@ -52,7 +52,7 @@ wordDictionary.search("b.."); // return True Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 211 :lc-lang python3 class WordDictionary: def __init__(self): @@ -72,7 +72,7 @@ class WordDictionary: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 211 class WordDictionary { public: WordDictionary() { diff --git a/org/study_deck_02/dsa/tries/0212-word-search-ii.org b/org/study_deck_02/dsa/tries/0212-word-search-ii.org index 32d5ca2..0425aa3 100644 --- a/org/study_deck_02/dsa/tries/0212-word-search-ii.org +++ b/org/study_deck_02/dsa/tries/0212-word-search-ii.org @@ -48,13 +48,13 @@ Output: [] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 212 :lc-lang python3 class Solution: def findWords(self, board: List[List[str]], words: List[str]) -> List[str]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 212 class Solution { public: vector findWords(vector>& board, vector& words) { diff --git a/org/study_deck_02/dsa/tries/1166-design-file-system.org b/org/study_deck_02/dsa/tries/1166-design-file-system.org index 62c2caa..8e1a1e7 100644 --- a/org/study_deck_02/dsa/tries/1166-design-file-system.org +++ b/org/study_deck_02/dsa/tries/1166-design-file-system.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 1166 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 1166 #+end_src diff --git a/org/study_deck_02/dsa/two-pointers/0011-container-with-most-water.org b/org/study_deck_02/dsa/two-pointers/0011-container-with-most-water.org index a52033d..0a17719 100644 --- a/org/study_deck_02/dsa/two-pointers/0011-container-with-most-water.org +++ b/org/study_deck_02/dsa/two-pointers/0011-container-with-most-water.org @@ -43,13 +43,13 @@ Output: 1 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 11 :lc-lang python3 class Solution: def maxArea(self, height: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 11 class Solution { public: int maxArea(vector& height) { diff --git a/org/study_deck_02/dsa/two-pointers/0015-3sum.org b/org/study_deck_02/dsa/two-pointers/0015-3sum.org index 02cc369..7552d34 100644 --- a/org/study_deck_02/dsa/two-pointers/0015-3sum.org +++ b/org/study_deck_02/dsa/two-pointers/0015-3sum.org @@ -53,13 +53,13 @@ Explanation: The only possible triplet sums up to 0. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 15 :lc-lang python3 class Solution: def threeSum(self, nums: list[int]) -> list[list[int]]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 15 class Solution { public: vector> threeSum(vector& nums) { diff --git a/org/study_deck_02/dsa/two-pointers/0042-trapping-rain-water.org b/org/study_deck_02/dsa/two-pointers/0042-trapping-rain-water.org index 3482e31..37e3f0b 100644 --- a/org/study_deck_02/dsa/two-pointers/0042-trapping-rain-water.org +++ b/org/study_deck_02/dsa/two-pointers/0042-trapping-rain-water.org @@ -37,13 +37,13 @@ Output: 9 Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 42 :lc-lang python3 class Solution: def trap(self, height: List[int]) -> int: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 42 class Solution { public: int trap(vector& height) { diff --git a/org/study_deck_02/dsa/two-pointers/0125-valid-palindrome.org b/org/study_deck_02/dsa/two-pointers/0125-valid-palindrome.org index dcf9711..b149a39 100644 --- a/org/study_deck_02/dsa/two-pointers/0125-valid-palindrome.org +++ b/org/study_deck_02/dsa/two-pointers/0125-valid-palindrome.org @@ -49,13 +49,13 @@ Since an empty string reads the same forward and backward, it is a palindrome. Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 125 :lc-lang python3 class Solution: def isPalindrome(self, s: str) -> bool: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 125 class Solution { public: bool isPalindrome(string s) { diff --git a/org/study_deck_02/dsa/two-pointers/0167-two-sum-ii-input-array-is-sorted.org b/org/study_deck_02/dsa/two-pointers/0167-two-sum-ii-input-array-is-sorted.org index 46b6437..0ea543a 100644 --- a/org/study_deck_02/dsa/two-pointers/0167-two-sum-ii-input-array-is-sorted.org +++ b/org/study_deck_02/dsa/two-pointers/0167-two-sum-ii-input-array-is-sorted.org @@ -58,13 +58,13 @@ Explanation: The sum of -1 and 0 is -1. Therefore index1 = 1, index2 = 2. We ret Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 167 :lc-lang python3 class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 167 class Solution { public: vector twoSum(vector& numbers, int target) { diff --git a/org/study_deck_02/dsa/two-pointers/0259-3sum-smaller.org b/org/study_deck_02/dsa/two-pointers/0259-3sum-smaller.org index e5400fb..fd85830 100644 --- a/org/study_deck_02/dsa/two-pointers/0259-3sum-smaller.org +++ b/org/study_deck_02/dsa/two-pointers/0259-3sum-smaller.org @@ -8,11 +8,11 @@ Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 259 :lc-lang python3 #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 259 #+end_src diff --git a/org/study_deck_02/dsa/two-pointers/0344-reverse-string.org b/org/study_deck_02/dsa/two-pointers/0344-reverse-string.org index 4c7dab3..73776f3 100644 --- a/org/study_deck_02/dsa/two-pointers/0344-reverse-string.org +++ b/org/study_deck_02/dsa/two-pointers/0344-reverse-string.org @@ -34,7 +34,7 @@ Output: ["h","a","n","n","a","H"] Write your approach here. ** TODO Python -#+begin_src python +#+begin_src python :lc-problem 344 :lc-lang python3 class Solution: def reverseString(self, s: List[str]) -> None: """ @@ -43,7 +43,7 @@ class Solution: #+end_src ** TODO C++ -#+begin_src cpp +#+begin_src cpp :lc-problem 344 class Solution { public: void reverseString(vector& s) { diff --git a/org/study_deck_02/lc-org.el b/org/study_deck_02/lc-org.el index 1fa760a..fe94e55 100644 --- a/org/study_deck_02/lc-org.el +++ b/org/study_deck_02/lc-org.el @@ -51,10 +51,6 @@ Returns a plist (:problem :lang :input :code) or signals an error." (user-error "No :lc-problem header arg on this source block")) (list :problem (format "%s" problem) :lang lc-lang :input input :code body))) -(defun lc-org--lc-command (&rest args) - "Build shell command string from lc-org-bin and ARGS." - (mapconcat #'shell-quote-argument (cons lc-org-bin (list-to-vector args)) " ")) - (defun lc-org--run-command (cmd) "Run CMD in a compilation buffer named *lc*." (let ((buf (get-buffer-create "*lc*"))) @@ -75,6 +71,30 @@ Returns a plist (:problem :lang :input :code) or signals an error." (display-buffer (process-buffer proc))))) (display-buffer buf))) +(defvar lc-org-mode-map + (let ((map (make-sparse-keymap)) + (prefix (make-sparse-keymap))) + (define-key prefix (kbd "s") #'lc-org-submit) + (define-key prefix (kbd "r") #'lc-org-run) + (define-key prefix (kbd "t") #'lc-org-status) + (define-key prefix (kbd "p") #'lc-org-show-problem) + (define-key prefix (kbd "d") #'lc-org-daily) + (define-key map (kbd "C-c l") prefix) + map) + "Keymap for `lc-org-mode'.") + +;;;###autoload +(define-minor-mode lc-org-mode + "Minor mode for LeetCode CLI integration in org source blocks. +Keybindings under C-c l: + s submit — submit current block + r run — run with test input + t status — check submission status + p problem — show problem description + d daily — today's daily challenge" + :lighter " LC" + :keymap lc-org-mode-map) + ;;;###autoload (defun lc-org-submit () "Submit the current org source block to LeetCode."