Skip to content

Latest commit

Β 

History

170 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Coding Interview Roadmap – Solutions

A collection of my solutions while following the Coding Interview Roadmap by DesignGurus.io.

Overview

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.

Purpose

  • Strengthen problem-solving skills
  • Understand and apply common coding patterns
  • Prepare efficiently for technical interviews
  • Track personal progress through organized, topic-based solutions

Directory Layout


πŸ“‚ .
β”œβ”€β”€ πŸ“ 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

About

Coding Interview Roadmap by DesignGurus.io

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages