Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .amazonq/plans/algo_master_75_tuples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
algo_master_75_tuples = [
(2, "Add Two Numbers"),
(3, "Longest Substring Without Repeating Characters"),
(4, "Median of Two Sorted Arrays"),
(7, "Reverse Integer"),
(11, "Container With Most Water"),
(15, "3Sum"),
(19, "Remove Nth Node From End of List"),
(20, "Valid Parentheses"),
(23, "Merge k Sorted Lists"),
(24, "Swap Nodes in Pairs"),
(25, "Reverse Nodes in k-Group"),
(33, "Search in Rotated Sorted Array"),
(34, "Find First and Last Position of Element in Sorted Array"),
(41, "First Missing Positive"),
(42, "Trapping Rain Water"),
(45, "Jump Game II"),
(46, "Permutations"),
(48, "Rotate Image"),
(49, "Group Anagrams"),
(53, "Maximum Subarray"),
(54, "Spiral Matrix"),
(56, "Merge Intervals"),
(64, "Minimum Path Sum"),
(75, "Sort Colors"),
(76, "Minimum Window Substring"),
(78, "Subsets"),
(84, "Largest Rectangle in Histogram"),
(94, "Binary Tree Inorder Traversal"),
(98, "Validate Binary Search Tree"),
(102, "Binary Tree Level Order Traversal"),
(124, "Binary Tree Maximum Path Sum"),
(127, "Word Ladder"),
(128, "Longest Consecutive Sequence"),
(133, "Clone Graph"),
(139, "Word Break"),
(142, "Linked List Cycle II"),
(144, "Binary Tree Preorder Traversal"),
(145, "Binary Tree Postorder Traversal"),
(146, "LRU Cache"),
(149, "Max Points on a Line"),
(151, "Reverse Words in a String"),
(155, "Min Stack"),
(169, "Majority Element"),
(199, "Binary Tree Right Side View"),
(200, "Number of Islands"),
(208, "Implement Trie (Prefix Tree)"),
(210, "Course Schedule II"),
(212, "Word Search II"),
(213, "House Robber II"),
(230, "Kth Smallest Element in a BST"),
(236, "Lowest Common Ancestor of a Binary Tree"),
(238, "Product of Array Except Self"),
(239, "Sliding Window Maximum"),
(260, "Single Number III"),
(295, "Find Median from Data Stream"),
(297, "Serialize and Deserialize Binary Tree"),
(300, "Longest Increasing Subsequence"),
(322, "Coin Change"),
(329, "Longest Increasing Path in a Matrix"),
(338, "Counting Bits"),
(347, "Top K Frequent Elements"),
(392, "Is Subsequence"),
(416, "Partition Equal Subset Sum"),
(435, "Non-overlapping Intervals"),
(437, "Path Sum III"),
(438, "Find All Anagrams in a String"),
(547, "Number of Provinces"),
(560, "Subarray Sum Equals K"),
(567, "Permutation in String"),
(729, "My Calendar I"),
(785, "Is Graph Bipartite?"),
(787, "Cheapest Flights Within K Stops"),
(994, "Rotting Oranges"),
(1143, "Longest Common Subsequence"),
(1584, "Min Cost to Connect All Points"),
]
77 changes: 77 additions & 0 deletions .amazonq/plans/blind_75_tuples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
blind_75_tuples = [
(1, "Two Sum"),
(3, "Longest Substring Without Repeating Characters"),
(5, "Longest Palindromic Substring"),
(11, "Container With Most Water"),
(15, "3Sum"),
(19, "Remove Nth Node From End of List"),
(20, "Valid Parentheses"),
(21, "Merge Two Sorted Lists"),
(23, "Merge k Sorted Lists"),
(33, "Search in Rotated Sorted Array"),
(39, "Combination Sum"),
(48, "Rotate Image"),
(49, "Group Anagrams"),
(53, "Maximum Subarray"),
(54, "Spiral Matrix"),
(55, "Jump Game"),
(56, "Merge Intervals"),
(57, "Insert Interval"),
(62, "Unique Paths"),
(70, "Climbing Stairs"),
(73, "Set Matrix Zeroes"),
(76, "Minimum Window Substring"),
(79, "Word Search"),
(91, "Decode Ways"),
(98, "Validate Binary Search Tree"),
(100, "Same Tree"),
(102, "Binary Tree Level Order Traversal"),
(104, "Maximum Depth of Binary Tree"),
(105, "Construct Binary Tree from Preorder and Inorder Traversal"),
(121, "Best Time to Buy and Sell Stock"),
(124, "Binary Tree Maximum Path Sum"),
(125, "Valid Palindrome"),
(128, "Longest Consecutive Sequence"),
(133, "Clone Graph"),
(139, "Word Break"),
(141, "Linked List Cycle"),
(143, "Reorder List"),
(152, "Maximum Product Subarray"),
(153, "Find Minimum in Rotated Sorted Array"),
(190, "Reverse Bits"),
(191, "Number of 1 Bits"),
(198, "House Robber"),
(200, "Number of Islands"),
(206, "Reverse Linked List"),
(207, "Course Schedule"),
(208, "Implement Trie (Prefix Tree)"),
(211, "Design Add and Search Words Data Structure"),
(212, "Word Search II"),
(213, "House Robber II"),
(217, "Contains Duplicate"),
(226, "Invert Binary Tree"),
(230, "Kth Smallest Element in a BST"),
(235, "Lowest Common Ancestor of a Binary Search Tree"),
(238, "Product of Array Except Self"),
(242, "Valid Anagram"),
(252, "Meeting Rooms"),
(253, "Meeting Rooms II"),
(261, "Graph Valid Tree"),
(268, "Missing Number"),
(269, "Alien Dictionary"),
(271, "Encode and Decode Strings"),
(295, "Find Median from Data Stream"),
(297, "Serialize and Deserialize Binary Tree"),
(300, "Longest Increasing Subsequence"),
(322, "Coin Change"),
(323, "Number of Connected Components in an Undirected Graph"),
(338, "Counting Bits"),
(347, "Top K Frequent Elements"),
(371, "Sum of Two Integers"),
(417, "Pacific Atlantic Water Flow"),
(424, "Longest Repeating Character Replacement"),
(435, "Non-overlapping Intervals"),
(572, "Subtree of Another Tree"),
(647, "Palindromic Substrings"),
(1143, "Longest Common Subsequence"),
]
66 changes: 66 additions & 0 deletions .amazonq/plans/check_problem_lists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# TODO: temporary use only while completing ongoing list

