diff --git a/src/lib.rs b/src/lib.rs index 7278e7b..815c1ce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,240 +1,240 @@ #[macro_use] pub mod util; -mod n0001_two_sum; -mod n0002_add_two_numbers; -mod n0003_longest_substring; -mod n0004_median_of_two_sorted_arrays; -mod n0005_longest_palindromic_substring; mod n0006_zigzag_conversion; -mod n0007_reverse_integer; -mod n0008_string_to_integer_atoi; -mod n0009_palindrome_number; -mod n0010_regular_expression_matching; -mod n0011_container_with_most_water; -mod n0012_integer_to_roman; -mod n0013_roman_to_integer; -mod n0014_longest_common_prefix; -mod n0015_3sum; -mod n0016_3sum_closest; -mod n0017_letter_combinations_of_a_phone_number; -mod n0018_4sum; -mod n0019_remove_nth_node_from_end_of_list; -mod n0020_valid_parentheses; -mod n0021_merge_two_sorted_lists; -mod n0022_generate_parentheses; -mod n0023_merge_k_sorted_lists; +mod n0238_product_of_array_except_self; +mod n0115_distinct_subsequences; +mod n0099_recover_binary_search_tree; +mod n0310_minimum_height_trees; +mod n0128_longest_consecutive_sequence; +mod n0274_h_index; +mod n0241_different_ways_to_add_parentheses; mod n0024_swap_nodes_in_pairs; -mod n0025_reverse_nodes_in_k_group; -mod n0026_remove_duplicates_from_sorted_array; +mod n0110_balanced_binary_tree; +mod n0093_restore_ip_addresses; +mod n0076_minimum_window_substring; +mod n0124_binary_tree_maximum_path_sum; +mod n0122_best_time_to_buy_and_sell_stock_ii; +mod n0169_majority_element; +mod n0162_find_peak_element; +mod n0095_unique_binary_search_trees_ii; +mod n0155_min_stack; +mod n0040_combination_sum_ii; +mod n0217_contains_duplicate; +mod n0055_jump_game; +mod n0106_construct_binary_tree_from_inorder_and_postorder_traversal; +mod n0145_binary_tree_postorder_traversal; +mod n0079_word_search; +mod n0969_pancake_sorting; +mod n0042_trapping_rain_water; +mod n0108_convert_sorted_array_to_binary_search_tree; +mod n0083_remove_duplicates_from_sorted_list; +mod n0130_surrounded_regions; +mod n0226_invert_binary_tree; mod n0027_remove_element; +mod n0188_best_time_to_buy_and_sell_stock_iv; +mod n0204_count_primes; +mod n0268_missing_number; +mod n0214_shortest_palindrome; +mod n0231_power_of_two; +mod n0202_happy_number; +mod n0075_sort_colors; +mod n0066_plus_one; mod n0028_implement_strstr; -mod n0029_divide_two_integers; +mod n0290_word_pattern; +mod n0048_rotate_image; +mod n0089_gray_code; +mod n0147_insertion_sort_list; +mod n0084_largest_rectangle_in_histogram; +mod n0011_container_with_most_water; +mod n0009_palindrome_number; +mod n0058_length_of_last_word; +mod n0080_remove_duplicates_from_sorted_array_ii; mod n0030_substring_with_concatenation_of_all_words; -mod n0031_next_permutation; -mod n0032_longest_valid_parentheses; -mod n0033_search_in_rotated_sorted_array; -mod n0034_find_first_and_last_position_of_element_in_sorted_array; -mod n0035_search_insert_position; -mod n0036_valid_sudoku; -mod n0037_sudoku_solver; +mod n0060_permutation_sequence; +mod n0071_simplify_path; mod n0038_count_and_say; -mod n0039_combination_sum; -mod n0040_combination_sum_ii; -mod n0041_first_missing_positive; -mod n0042_trapping_rain_water; -mod n0043_multiply_strings; -mod n0044_wildcard_matching; -mod n0045_jump_game_ii; -mod n0046_permutations; -mod n0047_permutations_ii; -mod n0048_rotate_image; -mod n0049_group_anagrams; +mod n0144_binary_tree_preorder_traversal; +mod n0279_perfect_squares; +mod n0304_range_sum_query_2d_immutable; +mod n0292_nim_game; +mod n0264_ugly_number_ii; +mod n0132_palindrome_partitioning_ii; +mod n0019_remove_nth_node_from_end_of_list; +mod n0136_single_number; +mod n0018_4sum; +mod n0220_contains_duplicate_iii; +mod n0299_bulls_and_cows; +mod n0232_implement_queue_using_stacks; +mod n0100_same_tree; +mod n0171_excel_sheet_column_number; +mod n0087_scramble_string; +mod n0704_binary_search; +mod n0219_contains_duplicate_ii; +mod n0086_partition_list; +mod n0082_remove_duplicates_from_sorted_list_ii; +mod n0228_summary_ranges; +mod n0020_valid_parentheses; +mod n0017_letter_combinations_of_a_phone_number; +mod n0312_burst_balloons; +mod n0306_additive_number; +mod n0283_move_zeroes; +mod n1018_binary_prefix_divisible_by_5; +mod n0201_bitwise_and_of_numbers_range; +mod n0109_convert_sorted_list_to_binary_search_tree; +mod n0101_symmetric_tree; +mod n0098_validate_binary_search_tree; +mod n0035_search_insert_position; mod n0050_powx_n; -mod n0051_n_queens; -mod n0052_n_queens_ii; -mod n0053_maximum_subarray; +mod n0198_house_robber; +mod n0004_median_of_two_sorted_arrays; +mod n0221_maximal_square; +mod n0047_permutations_ii; +mod n0172_factorial_trailing_zeroes; mod n0054_spiral_matrix; -mod n0055_jump_game; +mod n0053_maximum_subarray; +mod n1046_last_stone_weight; +mod n0146_lru_cache; +mod n0126_word_ladder_ii; +mod n0242_valid_anagram; +mod n0112_path_sum; +mod n0023_merge_k_sorted_lists; +mod n0230_kth_smallest_element_in_a_bst; +mod n0104_maximum_depth_of_binary_tree; +mod n0258_add_digits; +mod n0187_repeated_dna_sequences; +mod n0025_reverse_nodes_in_k_group; +mod n0039_combination_sum; +mod n0107_binary_tree_level_order_traversal_ii; +mod n0091_decode_ways; mod n0056_merge_intervals; -mod n0057_insert_interval; -mod n0058_length_of_last_word; -mod n0059_spiral_matrix_ii; -mod n0060_permutation_sequence; -mod n0061_rotate_list; -mod n0062_unique_paths; -mod n0063_unique_paths_ii; -mod n0064_minimum_path_sum; mod n0065_valid_number; -mod n0066_plus_one; -mod n0067_add_binary; -mod n0068_text_justification; -mod n0069_sqrtx; -mod n0070_climbing_stairs; -mod n0071_simplify_path; +mod n0016_3sum_closest; +mod n0096_unique_binary_search_trees; mod n0072_edit_distance; +mod n0044_wildcard_matching; +mod n0239_sliding_window_maximum; +mod n0174_dungeon_game; mod n0073_set_matrix_zeroes; -mod n0074_search_a_2d_matrix; -mod n0075_sort_colors; -mod n0076_minimum_window_substring; -mod n0077_combinations; mod n0078_subsets; -mod n0079_word_search; -mod n0080_remove_duplicates_from_sorted_array_ii; -mod n0081_search_in_rotated_sorted_array_ii; -mod n0082_remove_duplicates_from_sorted_list_ii; -mod n0083_remove_duplicates_from_sorted_list; -mod n0084_largest_rectangle_in_histogram; -mod n0085_maximal_rectangle; -mod n0086_partition_list; -mod n0087_scramble_string; -mod n0088_merge_sorted_array; -mod n0089_gray_code; -mod n0090_subsets_ii; -mod n0091_decode_ways; -mod n0092_reverse_linked_list_ii; -mod n0093_restore_ip_addresses; -mod n0094_binary_tree_inorder_traversal; -mod n0095_unique_binary_search_trees_ii; -mod n0096_unique_binary_search_trees; +mod n0037_sudoku_solver; +mod n0033_search_in_rotated_sorted_array; +mod n0002_add_two_numbers; +mod n0313_super_ugly_number; +mod n0068_text_justification; +mod n0064_minimum_path_sum; +mod n0218_the_skyline_problem; +mod n0125_valid_palindrome; +mod n0210_course_schedule_ii; +mod n0143_reorder_list; +mod n0164_maximum_gap; mod n0097_interleaving_string; -mod n0098_validate_binary_search_tree; -mod n0099_recover_binary_search_tree; -mod n0100_same_tree; -mod n0101_symmetric_tree; -mod n0102_binary_tree_level_order_traversal; -mod n0103_binary_tree_zigzag_level_order_traversal; -mod n0104_maximum_depth_of_binary_tree; mod n0105_construct_binary_tree_from_preorder_and_inorder_traversal; -mod n0106_construct_binary_tree_from_inorder_and_postorder_traversal; -mod n0107_binary_tree_level_order_traversal_ii; -mod n0108_convert_sorted_array_to_binary_search_tree; -mod n0109_convert_sorted_list_to_binary_search_tree; -mod n0110_balanced_binary_tree; -mod n0111_minimum_depth_of_binary_tree; -mod n0112_path_sum; -mod n0113_path_sum_ii; -mod n0114_flatten_binary_tree_to_linked_list; -mod n0115_distinct_subsequences; -mod n0118_pascals_triangle; -mod n0119_pascals_triangle_ii; -mod n0120_triangle; +mod n0167_two_sum_ii_input_array_is_sorted; +mod n0034_find_first_and_last_position_of_element_in_sorted_array; +mod n0094_binary_tree_inorder_traversal; +mod n0052_n_queens_ii; mod n0121_best_time_to_buy_and_sell_stock; -mod n0122_best_time_to_buy_and_sell_stock_ii; -mod n0123_best_time_to_buy_and_sell_stock_iii; -mod n0124_binary_tree_maximum_path_sum; -mod n0125_valid_palindrome; -mod n0126_word_ladder_ii; -mod n0127_word_ladder; -mod n0128_longest_consecutive_sequence; -mod n0129_sum_root_to_leaf_numbers; -mod n0130_surrounded_regions; -mod n0131_palindrome_partitioning; -mod n0132_palindrome_partitioning_ii; -mod n0134_gas_station; +mod n0273_integer_to_english_words; +mod n0225_implement_stack_using_queues; +mod n0046_permutations; +mod n0085_maximal_rectangle; mod n0135_candy; -mod n0136_single_number; -mod n0137_single_number_ii; -mod n0139_word_break; +mod n0113_path_sum_ii; +mod n0029_divide_two_integers; +mod n0260_single_number_iii; mod n0140_word_break_ii; -mod n0143_reorder_list; -mod n0144_binary_tree_preorder_traversal; -mod n0145_binary_tree_postorder_traversal; -mod n0146_lru_cache; -mod n0147_insertion_sort_list; -mod n0148_sort_list; mod n0149_max_points_on_a_line; -mod n0150_evaluate_reverse_polish_notation; -mod n0151_reverse_words_in_a_string; -mod n0152_maximum_product_subarray; -mod n0153_find_minimum_in_rotated_sorted_array; -mod n0154_find_minimum_in_rotated_sorted_array_ii; -mod n0155_min_stack; -mod n0162_find_peak_element; -mod n0164_maximum_gap; -mod n0165_compare_version_numbers; -mod n0166_fraction_to_recurring_decimal; -mod n0167_two_sum_ii_input_array_is_sorted; -mod n0168_excel_sheet_column_title; -mod n0169_majority_element; -mod n0171_excel_sheet_column_number; -mod n0172_factorial_trailing_zeroes; +mod n0213_house_robber_ii; +mod n0222_count_complete_tree_nodes; +mod n0134_gas_station; +mod n0057_insert_interval; mod n0173_binary_search_tree_iterator; -mod n0174_dungeon_game; -mod n0179_largest_number; -mod n0187_repeated_dna_sequences; -mod n0188_best_time_to_buy_and_sell_stock_iv; +mod n0077_combinations; +mod n0005_longest_palindromic_substring; +mod n0041_first_missing_positive; +mod n0026_remove_duplicates_from_sorted_array; +mod n0166_fraction_to_recurring_decimal; +mod n0119_pascals_triangle_ii; +mod n0012_integer_to_roman; +mod n0223_rectangle_area; +mod n0229_majority_element_ii; +mod n0061_rotate_list; +mod n0123_best_time_to_buy_and_sell_stock_iii; +mod n0301_remove_invalid_parentheses; +mod n0067_add_binary; +mod n0049_group_anagrams; mod n0189_rotate_array; -mod n0198_house_robber; -mod n0199_binary_tree_right_side_view; -mod n0200_number_of_islands; -mod n0201_bitwise_and_of_numbers_range; -mod n0202_happy_number; -mod n0203_remove_linked_list_elements; -mod n0204_count_primes; -mod n0205_isomorphic_strings; -mod n0206_reverse_linked_list; -mod n0207_course_schedule; +mod n0001_two_sum; +mod n0275_h_index_ii; +mod n0103_binary_tree_zigzag_level_order_traversal; +mod n0137_single_number_ii; mod n0208_implement_trie_prefix_tree; +mod n0300_longest_increasing_subsequence; +mod n0118_pascals_triangle; +mod n0010_regular_expression_matching; +mod n0013_roman_to_integer; mod n0209_minimum_size_subarray_sum; -mod n0210_course_schedule_ii; -mod n0211_add_and_search_word_data_structure_design; -mod n0212_word_search_ii; -mod n0213_house_robber_ii; -mod n0214_shortest_palindrome; -mod n0215_kth_largest_element_in_an_array; -mod n0216_combination_sum_iii; -mod n0217_contains_duplicate; -mod n0218_the_skyline_problem; -mod n0219_contains_duplicate_ii; -mod n0220_contains_duplicate_iii; -mod n0221_maximal_square; -mod n0222_count_complete_tree_nodes; -mod n0223_rectangle_area; -mod n0224_basic_calculator; -mod n0225_implement_stack_using_queues; -mod n0226_invert_binary_tree; mod n0227_basic_calculator_ii; -mod n0228_summary_ranges; -mod n0229_majority_element_ii; -mod n0230_kth_smallest_element_in_a_bst; -mod n0231_power_of_two; -mod n0232_implement_queue_using_stacks; +mod n0022_generate_parentheses; +mod n0008_string_to_integer_atoi; +mod n0152_maximum_product_subarray; +mod n0014_longest_common_prefix; +mod n0070_climbing_stairs; mod n0233_number_of_digit_one; -mod n0238_product_of_array_except_self; -mod n0239_sliding_window_maximum; -mod n0241_different_ways_to_add_parentheses; -mod n0242_valid_anagram; -mod n0257_binary_tree_paths; -mod n0258_add_digits; -mod n0260_single_number_iii; +mod n0154_find_minimum_in_rotated_sorted_array_ii; +mod n0127_word_ladder; +mod n0207_course_schedule; mod n0263_ugly_number; -mod n0264_ugly_number_ii; -mod n0268_missing_number; -mod n0273_integer_to_english_words; -mod n0274_h_index; -mod n0275_h_index_ii; -mod n0279_perfect_squares; -mod n0282_expression_add_operators; -mod n0283_move_zeroes; +mod n0295_find_median_from_data_stream; +mod n0148_sort_list; +mod n0257_binary_tree_paths; +mod n0120_triangle; +mod n0309_best_time_to_buy_and_sell_stock_with_cooldown; +mod n0074_search_a_2d_matrix; +mod n0215_kth_largest_element_in_an_array; +mod n0203_remove_linked_list_elements; +mod n0081_search_in_rotated_sorted_array_ii; +mod n0059_spiral_matrix_ii; +mod n0151_reverse_words_in_a_string; +mod n0205_isomorphic_strings; +mod n0179_largest_number; +mod n0168_excel_sheet_column_title; +mod n0007_reverse_integer; +mod n0032_longest_valid_parentheses; +mod n0165_compare_version_numbers; +mod n0031_next_permutation; +mod n0088_merge_sorted_array; +mod n0509_fibonacci_number; +mod n0036_valid_sudoku; +mod n0069_sqrtx; +mod n0211_add_and_search_word_data_structure_design; +mod n0114_flatten_binary_tree_to_linked_list; +mod n0224_basic_calculator; +mod n0045_jump_game_ii; +mod n0051_n_queens; +mod n0212_word_search_ii; mod n0287_find_the_duplicate_number; +mod n0153_find_minimum_in_rotated_sorted_array; mod n0289_game_of_life; -mod n0290_word_pattern; -mod n0292_nim_game; -mod n0295_find_median_from_data_stream; -mod n0299_bulls_and_cows; -mod n0300_longest_increasing_subsequence; -mod n0301_remove_invalid_parentheses; -mod n0303_range_sum_query_immutable; -mod n0304_range_sum_query_2d_immutable; -mod n0306_additive_number; +mod n0200_number_of_islands; +mod n0015_3sum; +mod n0216_combination_sum_iii; +mod n0043_multiply_strings; +mod n0090_subsets_ii; +mod n0003_longest_substring; +mod n0139_word_break; +mod n0150_evaluate_reverse_polish_notation; +mod n0063_unique_paths_ii; +mod n0062_unique_paths; +mod n0199_binary_tree_right_side_view; +mod n0282_expression_add_operators; +mod n0021_merge_two_sorted_lists; +mod n0129_sum_root_to_leaf_numbers; +mod n0206_reverse_linked_list; +mod n0131_palindrome_partitioning; mod n0307_range_sum_query_mutable; -mod n0309_best_time_to_buy_and_sell_stock_with_cooldown; -mod n0310_minimum_height_trees; -mod n0312_burst_balloons; -mod n0313_super_ugly_number; -mod n0792_binary_search; -mod n1009_pancake_sorting; -mod n1013_fibonacci_number; -mod n1071_binary_prefix_divisible_by_5; -mod n1127_last_stone_weight; +mod n0111_minimum_depth_of_binary_tree; +mod n0092_reverse_linked_list_ii; +mod n0303_range_sum_query_immutable; +mod n0102_binary_tree_level_order_traversal; diff --git a/src/n1013_fibonacci_number.rs b/src/n0509_fibonacci_number.rs similarity index 100% rename from src/n1013_fibonacci_number.rs rename to src/n0509_fibonacci_number.rs diff --git a/src/n0792_binary_search.rs b/src/n0704_binary_search.rs similarity index 100% rename from src/n0792_binary_search.rs rename to src/n0704_binary_search.rs diff --git a/src/n1009_pancake_sorting.rs b/src/n0969_pancake_sorting.rs similarity index 100% rename from src/n1009_pancake_sorting.rs rename to src/n0969_pancake_sorting.rs diff --git a/src/n1071_binary_prefix_divisible_by_5.rs b/src/n1018_binary_prefix_divisible_by_5.rs similarity index 100% rename from src/n1071_binary_prefix_divisible_by_5.rs rename to src/n1018_binary_prefix_divisible_by_5.rs diff --git a/src/n1127_last_stone_weight.rs b/src/n1046_last_stone_weight.rs similarity index 100% rename from src/n1127_last_stone_weight.rs rename to src/n1046_last_stone_weight.rs diff --git a/src/problem.rs b/src/problem.rs index 712135a..d4f7310 100644 --- a/src/problem.rs +++ b/src/problem.rs @@ -42,7 +42,7 @@ pub fn get_problem(frontend_question_id: u32) -> Option { content: resp.data.question.content, sample_test_case: resp.data.question.sample_test_case, difficulty: problem.difficulty.to_string(), - question_id: problem.stat.question_id, + question_id: problem.stat.frontend_question_id, }); } }