Algorithm solutions organized by difficulty level. Each file includes a problem description, approach explanation, complexity analysis, and test cases.
| # | Problem | Approach | Solution |
|---|---|---|---|
| 1 | Two Sum | Hash map | 1_two_sum.py |
| 9 | Palindrome Number | Math | 9_palindrome_number.py |
| 20 | Valid Parentheses | Stack | 20_valid_parentheses.py |
| 35 | Search Insert Position | Binary search | 35_search_insert_position.py |
| 53 | Maximum Subarray | Kadane's algorithm | 53_maximum_subarray.py |
| 67 | Add Binary | Math | 67_add_binary.py |
| 70 | Climbing Stairs | Dynamic programming | 70_climbing_stairs.py |
| 83 | Remove Duplicates from Sorted List | Linked list | 83_remove_duplicates_from_sorted_list.py |
| 88 | Merge Sorted Array | Two pointers | 88_merge_sorted_array.py |
| 118 | Pascal's Triangle | Dynamic programming | 118_pascals_triangle.py |
| 121 | Best Time to Buy and Sell Stock | One pass | 121_best_time_to_buy_and_sell_stock.py |
| 136 | Single Number | XOR bit manipulation | 136_single_number.py |
| 141 | Linked List Cycle | Floyd's tortoise & hare | 141_linked_list_cycle.py |
| 169 | Majority Element | Boyer-Moore voting | 169_majority_element.py |
| 190 | Reverse Bits | Bit manipulation | 190_reverse_bits.py |
| 206 | Reverse Linked List | Iterative pointers | 206_reverse_linked_list.py |
| 217 | Contains Duplicate | Hash set | 217_contains_duplicate.py |
| 226 | Invert Binary Tree | Recursion | 226_invert_binary_tree.py |
| 231 | Power of Two | Bit manipulation | 231_power_of_two.py |
| 242 | Valid Anagram | Character counting | 242_valid_anagram.py |
| 2824 | Count Pairs Less Than Target | Brute force | 2824_count_pairs.py |
| — | Design an Ordered Stream | Array | design_an_ordered_stream.py |
| — | Jewels and Stones | Hash set | jewels_and_stones.py |
| — | Number of Good Pairs | Counting | number_of_goods_pairs.py |
| — | Roman to Integer | Hash map | roman_to_integer.py |
| — | Single Row Keyboard | Hash map | single_row_keyboard.py |
| # | Problem | Approach | Solution |
|---|---|---|---|
| 3 | Longest Substring Without Repeating Characters | Sliding window | 3_longest_substring_without_repeating.py |
| 11 | Container With Most Water | Two pointers | 11_container_with_most_water.py |
| 15 | 3Sum | Sort + two pointers | 15_three_sum.py |
| 33 | Search in Rotated Sorted Array | Modified binary search | 33_search_in_rotated_sorted_array.py |
| 36 | Valid Sudoku | Hash sets | 36_valid_sudoku.py |
| 49 | Group Anagrams | Sorted key hash map | 49_group_anagrams.py |
| 56 | Merge Intervals | Sort + merge | 56_merge_intervals.py |
| 102 | Binary Tree Level Order Traversal | BFS | 102_binary_tree_level_order_traversal.py |
| 152 | Maximum Product Subarray | Track min/max | 152_maximum_product_subarray.py |
| 200 | Number of Islands | DFS flood fill | 200_number_of_islands.py |
| 238 | Product of Array Except Self | Prefix/suffix products | 238_product_of_array_except_self.py |
| # | Problem | Approach | Solution |
|---|---|---|---|
| 23 | Merge k Sorted Lists | Min-heap | 23_merge_k_sorted_lists.py |
| 42 | Trapping Rain Water | Two pointers | 42_trapping_rain_water.py |
| 76 | Minimum Window Substring | Sliding window | 76_minimum_window_substring.py |
| 124 | Binary Tree Maximum Path Sum | DFS | 124_binary_tree_maximum_path_sum.py |
| 295 | Find Median from Data Stream | Two heaps | 295_find_median_from_data_stream.py |