import json
import sys
from pathlib import Path

# Import the tuple lists
sys.path.append(str(Path(__file__).parent.parent.parent))
from algo_master_75_tuples import algo_master_75_tuples
from blind_75_tuples import blind_75_tuples
from neetcode_150_tuples import neetcode_150_tuples


def get_existing_problems():
"""Get problem numbers from existing JSON files."""
json_dir = Path(__file__).parent.parent.parent / "leetcode_py/cli/resources/leetcode/json/problems"
existing_problems = set()

for json_file in json_dir.glob("*.json"):
try:
with open(json_file, "r") as f:
data = json.load(f)
problem_number = int(data.get("problem_number", 0))
if problem_number > 0:
existing_problems.add(problem_number)
except (json.JSONDecodeError, ValueError, KeyError):
continue

return existing_problems


def check_problem_list(name, problem_tuples, existing_problems):
"""Check how many problems from a list are available."""
problem_numbers = {num for num, _ in problem_tuples}
have = problem_numbers & existing_problems
missing = problem_numbers - existing_problems

print(f"\n=== {name} ===")
print(f"Total problems: {len(problem_numbers)}")
print(f"Problems you have: {len(have)} ({len(have)/len(problem_numbers)*100:.1f}%)")
print(f"Problems missing: {len(missing)} ({len(missing)/len(problem_numbers)*100:.1f}%)")

if missing:
print(f"Missing problems: {sorted(missing)}")

return have, missing


def main():
existing = get_existing_problems()
print(f"Total existing problems in JSON: {len(existing)}")

# Check each list
blind_have, blind_missing = check_problem_list("BLIND 75", blind_75_tuples, existing)
neetcode_have, neetcode_missing = check_problem_list("NEETCODE 150", neetcode_150_tuples, existing)
algo_have, algo_missing = check_problem_list("ALGO MASTER 75", algo_master_75_tuples, existing)

# Summary
print("\n=== SUMMARY ===")
print(f"Blind 75: {len(blind_have)}/75 ({len(blind_have)/75*100:.1f}%)")
print(f"NeetCode 150: {len(neetcode_have)}/150 ({len(neetcode_have)/150*100:.1f}%)")
print(f"Algo Master 75: {len(algo_have)}/75 ({len(algo_have)/75*100:.1f}%)")


if __name__ == "__main__":
main()
81 changes: 81 additions & 0 deletions .amazonq/plans/export_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# TODO: temporary use only while completing ongoing list

import json
import sys
from pathlib import Path

# Import the tuple lists
sys.path.append(str(Path(__file__).parent.parent.parent))
from algo_master_75_tuples import algo_master_75_tuples
from neetcode_150_tuples import neetcode_150_tuples


def get_existing_problems():
"""Get problem numbers and names from existing JSON files."""
json_dir = Path(__file__).parent.parent.parent / "leetcode_py/cli/resources/leetcode/json/problems"
existing_problems = {}

for json_file in json_dir.glob("*.json"):
try:
with open(json_file, "r") as f:
data = json.load(f)
problem_number = int(data.get("problem_number", 0))
if problem_number > 0:
existing_problems[problem_number] = json_file.stem
except (json.JSONDecodeError, ValueError, KeyError):
continue

return existing_problems


def get_tag_problems(problem_tuples, existing_problems):
"""Get problem names for existing problems from a tuple list."""
problem_names = []
for num, _ in problem_tuples:
if num in existing_problems:
problem_names.append(existing_problems[num])
return sorted(problem_names)


def export_tags():
"""Export tags.json5 format for the three problem lists."""
existing = get_existing_problems()

# Get problem names for each list
neetcode_150_names = get_tag_problems(neetcode_150_tuples, existing)
algo_master_75_names = get_tag_problems(algo_master_75_tuples, existing)

# Generate tags.json5 content
content = """{\n"""

# NeetCode 150
content += f" // NeetCode 150 - {len(neetcode_150_names)} problems\n"
content += ' "neetcode-150": [\n'
for name in neetcode_150_names:
content += f' "{name}",\n'
content += " ],\n\n"

# Algo Master 75
content += f" // Algo Master 75 - {len(algo_master_75_names)} problems\n"
content += ' "algo-master-75": [\n'
for name in algo_master_75_names:
content += f' "{name}",\n'
content += " ],\n\n"

# Test tag
content += " // Test tag for development and testing\n"
content += ' test: ["binary_search", "two_sum", "valid_palindrome"],\n'
content += "}\n"

# Write to file
output_file = Path(__file__).parent / "new_tags.json5"
with open(output_file, "w") as f:
f.write(content)

print(f"Exported tags to {output_file}")
print(f"NeetCode 150: {len(neetcode_150_names)} problems")
print(f"Algo Master 75: {len(algo_master_75_names)} problems")


if __name__ == "__main__":
export_tags()
Loading