A collection of my solutions while following the Coding Interview Roadmap by DesignGurus.io.
This repository contains my implementations, notes, and explanations for algorithms, data structures, and problem-solving patterns covered in the roadmap. It aligns with the courseβs focus on mastering core concepts through a combination of theory and hands-on coding challenges.
- Strengthen problem-solving skills
- Understand and apply common coding patterns
- Prepare efficiently for technical interviews
- Track personal progress through organized, topic-based solutions
π .
βββ π 01-data-structures-and-algorithms
β βββ π 01-array
β β βββ 01.running_sum_of_1d_array.py
β β βββ 02.contains_duplicate.py
β β βββ 03.left_and_right_sum_differences.py
β β βββ 04.find_the_highest_altitude.py
β βββ π 02-matrix
β β βββ 01.richest_customer_wealth.py
β β βββ 02.matrix_diagonal_sum.py
β β βββ 03.row_with_maximum_ones.py
β βββ π 03-stack
β β βββ 01.valid_parentheses.py
β β βββ 02.reverse_string.py
β β βββ 03.decimal_to_binary_conversion.py
β β βββ 04.next_greater_element.py
β β βββ 05.sorting_stack.py
β β βββ 06.simplify_path.py
β β βββ 07.remove_all_adjacent_duplicates_in_string.py
β β βββ 08.removing_stars_from_a_string.py
β β βββ 09.make_the_string_great.py
β βββ π 04-queue
β βββ π 05-linked-list
β β βββ 01.reverse_linked_list.py
β β βββ 02.remove_duplicates_from_sorted_list.py
β β βββ 03.merge_two_sorted_lists.py
β β βββ 04.check_doubly_linked_list_characters_palindrome.py
β β βββ 05.swap_nodes_in_pairs.py
β βββ π 06-tree-and-binary-search-tree
β βββ π 07-hash-table
β βββ π 08-hash-set
β βββ π 09-heap
β β βββ 01.take_gifts_from_the_richest_pile.py
β β βββ 02.sort_characters_by_frequency.py
β β βββ 03.minimum_cost_to_connect_sticks.py
β β βββ 04.find_median_from_data_stream.py
β βββ π 10-graph
β β βββ 01.find_if_path_exists_in_graph.py
β β βββ 02.number_of_provinces.py
β β βββ 03.find_eventual_safe_states.py
β β βββ 04.minimum_number_of_vertices_to_reach_all_nodes.py
β β βββ 05.bus_routes.py
β βββ π 11-trie
β βββ π 12-sorting
β β βββ 01.apple_redistribution_into_boxes.py
β β βββ 02.sort_array_by_increasing_frequency.py
β β βββ 03.sort_vowels_in_a_string.py
β β βββ 04.reduction_operations_to_make_the_array_elements_equal.py
β β βββ 05.divide_array_into_arrays_with_max_difference.py
β β βββ 06.top_k_frequent_elements.py
β β βββ 07.meeting_rooms-ii.py
β βββ π 13-searching
β β βββ 01.maximum_count_of_positive_integer_and_negative_integer.py
β β βββ 02.minimum_common_value.py
β β βββ 03.frequency_of_the_most_frequent_element.py
β β βββ 04.minimize_the_maximum_of_two_arrays.py
β β βββ 05.search_a_2d_matrix_ii.py
β β βββ 06.sqrtx.py
β βββ π 14-greedy-algorithm
β β βββ 01.valid_palindrome_ii.py
β β βββ 02.maximum_length_of_pair_chain.py
β β βββ 03.minimum_add_to_make_parentheses_valid.py
β β βββ 04.remove_duplicate_letters.py
β β βββ 05.largest_palindromic_number.py
β β βββ 06.removing_minimum_and_maximum_from_array.py
β βββ π 15-divide-and-conquer
β β βββ 01.longest_nice_substring.py
β β βββ 02.majority_element.py
βββ π 02-art-of-recursion
βββ π 03-common-coding-patterns
β βββ π 01-warm-up
β β βββ 01.contains_duplicate.py
β β βββ 02.check_if_the_sentence_is_pangram.py
β β βββ 03.reverse_vowels_of_a_string.py
β β βββ 04.valid_palindrome.py
β β βββ 05.valid_anagram.py
β β βββ 06.shortest-word-distance.py
β β βββ 07.number_of_good_pairs.py
β β βββ 08.sqrtx.py
β βββ π 02-two-pointers
β β βββ 01.pair_with_target_sum.py
β β βββ 02.remove_duplicates_from_sorted_array.py
β β βββ 03.squares_of_a_sorted_array.py
β β βββ 04.3sum.py
β β βββ 05.3sum_closest.py
β β βββ 06.3sum_smaller.py
β β βββ 07.sort_colors.py
β β βββ 08.4sum.py
β β βββ 09.backspace_string_compare.py
β β βββ 10.shortest_unsorted_continuous_subarray.py
β βββ π 03-fast-and-slow-pointers
β β βββ 01.linked_list_cycle.py
β β βββ 02.middle_of_the_linked_list.py
β β βββ 03.linked_list_cycle_ii.py
β β βββ 04.happy_number.py
β β βββ 05.palindrome_linked_list.py
β β βββ 06.reorder_list.py
β βββ π 04-sliding-window
β β βββ 01.maximum_sum_subarray_of_size_k.py
β β βββ 02.minimum_size_subarray_sum.py
β β βββ 03.longest_substring_with_at_most_k_distinct_characters.py
β β βββ 04.fruit_into_baskets.py
β β βββ 05.longest_repeating_character_replacement.py
β β βββ 06.max_consecutive_ones_iii.py
β β βββ 07.permutation_in_string.py
β β βββ 08.find_all_anagrams_in_a_string.py
β β βββ 11.subarray_product_less_than_k.py
β β βββ 12.list_of_subarrays_product_less_than_k.py
β βββ π 05-merge-intervals
β β βββ 01.merge_intervals.py
β β βββ 02.insert_interval.py
β β βββ 03.interval_list_intersections.py
β β βββ 04.meeting_room_i.py
β β βββ 05.meeting_rooms_ii.py
β β βββ 06.maximum_cpu_load.py
β β βββ 07.employee_free_time.py
β βββ π 06-cyclic-sort
β β βββ 01.cyclic_sort.py
β β βββ 02.missing_number.py
β β βββ 03.find_all_numbers_disappeared_in_an_array.py
β β βββ 04.find_the_duplicate_number.py
β β βββ 05.find_all_duplicates_in_an_array.py
β β βββ 06.find_the_corrupt_one.py
β β βββ 07.first_missing_positive.py
β β βββ 08.first_k_missing_positive.py
β βββ π 07-in-place-reversal-of-linked-list
β β βββ 01.reverse_linked_list.py
β β βββ 02.reverse_linked_list_ii.py
β β βββ 05.rotate_linked_list.py
β βββ π 08-stack
β β βββ 01.valid_parentheses.py
β β βββ 02.reverse_string.py
β β βββ 03.decimal_to_binary_conversion.py
β β βββ 04.next_greater_element.py
β β βββ 05.sorting_stack.py
β β βββ 06.simplify_path.py
β β βββ 07.remove_all_adjacent_duplicates_in_string.py
β β βββ 08.removing_stars_from_a_string.py
β β βββ 09.make_the_string_great.py
β βββ π 09-monotonic-stack
β β βββ 01.remove_nodes_from_linked_list.py
β β βββ 02.remove_all_adjacent_duplicates_in_string.py
β β βββ 03.next_greater_element_i.py
β β βββ 04.daily_temperatures.py
β β βββ 05.remove_all_adjacent_duplicates_in_string_ii.py
β β βββ 06.sum_of_subarray_minimums.py
β β βββ 07.remove_k_digits.py
β βββ π 10-hash-map
β βββ π 11-level-order-traversal
β β βββ 01.binary_tree_level_order_traversal_ii.py
β β βββ 02.find_largest_value_in_each_tree_row.py
β β βββ 03.maximum_width_of_binary_tree.py
β β βββ 04.maximum_level_sum_of_a_binary_tree.py
β β βββ 05.binary_tree_zigzag_level_order_traversal.py
β β βββ 06.even_odd_tree.py
β β βββ 07.n_ary_tree_level_order_traversal.py
β βββ π 12-tree-breadth-first-search
β β βββ 01.binary_tree_level_order_traversal.py
β β βββ 02.binary_tree_level_order_traversal_ii.py
β β βββ 03.binary_tree_zigzag_level_order_traversal.py
β β βββ 04.average_of_levels_in_binary_tree.py
β β βββ 05.minimum_depth_of_binary_tree.py
β β βββ 06.level_order_successor.py
β β βββ 07.populating_next_right_pointers_in_each_node.py
β β βββ 08.connect_all_level_order_siblings.py
β β βββ 09.binary_tree_right_side_view.py
β βββ π 13-tree-depth-first-search
β β βββ 01.path_sum.py
β β βββ 02.path_sum_ii.py
β β βββ 03.sum_root_to_leaf_numbers.py
β β βββ 04.check_if_a_string_is_a_valid_sequence_from_root_to_leaves_path.py
β β βββ 05.path_sum_iii.py
β β βββ 06.diameter_of_binary_tree.py
β β βββ 07.binary_tree_maximum_path_sum.py
β βββ π 14-graph
β β βββ 01.find_if_path_exists_in_graph.py
β β βββ 02.number_of_provinces.py
β β βββ 03.find_eventual_safe_states.py
β β βββ 04.minimum_number_of_vertices_to_reach_all_nodes.py
β β βββ 05.bus_routes.py
β βββ π 15-island-matrix-traversal
β β βββ 01.number_of_islands.py
β β βββ 02.max_area_of_island.py
β β βββ 03.flood_fill.py
β β βββ 04.number_of_closed_islands.py
β β βββ 05.island_perimeter.py
β β βββ 06.number_of_distinct_islands.py
β β βββ 07.detect_cycles_in_2d_grid.py
β βββ π 16-two-heaps
β β βββ 01.find_median_from_data_stream.py
β β βββ 04.find_right_interval.py
β βββ π 17-subset
β β βββ 01.subsets.py
β β βββ 02.subsets_ii.py
β β βββ 03.permutations.py
β β βββ 04.letter_case_permutation.py
β β βββ 05.generate_parentheses.py
β β βββ 07.different_ways_to_add_parentheses.py
β β βββ 08.unique_binary_search_trees_ii.py
β β βββ 09.unique_binary_search_trees.py
β βββ π 18-modified-binary-search
β β βββ 01.order_agnostic_binary_search.py
β β βββ 02.search_insert_position.py
β β βββ 03.find_smallest_letter_greater_than_target.py
β β βββ 04.find_first_and_last_position_of_element_in_sorted_array.py
β β βββ 05.search_in_a_sorted_array_of_unknown_size.py
β β βββ 06.minimum_difference_element.py
β β βββ 07.bitonic_array_maximum.py
β β βββ 08.search_bitonic_array.py
β β βββ 09.search_in_rotated_sorted_array.py
β β βββ 10.search_in_rotated_sorted_array_ii.py
β β βββ 11.find_minimum_in_rotated_sorted_array.py
β β βββ 12.find_minimum_in_rotated_sorted_array_ii.py
β βββ π 19-bitwise-xor
β β βββ 01.single_number.py
β β βββ 02.single_number_iii.py
β β βββ 03.complement_of_base_10_integer.py
β β βββ 04.flipping_an_image.py
β βββ π 20-top-k-elements
β β βββ 01.top_k_elements.py
β β βββ 02.kth_largest_element_in_an_array.py
β β βββ 03.k_closest_points_to_origin.py
β β βββ 04.minimum_cost_to_connect_sticks.py
β β βββ 05.top_k_frequent_elements.py
β β βββ 06.sort_characters_by_frequency.py
β β βββ 07.kth_largest_element_in_a_stream.py
β β βββ 08.find_k_closest_elements.py
β β βββ 09.least_number_of_unique_integers_after_k_removals.py
β β βββ 10.sum_of_elements_between_k1_th_and_k2_th smallest_elements.py
β β βββ 11.reorganize_string.py
β β βββ 12.rearrange_string_k_distance_apart.py
β β βββ 13.task_scheduler.py
β β βββ 14.maximum_frequency_stack.py
β βββ π 21-k-way-merge
β β βββ 01.merge_k_sorted_lists.py
β β βββ 02.kth_smallest_element_in_m_sorted_lists.py
β β βββ 03.kth_smallest_element_in_a_sorted_matrix.py
β βββ π 22-greedy-algorithm
β βββ π 23-dp-0-or-1-knapsack
β βββ π 24-dp-fibonacci-number
β βββ π 25-dp-palindromic-subsequence
β βββ π 26-backtracking
β βββ π 27-trie
β βββ π 28-graph-topological-sort
β βββ π 29-union-find
β βββ π 30-ordered-set
β βββ π 31-prefix-sum
β βββ π 32-multi-threading
βββ π 04-advanced-coding-patterns
βββ π 05-dynamic-programming
β βββ π 01-0-or-1-knapsack
β βββ π 02-unbounded-knapsack
β βββ π 03-fibonacci-numbers
β βββ π 04-palindromic-subsequence
β βββ π 05-longest-common-substring
βββ LICENSE
βββ README.md
βββ directory_layout_script.py