diff --git a/.gitignore b/.gitignore index 2f7896d..96ef862 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ target/ +.idea/ diff --git a/src/problem.rs b/src/fetcher.rs similarity index 100% rename from src/problem.rs rename to src/fetcher.rs diff --git a/src/lib.rs b/src/lib.rs index 815c1ce..55b0298 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,240 +1,5 @@ #[macro_use] pub mod util; -mod n0006_zigzag_conversion; -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 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 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 n0060_permutation_sequence; -mod n0071_simplify_path; -mod n0038_count_and_say; -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 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 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 n0065_valid_number; -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 n0078_subsets; -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 n0105_construct_binary_tree_from_preorder_and_inorder_traversal; -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 n0273_integer_to_english_words; -mod n0225_implement_stack_using_queues; -mod n0046_permutations; -mod n0085_maximal_rectangle; -mod n0135_candy; -mod n0113_path_sum_ii; -mod n0029_divide_two_integers; -mod n0260_single_number_iii; -mod n0140_word_break_ii; -mod n0149_max_points_on_a_line; -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 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 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 n0227_basic_calculator_ii; -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 n0154_find_minimum_in_rotated_sorted_array_ii; -mod n0127_word_ladder; -mod n0207_course_schedule; -mod n0263_ugly_number; -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 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 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; +pub mod solution; +pub mod problem; diff --git a/src/main.rs b/src/main.rs index 967c5f8..e25be21 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ extern crate serde_derive; #[macro_use] extern crate serde_json; -mod problem; +mod fetcher; use std::env; use std::fs; @@ -45,7 +45,7 @@ fn main() { } } - let problem = problem::get_problem(id).unwrap_or_else(|| { + let problem = fetcher::get_problem(id).unwrap_or_else(|| { panic!( "Error: failed to get problem #{} \ (The problem may be paid-only or may not be exist).", @@ -61,11 +61,11 @@ fn main() { let code = code.unwrap(); let file_name = format!( - "n{:04}_{}", + "p{:04}_{}", problem.question_id, problem.title_slug.replace("-", "_") ); - let file_path = Path::new("./src").join(format!("{}.rs", file_name)); + let file_path = Path::new("./src/problem").join(format!("{}.rs", file_name)); if file_path.exists() { panic!("problem already initialized"); } @@ -91,7 +91,7 @@ fn main() { let mut lib_file = fs::OpenOptions::new() .write(true) .append(true) - .open("./src/lib.rs") + .open("./src/problem/mod.rs") .unwrap(); writeln!(lib_file, "mod {};", file_name); break; @@ -136,13 +136,13 @@ fn parse_extra_use(code: &str) -> String { let mut extra_use_line = String::new(); // a linked-list problem if code.contains("pub struct ListNode") { - extra_use_line.push_str("\nuse super::util::linked_list::{ListNode, to_list};") + extra_use_line.push_str("\nuse crate::util::linked_list::{ListNode, to_list};") } if code.contains("pub struct TreeNode") { - extra_use_line.push_str("\nuse super::util::tree::{TreeNode, to_tree};") + extra_use_line.push_str("\nuse crate::util::tree::{TreeNode, to_tree};") } if code.contains("pub struct Point") { - extra_use_line.push_str("\nuse super::util::point::Point;") + extra_use_line.push_str("\nuse crate::util::point::Point;") } extra_use_line } diff --git a/src/problem/mod.rs b/src/problem/mod.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/solution/mod.rs b/src/solution/mod.rs new file mode 100644 index 0000000..3b079b7 --- /dev/null +++ b/src/solution/mod.rs @@ -0,0 +1,237 @@ +mod s0006_zigzag_conversion; +mod s0238_product_of_array_except_self; +mod s0115_distinct_subsequences; +mod s0099_recover_binary_search_tree; +mod s0310_minimum_height_trees; +mod s0128_longest_consecutive_sequence; +mod s0274_h_index; +mod s0241_different_ways_to_add_parentheses; +mod s0024_swap_nodes_in_pairs; +mod s0110_balanced_binary_tree; +mod s0093_restore_ip_addresses; +mod s0076_minimum_window_substring; +mod s0124_binary_tree_maximum_path_sum; +mod s0122_best_time_to_buy_and_sell_stock_ii; +mod s0169_majority_element; +mod s0162_find_peak_element; +mod s0095_unique_binary_search_trees_ii; +mod s0155_min_stack; +mod s0040_combination_sum_ii; +mod s0217_contains_duplicate; +mod s0055_jump_game; +mod s0106_construct_binary_tree_from_inorder_and_postorder_traversal; +mod s0145_binary_tree_postorder_traversal; +mod s0079_word_search; +mod s0969_pancake_sorting; +mod s0042_trapping_rain_water; +mod s0108_convert_sorted_array_to_binary_search_tree; +mod s0083_remove_duplicates_from_sorted_list; +mod s0130_surrounded_regions; +mod s0226_invert_binary_tree; +mod s0027_remove_element; +mod s0188_best_time_to_buy_and_sell_stock_iv; +mod s0204_count_primes; +mod s0268_missing_number; +mod s0214_shortest_palindrome; +mod s0231_power_of_two; +mod s0202_happy_number; +mod s0075_sort_colors; +mod s0066_plus_one; +mod s0028_implement_strstr; +mod s0290_word_pattern; +mod s0048_rotate_image; +mod s0089_gray_code; +mod s0147_insertion_sort_list; +mod s0084_largest_rectangle_in_histogram; +mod s0011_container_with_most_water; +mod s0009_palindrome_number; +mod s0058_length_of_last_word; +mod s0080_remove_duplicates_from_sorted_array_ii; +mod s0030_substring_with_concatenation_of_all_words; +mod s0060_permutation_sequence; +mod s0071_simplify_path; +mod s0038_count_and_say; +mod s0144_binary_tree_preorder_traversal; +mod s0279_perfect_squares; +mod s0304_range_sum_query_2d_immutable; +mod s0292_nim_game; +mod s0264_ugly_number_ii; +mod s0132_palindrome_partitioning_ii; +mod s0019_remove_nth_node_from_end_of_list; +mod s0136_single_number; +mod s0018_4sum; +mod s0220_contains_duplicate_iii; +mod s0299_bulls_and_cows; +mod s0232_implement_queue_using_stacks; +mod s0100_same_tree; +mod s0171_excel_sheet_column_number; +mod s0087_scramble_string; +mod s0704_binary_search; +mod s0219_contains_duplicate_ii; +mod s0086_partition_list; +mod s0082_remove_duplicates_from_sorted_list_ii; +mod s0228_summary_ranges; +mod s0020_valid_parentheses; +mod s0017_letter_combinations_of_a_phone_number; +mod s0312_burst_balloons; +mod s0306_additive_number; +mod s0283_move_zeroes; +mod s1018_binary_prefix_divisible_by_5; +mod s0201_bitwise_and_of_numbers_range; +mod s0109_convert_sorted_list_to_binary_search_tree; +mod s0101_symmetric_tree; +mod s0098_validate_binary_search_tree; +mod s0035_search_insert_position; +mod s0050_powx_n; +mod s0198_house_robber; +mod s0004_median_of_two_sorted_arrays; +mod s0221_maximal_square; +mod s0047_permutations_ii; +mod s0172_factorial_trailing_zeroes; +mod s0054_spiral_matrix; +mod s0053_maximum_subarray; +mod s1046_last_stone_weight; +mod s0146_lru_cache; +mod s0126_word_ladder_ii; +mod s0242_valid_anagram; +mod s0112_path_sum; +mod s0023_merge_k_sorted_lists; +mod s0230_kth_smallest_element_in_a_bst; +mod s0104_maximum_depth_of_binary_tree; +mod s0258_add_digits; +mod s0187_repeated_dna_sequences; +mod s0025_reverse_nodes_in_k_group; +mod s0039_combination_sum; +mod s0107_binary_tree_level_order_traversal_ii; +mod s0091_decode_ways; +mod s0056_merge_intervals; +mod s0065_valid_number; +mod s0016_3sum_closest; +mod s0096_unique_binary_search_trees; +mod s0072_edit_distance; +mod s0044_wildcard_matching; +mod s0239_sliding_window_maximum; +mod s0174_dungeon_game; +mod s0073_set_matrix_zeroes; +mod s0078_subsets; +mod s0037_sudoku_solver; +mod s0033_search_in_rotated_sorted_array; +mod s0002_add_two_numbers; +mod s0313_super_ugly_number; +mod s0068_text_justification; +mod s0064_minimum_path_sum; +mod s0218_the_skyline_problem; +mod s0125_valid_palindrome; +mod s0210_course_schedule_ii; +mod s0143_reorder_list; +mod s0164_maximum_gap; +mod s0097_interleaving_string; +mod s0105_construct_binary_tree_from_preorder_and_inorder_traversal; +mod s0167_two_sum_ii_input_array_is_sorted; +mod s0034_find_first_and_last_position_of_element_in_sorted_array; +mod s0094_binary_tree_inorder_traversal; +mod s0052_n_queens_ii; +mod s0121_best_time_to_buy_and_sell_stock; +mod s0273_integer_to_english_words; +mod s0225_implement_stack_using_queues; +mod s0046_permutations; +mod s0085_maximal_rectangle; +mod s0135_candy; +mod s0113_path_sum_ii; +mod s0029_divide_two_integers; +mod s0260_single_number_iii; +mod s0140_word_break_ii; +mod s0149_max_points_on_a_line; +mod s0213_house_robber_ii; +mod s0222_count_complete_tree_nodes; +mod s0134_gas_station; +mod s0057_insert_interval; +mod s0173_binary_search_tree_iterator; +mod s0077_combinations; +mod s0005_longest_palindromic_substring; +mod s0041_first_missing_positive; +mod s0026_remove_duplicates_from_sorted_array; +mod s0166_fraction_to_recurring_decimal; +mod s0119_pascals_triangle_ii; +mod s0012_integer_to_roman; +mod s0223_rectangle_area; +mod s0229_majority_element_ii; +mod s0061_rotate_list; +mod s0123_best_time_to_buy_and_sell_stock_iii; +mod s0301_remove_invalid_parentheses; +mod s0067_add_binary; +mod s0049_group_anagrams; +mod s0189_rotate_array; +mod s0001_two_sum; +mod s0275_h_index_ii; +mod s0103_binary_tree_zigzag_level_order_traversal; +mod s0137_single_number_ii; +mod s0208_implement_trie_prefix_tree; +mod s0300_longest_increasing_subsequence; +mod s0118_pascals_triangle; +mod s0010_regular_expression_matching; +mod s0013_roman_to_integer; +mod s0209_minimum_size_subarray_sum; +mod s0227_basic_calculator_ii; +mod s0022_generate_parentheses; +mod s0008_string_to_integer_atoi; +mod s0152_maximum_product_subarray; +mod s0014_longest_common_prefix; +mod s0070_climbing_stairs; +mod s0233_number_of_digit_one; +mod s0154_find_minimum_in_rotated_sorted_array_ii; +mod s0127_word_ladder; +mod s0207_course_schedule; +mod s0263_ugly_number; +mod s0295_find_median_from_data_stream; +mod s0148_sort_list; +mod s0257_binary_tree_paths; +mod s0120_triangle; +mod s0309_best_time_to_buy_and_sell_stock_with_cooldown; +mod s0074_search_a_2d_matrix; +mod s0215_kth_largest_element_in_an_array; +mod s0203_remove_linked_list_elements; +mod s0081_search_in_rotated_sorted_array_ii; +mod s0059_spiral_matrix_ii; +mod s0151_reverse_words_in_a_string; +mod s0205_isomorphic_strings; +mod s0179_largest_number; +mod s0168_excel_sheet_column_title; +mod s0007_reverse_integer; +mod s0032_longest_valid_parentheses; +mod s0165_compare_version_numbers; +mod s0031_next_permutation; +mod s0088_merge_sorted_array; +mod s0509_fibonacci_number; +mod s0036_valid_sudoku; +mod s0069_sqrtx; +mod s0211_add_and_search_word_data_structure_design; +mod s0114_flatten_binary_tree_to_linked_list; +mod s0224_basic_calculator; +mod s0045_jump_game_ii; +mod s0051_n_queens; +mod s0212_word_search_ii; +mod s0287_find_the_duplicate_number; +mod s0153_find_minimum_in_rotated_sorted_array; +mod s0289_game_of_life; +mod s0200_number_of_islands; +mod s0015_3sum; +mod s0216_combination_sum_iii; +mod s0043_multiply_strings; +mod s0090_subsets_ii; +mod s0003_longest_substring; +mod s0139_word_break; +mod s0150_evaluate_reverse_polish_notation; +mod s0063_unique_paths_ii; +mod s0062_unique_paths; +mod s0199_binary_tree_right_side_view; +mod s0282_expression_add_operators; +mod s0021_merge_two_sorted_lists; +mod s0129_sum_root_to_leaf_numbers; +mod s0206_reverse_linked_list; +mod s0131_palindrome_partitioning; +mod s0307_range_sum_query_mutable; +mod s0111_minimum_depth_of_binary_tree; +mod s0092_reverse_linked_list_ii; +mod s0303_range_sum_query_immutable; +mod s0102_binary_tree_level_order_traversal; diff --git a/src/n0001_two_sum.rs b/src/solution/s0001_two_sum.rs similarity index 100% rename from src/n0001_two_sum.rs rename to src/solution/s0001_two_sum.rs diff --git a/src/n0002_add_two_numbers.rs b/src/solution/s0002_add_two_numbers.rs similarity index 98% rename from src/n0002_add_two_numbers.rs rename to src/solution/s0002_add_two_numbers.rs index b7b21b0..5612c3d 100644 --- a/src/n0002_add_two_numbers.rs +++ b/src/solution/s0002_add_two_numbers.rs @@ -17,7 +17,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0003_longest_substring.rs b/src/solution/s0003_longest_substring.rs similarity index 100% rename from src/n0003_longest_substring.rs rename to src/solution/s0003_longest_substring.rs diff --git a/src/n0004_median_of_two_sorted_arrays.rs b/src/solution/s0004_median_of_two_sorted_arrays.rs similarity index 100% rename from src/n0004_median_of_two_sorted_arrays.rs rename to src/solution/s0004_median_of_two_sorted_arrays.rs diff --git a/src/n0005_longest_palindromic_substring.rs b/src/solution/s0005_longest_palindromic_substring.rs similarity index 100% rename from src/n0005_longest_palindromic_substring.rs rename to src/solution/s0005_longest_palindromic_substring.rs diff --git a/src/n0006_zigzag_conversion.rs b/src/solution/s0006_zigzag_conversion.rs similarity index 100% rename from src/n0006_zigzag_conversion.rs rename to src/solution/s0006_zigzag_conversion.rs diff --git a/src/n0007_reverse_integer.rs b/src/solution/s0007_reverse_integer.rs similarity index 100% rename from src/n0007_reverse_integer.rs rename to src/solution/s0007_reverse_integer.rs diff --git a/src/n0008_string_to_integer_atoi.rs b/src/solution/s0008_string_to_integer_atoi.rs similarity index 100% rename from src/n0008_string_to_integer_atoi.rs rename to src/solution/s0008_string_to_integer_atoi.rs diff --git a/src/n0009_palindrome_number.rs b/src/solution/s0009_palindrome_number.rs similarity index 100% rename from src/n0009_palindrome_number.rs rename to src/solution/s0009_palindrome_number.rs diff --git a/src/n0010_regular_expression_matching.rs b/src/solution/s0010_regular_expression_matching.rs similarity index 100% rename from src/n0010_regular_expression_matching.rs rename to src/solution/s0010_regular_expression_matching.rs diff --git a/src/n0011_container_with_most_water.rs b/src/solution/s0011_container_with_most_water.rs similarity index 100% rename from src/n0011_container_with_most_water.rs rename to src/solution/s0011_container_with_most_water.rs diff --git a/src/n0012_integer_to_roman.rs b/src/solution/s0012_integer_to_roman.rs similarity index 100% rename from src/n0012_integer_to_roman.rs rename to src/solution/s0012_integer_to_roman.rs diff --git a/src/n0013_roman_to_integer.rs b/src/solution/s0013_roman_to_integer.rs similarity index 100% rename from src/n0013_roman_to_integer.rs rename to src/solution/s0013_roman_to_integer.rs diff --git a/src/n0014_longest_common_prefix.rs b/src/solution/s0014_longest_common_prefix.rs similarity index 100% rename from src/n0014_longest_common_prefix.rs rename to src/solution/s0014_longest_common_prefix.rs diff --git a/src/n0015_3sum.rs b/src/solution/s0015_3sum.rs similarity index 100% rename from src/n0015_3sum.rs rename to src/solution/s0015_3sum.rs diff --git a/src/n0016_3sum_closest.rs b/src/solution/s0016_3sum_closest.rs similarity index 100% rename from src/n0016_3sum_closest.rs rename to src/solution/s0016_3sum_closest.rs diff --git a/src/n0017_letter_combinations_of_a_phone_number.rs b/src/solution/s0017_letter_combinations_of_a_phone_number.rs similarity index 100% rename from src/n0017_letter_combinations_of_a_phone_number.rs rename to src/solution/s0017_letter_combinations_of_a_phone_number.rs diff --git a/src/n0018_4sum.rs b/src/solution/s0018_4sum.rs similarity index 100% rename from src/n0018_4sum.rs rename to src/solution/s0018_4sum.rs diff --git a/src/n0019_remove_nth_node_from_end_of_list.rs b/src/solution/s0019_remove_nth_node_from_end_of_list.rs similarity index 97% rename from src/n0019_remove_nth_node_from_end_of_list.rs rename to src/solution/s0019_remove_nth_node_from_end_of_list.rs index a1698a4..b3dac82 100644 --- a/src/n0019_remove_nth_node_from_end_of_list.rs +++ b/src/solution/s0019_remove_nth_node_from_end_of_list.rs @@ -21,7 +21,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0020_valid_parentheses.rs b/src/solution/s0020_valid_parentheses.rs similarity index 100% rename from src/n0020_valid_parentheses.rs rename to src/solution/s0020_valid_parentheses.rs diff --git a/src/n0021_merge_two_sorted_lists.rs b/src/solution/s0021_merge_two_sorted_lists.rs similarity index 97% rename from src/n0021_merge_two_sorted_lists.rs rename to src/solution/s0021_merge_two_sorted_lists.rs index 5a25adf..c496d8e 100644 --- a/src/n0021_merge_two_sorted_lists.rs +++ b/src/solution/s0021_merge_two_sorted_lists.rs @@ -11,7 +11,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0022_generate_parentheses.rs b/src/solution/s0022_generate_parentheses.rs similarity index 100% rename from src/n0022_generate_parentheses.rs rename to src/solution/s0022_generate_parentheses.rs diff --git a/src/n0023_merge_k_sorted_lists.rs b/src/solution/s0023_merge_k_sorted_lists.rs similarity index 97% rename from src/n0023_merge_k_sorted_lists.rs rename to src/solution/s0023_merge_k_sorted_lists.rs index 74b9504..c213eb7 100644 --- a/src/n0023_merge_k_sorted_lists.rs +++ b/src/solution/s0023_merge_k_sorted_lists.rs @@ -17,7 +17,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here use std::cmp::Ordering; diff --git a/src/n0024_swap_nodes_in_pairs.rs b/src/solution/s0024_swap_nodes_in_pairs.rs similarity index 97% rename from src/n0024_swap_nodes_in_pairs.rs rename to src/solution/s0024_swap_nodes_in_pairs.rs index 41e3c6c..104d6b9 100644 --- a/src/n0024_swap_nodes_in_pairs.rs +++ b/src/solution/s0024_swap_nodes_in_pairs.rs @@ -17,7 +17,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0025_reverse_nodes_in_k_group.rs b/src/solution/s0025_reverse_nodes_in_k_group.rs similarity index 98% rename from src/n0025_reverse_nodes_in_k_group.rs rename to src/solution/s0025_reverse_nodes_in_k_group.rs index aac987f..3beb552 100644 --- a/src/n0025_reverse_nodes_in_k_group.rs +++ b/src/solution/s0025_reverse_nodes_in_k_group.rs @@ -25,7 +25,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0026_remove_duplicates_from_sorted_array.rs b/src/solution/s0026_remove_duplicates_from_sorted_array.rs similarity index 100% rename from src/n0026_remove_duplicates_from_sorted_array.rs rename to src/solution/s0026_remove_duplicates_from_sorted_array.rs diff --git a/src/n0027_remove_element.rs b/src/solution/s0027_remove_element.rs similarity index 100% rename from src/n0027_remove_element.rs rename to src/solution/s0027_remove_element.rs diff --git a/src/n0028_implement_strstr.rs b/src/solution/s0028_implement_strstr.rs similarity index 100% rename from src/n0028_implement_strstr.rs rename to src/solution/s0028_implement_strstr.rs diff --git a/src/n0029_divide_two_integers.rs b/src/solution/s0029_divide_two_integers.rs similarity index 100% rename from src/n0029_divide_two_integers.rs rename to src/solution/s0029_divide_two_integers.rs diff --git a/src/n0030_substring_with_concatenation_of_all_words.rs b/src/solution/s0030_substring_with_concatenation_of_all_words.rs similarity index 100% rename from src/n0030_substring_with_concatenation_of_all_words.rs rename to src/solution/s0030_substring_with_concatenation_of_all_words.rs diff --git a/src/n0031_next_permutation.rs b/src/solution/s0031_next_permutation.rs similarity index 100% rename from src/n0031_next_permutation.rs rename to src/solution/s0031_next_permutation.rs diff --git a/src/n0032_longest_valid_parentheses.rs b/src/solution/s0032_longest_valid_parentheses.rs similarity index 100% rename from src/n0032_longest_valid_parentheses.rs rename to src/solution/s0032_longest_valid_parentheses.rs diff --git a/src/n0033_search_in_rotated_sorted_array.rs b/src/solution/s0033_search_in_rotated_sorted_array.rs similarity index 100% rename from src/n0033_search_in_rotated_sorted_array.rs rename to src/solution/s0033_search_in_rotated_sorted_array.rs diff --git a/src/n0034_find_first_and_last_position_of_element_in_sorted_array.rs b/src/solution/s0034_find_first_and_last_position_of_element_in_sorted_array.rs similarity index 100% rename from src/n0034_find_first_and_last_position_of_element_in_sorted_array.rs rename to src/solution/s0034_find_first_and_last_position_of_element_in_sorted_array.rs diff --git a/src/n0035_search_insert_position.rs b/src/solution/s0035_search_insert_position.rs similarity index 100% rename from src/n0035_search_insert_position.rs rename to src/solution/s0035_search_insert_position.rs diff --git a/src/n0036_valid_sudoku.rs b/src/solution/s0036_valid_sudoku.rs similarity index 100% rename from src/n0036_valid_sudoku.rs rename to src/solution/s0036_valid_sudoku.rs diff --git a/src/n0037_sudoku_solver.rs b/src/solution/s0037_sudoku_solver.rs similarity index 100% rename from src/n0037_sudoku_solver.rs rename to src/solution/s0037_sudoku_solver.rs diff --git a/src/n0038_count_and_say.rs b/src/solution/s0038_count_and_say.rs similarity index 100% rename from src/n0038_count_and_say.rs rename to src/solution/s0038_count_and_say.rs diff --git a/src/n0039_combination_sum.rs b/src/solution/s0039_combination_sum.rs similarity index 100% rename from src/n0039_combination_sum.rs rename to src/solution/s0039_combination_sum.rs diff --git a/src/n0040_combination_sum_ii.rs b/src/solution/s0040_combination_sum_ii.rs similarity index 100% rename from src/n0040_combination_sum_ii.rs rename to src/solution/s0040_combination_sum_ii.rs diff --git a/src/n0041_first_missing_positive.rs b/src/solution/s0041_first_missing_positive.rs similarity index 100% rename from src/n0041_first_missing_positive.rs rename to src/solution/s0041_first_missing_positive.rs diff --git a/src/n0042_trapping_rain_water.rs b/src/solution/s0042_trapping_rain_water.rs similarity index 100% rename from src/n0042_trapping_rain_water.rs rename to src/solution/s0042_trapping_rain_water.rs diff --git a/src/n0043_multiply_strings.rs b/src/solution/s0043_multiply_strings.rs similarity index 100% rename from src/n0043_multiply_strings.rs rename to src/solution/s0043_multiply_strings.rs diff --git a/src/n0044_wildcard_matching.rs b/src/solution/s0044_wildcard_matching.rs similarity index 100% rename from src/n0044_wildcard_matching.rs rename to src/solution/s0044_wildcard_matching.rs diff --git a/src/n0045_jump_game_ii.rs b/src/solution/s0045_jump_game_ii.rs similarity index 100% rename from src/n0045_jump_game_ii.rs rename to src/solution/s0045_jump_game_ii.rs diff --git a/src/n0046_permutations.rs b/src/solution/s0046_permutations.rs similarity index 100% rename from src/n0046_permutations.rs rename to src/solution/s0046_permutations.rs diff --git a/src/n0047_permutations_ii.rs b/src/solution/s0047_permutations_ii.rs similarity index 100% rename from src/n0047_permutations_ii.rs rename to src/solution/s0047_permutations_ii.rs diff --git a/src/n0048_rotate_image.rs b/src/solution/s0048_rotate_image.rs similarity index 100% rename from src/n0048_rotate_image.rs rename to src/solution/s0048_rotate_image.rs diff --git a/src/n0049_group_anagrams.rs b/src/solution/s0049_group_anagrams.rs similarity index 100% rename from src/n0049_group_anagrams.rs rename to src/solution/s0049_group_anagrams.rs diff --git a/src/n0050_powx_n.rs b/src/solution/s0050_powx_n.rs similarity index 100% rename from src/n0050_powx_n.rs rename to src/solution/s0050_powx_n.rs diff --git a/src/n0051_n_queens.rs b/src/solution/s0051_n_queens.rs similarity index 100% rename from src/n0051_n_queens.rs rename to src/solution/s0051_n_queens.rs diff --git a/src/n0052_n_queens_ii.rs b/src/solution/s0052_n_queens_ii.rs similarity index 100% rename from src/n0052_n_queens_ii.rs rename to src/solution/s0052_n_queens_ii.rs diff --git a/src/n0053_maximum_subarray.rs b/src/solution/s0053_maximum_subarray.rs similarity index 100% rename from src/n0053_maximum_subarray.rs rename to src/solution/s0053_maximum_subarray.rs diff --git a/src/n0054_spiral_matrix.rs b/src/solution/s0054_spiral_matrix.rs similarity index 100% rename from src/n0054_spiral_matrix.rs rename to src/solution/s0054_spiral_matrix.rs diff --git a/src/n0055_jump_game.rs b/src/solution/s0055_jump_game.rs similarity index 100% rename from src/n0055_jump_game.rs rename to src/solution/s0055_jump_game.rs diff --git a/src/n0056_merge_intervals.rs b/src/solution/s0056_merge_intervals.rs similarity index 100% rename from src/n0056_merge_intervals.rs rename to src/solution/s0056_merge_intervals.rs diff --git a/src/n0057_insert_interval.rs b/src/solution/s0057_insert_interval.rs similarity index 100% rename from src/n0057_insert_interval.rs rename to src/solution/s0057_insert_interval.rs diff --git a/src/n0058_length_of_last_word.rs b/src/solution/s0058_length_of_last_word.rs similarity index 100% rename from src/n0058_length_of_last_word.rs rename to src/solution/s0058_length_of_last_word.rs diff --git a/src/n0059_spiral_matrix_ii.rs b/src/solution/s0059_spiral_matrix_ii.rs similarity index 100% rename from src/n0059_spiral_matrix_ii.rs rename to src/solution/s0059_spiral_matrix_ii.rs diff --git a/src/n0060_permutation_sequence.rs b/src/solution/s0060_permutation_sequence.rs similarity index 100% rename from src/n0060_permutation_sequence.rs rename to src/solution/s0060_permutation_sequence.rs diff --git a/src/n0061_rotate_list.rs b/src/solution/s0061_rotate_list.rs similarity index 94% rename from src/n0061_rotate_list.rs rename to src/solution/s0061_rotate_list.rs index 0881211..b772357 100644 --- a/src/n0061_rotate_list.rs +++ b/src/solution/s0061_rotate_list.rs @@ -26,7 +26,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0062_unique_paths.rs b/src/solution/s0062_unique_paths.rs similarity index 100% rename from src/n0062_unique_paths.rs rename to src/solution/s0062_unique_paths.rs diff --git a/src/n0063_unique_paths_ii.rs b/src/solution/s0063_unique_paths_ii.rs similarity index 100% rename from src/n0063_unique_paths_ii.rs rename to src/solution/s0063_unique_paths_ii.rs diff --git a/src/n0064_minimum_path_sum.rs b/src/solution/s0064_minimum_path_sum.rs similarity index 100% rename from src/n0064_minimum_path_sum.rs rename to src/solution/s0064_minimum_path_sum.rs diff --git a/src/n0065_valid_number.rs b/src/solution/s0065_valid_number.rs similarity index 100% rename from src/n0065_valid_number.rs rename to src/solution/s0065_valid_number.rs diff --git a/src/n0066_plus_one.rs b/src/solution/s0066_plus_one.rs similarity index 100% rename from src/n0066_plus_one.rs rename to src/solution/s0066_plus_one.rs diff --git a/src/n0067_add_binary.rs b/src/solution/s0067_add_binary.rs similarity index 100% rename from src/n0067_add_binary.rs rename to src/solution/s0067_add_binary.rs diff --git a/src/n0068_text_justification.rs b/src/solution/s0068_text_justification.rs similarity index 100% rename from src/n0068_text_justification.rs rename to src/solution/s0068_text_justification.rs diff --git a/src/n0069_sqrtx.rs b/src/solution/s0069_sqrtx.rs similarity index 100% rename from src/n0069_sqrtx.rs rename to src/solution/s0069_sqrtx.rs diff --git a/src/n0070_climbing_stairs.rs b/src/solution/s0070_climbing_stairs.rs similarity index 100% rename from src/n0070_climbing_stairs.rs rename to src/solution/s0070_climbing_stairs.rs diff --git a/src/n0071_simplify_path.rs b/src/solution/s0071_simplify_path.rs similarity index 100% rename from src/n0071_simplify_path.rs rename to src/solution/s0071_simplify_path.rs diff --git a/src/n0072_edit_distance.rs b/src/solution/s0072_edit_distance.rs similarity index 100% rename from src/n0072_edit_distance.rs rename to src/solution/s0072_edit_distance.rs diff --git a/src/n0073_set_matrix_zeroes.rs b/src/solution/s0073_set_matrix_zeroes.rs similarity index 100% rename from src/n0073_set_matrix_zeroes.rs rename to src/solution/s0073_set_matrix_zeroes.rs diff --git a/src/n0074_search_a_2d_matrix.rs b/src/solution/s0074_search_a_2d_matrix.rs similarity index 100% rename from src/n0074_search_a_2d_matrix.rs rename to src/solution/s0074_search_a_2d_matrix.rs diff --git a/src/n0075_sort_colors.rs b/src/solution/s0075_sort_colors.rs similarity index 100% rename from src/n0075_sort_colors.rs rename to src/solution/s0075_sort_colors.rs diff --git a/src/n0076_minimum_window_substring.rs b/src/solution/s0076_minimum_window_substring.rs similarity index 100% rename from src/n0076_minimum_window_substring.rs rename to src/solution/s0076_minimum_window_substring.rs diff --git a/src/n0077_combinations.rs b/src/solution/s0077_combinations.rs similarity index 100% rename from src/n0077_combinations.rs rename to src/solution/s0077_combinations.rs diff --git a/src/n0078_subsets.rs b/src/solution/s0078_subsets.rs similarity index 100% rename from src/n0078_subsets.rs rename to src/solution/s0078_subsets.rs diff --git a/src/n0079_word_search.rs b/src/solution/s0079_word_search.rs similarity index 100% rename from src/n0079_word_search.rs rename to src/solution/s0079_word_search.rs diff --git a/src/n0080_remove_duplicates_from_sorted_array_ii.rs b/src/solution/s0080_remove_duplicates_from_sorted_array_ii.rs similarity index 100% rename from src/n0080_remove_duplicates_from_sorted_array_ii.rs rename to src/solution/s0080_remove_duplicates_from_sorted_array_ii.rs diff --git a/src/n0081_search_in_rotated_sorted_array_ii.rs b/src/solution/s0081_search_in_rotated_sorted_array_ii.rs similarity index 100% rename from src/n0081_search_in_rotated_sorted_array_ii.rs rename to src/solution/s0081_search_in_rotated_sorted_array_ii.rs diff --git a/src/n0082_remove_duplicates_from_sorted_list_ii.rs b/src/solution/s0082_remove_duplicates_from_sorted_list_ii.rs similarity index 94% rename from src/n0082_remove_duplicates_from_sorted_list_ii.rs rename to src/solution/s0082_remove_duplicates_from_sorted_list_ii.rs index ff8c8b8..d04b15f 100644 --- a/src/n0082_remove_duplicates_from_sorted_list_ii.rs +++ b/src/solution/s0082_remove_duplicates_from_sorted_list_ii.rs @@ -19,7 +19,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0083_remove_duplicates_from_sorted_list.rs b/src/solution/s0083_remove_duplicates_from_sorted_list.rs similarity index 94% rename from src/n0083_remove_duplicates_from_sorted_list.rs rename to src/solution/s0083_remove_duplicates_from_sorted_list.rs index b8fa539..785cc03 100644 --- a/src/n0083_remove_duplicates_from_sorted_list.rs +++ b/src/solution/s0083_remove_duplicates_from_sorted_list.rs @@ -19,7 +19,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0084_largest_rectangle_in_histogram.rs b/src/solution/s0084_largest_rectangle_in_histogram.rs similarity index 100% rename from src/n0084_largest_rectangle_in_histogram.rs rename to src/solution/s0084_largest_rectangle_in_histogram.rs diff --git a/src/n0085_maximal_rectangle.rs b/src/solution/s0085_maximal_rectangle.rs similarity index 100% rename from src/n0085_maximal_rectangle.rs rename to src/solution/s0085_maximal_rectangle.rs diff --git a/src/n0086_partition_list.rs b/src/solution/s0086_partition_list.rs similarity index 97% rename from src/n0086_partition_list.rs rename to src/solution/s0086_partition_list.rs index ad03b08..4238586 100644 --- a/src/n0086_partition_list.rs +++ b/src/solution/s0086_partition_list.rs @@ -14,7 +14,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; impl Solution { pub fn partition(head: Option>, x: i32) -> Option> { diff --git a/src/n0087_scramble_string.rs b/src/solution/s0087_scramble_string.rs similarity index 100% rename from src/n0087_scramble_string.rs rename to src/solution/s0087_scramble_string.rs diff --git a/src/n0088_merge_sorted_array.rs b/src/solution/s0088_merge_sorted_array.rs similarity index 100% rename from src/n0088_merge_sorted_array.rs rename to src/solution/s0088_merge_sorted_array.rs diff --git a/src/n0089_gray_code.rs b/src/solution/s0089_gray_code.rs similarity index 100% rename from src/n0089_gray_code.rs rename to src/solution/s0089_gray_code.rs diff --git a/src/n0090_subsets_ii.rs b/src/solution/s0090_subsets_ii.rs similarity index 100% rename from src/n0090_subsets_ii.rs rename to src/solution/s0090_subsets_ii.rs diff --git a/src/n0091_decode_ways.rs b/src/solution/s0091_decode_ways.rs similarity index 100% rename from src/n0091_decode_ways.rs rename to src/solution/s0091_decode_ways.rs diff --git a/src/n0092_reverse_linked_list_ii.rs b/src/solution/s0092_reverse_linked_list_ii.rs similarity index 94% rename from src/n0092_reverse_linked_list_ii.rs rename to src/solution/s0092_reverse_linked_list_ii.rs index 705a787..e84035d 100644 --- a/src/n0092_reverse_linked_list_ii.rs +++ b/src/solution/s0092_reverse_linked_list_ii.rs @@ -14,7 +14,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0093_restore_ip_addresses.rs b/src/solution/s0093_restore_ip_addresses.rs similarity index 100% rename from src/n0093_restore_ip_addresses.rs rename to src/solution/s0093_restore_ip_addresses.rs diff --git a/src/n0094_binary_tree_inorder_traversal.rs b/src/solution/s0094_binary_tree_inorder_traversal.rs similarity index 96% rename from src/n0094_binary_tree_inorder_traversal.rs rename to src/solution/s0094_binary_tree_inorder_traversal.rs index c40cd1c..d4d2ea2 100644 --- a/src/n0094_binary_tree_inorder_traversal.rs +++ b/src/solution/s0094_binary_tree_inorder_traversal.rs @@ -22,7 +22,7 @@ pub struct Solution {} // submission codes start here -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; use std::cell::RefCell; use std::rc::Rc; impl Solution { diff --git a/src/n0095_unique_binary_search_trees_ii.rs b/src/solution/s0095_unique_binary_search_trees_ii.rs similarity index 97% rename from src/n0095_unique_binary_search_trees_ii.rs rename to src/solution/s0095_unique_binary_search_trees_ii.rs index 3ab366e..ffdc763 100644 --- a/src/n0095_unique_binary_search_trees_ii.rs +++ b/src/solution/s0095_unique_binary_search_trees_ii.rs @@ -48,7 +48,7 @@ pub struct Solution {} / \ 2 4 */ -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; use std::cell::RefCell; use std::rc::Rc; impl Solution { diff --git a/src/n0096_unique_binary_search_trees.rs b/src/solution/s0096_unique_binary_search_trees.rs similarity index 100% rename from src/n0096_unique_binary_search_trees.rs rename to src/solution/s0096_unique_binary_search_trees.rs diff --git a/src/n0097_interleaving_string.rs b/src/solution/s0097_interleaving_string.rs similarity index 100% rename from src/n0097_interleaving_string.rs rename to src/solution/s0097_interleaving_string.rs diff --git a/src/n0098_validate_binary_search_tree.rs b/src/solution/s0098_validate_binary_search_tree.rs similarity index 98% rename from src/n0098_validate_binary_search_tree.rs rename to src/solution/s0098_validate_binary_search_tree.rs index fcb359e..7f55a47 100644 --- a/src/n0098_validate_binary_search_tree.rs +++ b/src/solution/s0098_validate_binary_search_tree.rs @@ -40,7 +40,7 @@ pub struct Solution {} // submission codes start here // Definition for a binary tree node. -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; use std::cell::RefCell; use std::rc::Rc; diff --git a/src/n0099_recover_binary_search_tree.rs b/src/solution/s0099_recover_binary_search_tree.rs similarity index 95% rename from src/n0099_recover_binary_search_tree.rs rename to src/solution/s0099_recover_binary_search_tree.rs index 8bc39b3..3b92da0 100644 --- a/src/n0099_recover_binary_search_tree.rs +++ b/src/solution/s0099_recover_binary_search_tree.rs @@ -55,7 +55,7 @@ */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0100_same_tree.rs b/src/solution/s0100_same_tree.rs similarity index 96% rename from src/n0100_same_tree.rs rename to src/solution/s0100_same_tree.rs index 51b7ad7..f1ca197 100644 --- a/src/n0100_same_tree.rs +++ b/src/solution/s0100_same_tree.rs @@ -44,7 +44,7 @@ */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here use std::cell::RefCell; use std::rc::Rc; diff --git a/src/n0101_symmetric_tree.rs b/src/solution/s0101_symmetric_tree.rs similarity index 97% rename from src/n0101_symmetric_tree.rs rename to src/solution/s0101_symmetric_tree.rs index d341ff3..c62962d 100644 --- a/src/n0101_symmetric_tree.rs +++ b/src/solution/s0101_symmetric_tree.rs @@ -30,7 +30,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0102_binary_tree_level_order_traversal.rs b/src/solution/s0102_binary_tree_level_order_traversal.rs similarity index 97% rename from src/n0102_binary_tree_level_order_traversal.rs rename to src/solution/s0102_binary_tree_level_order_traversal.rs index 6fdabf6..42f782a 100644 --- a/src/n0102_binary_tree_level_order_traversal.rs +++ b/src/solution/s0102_binary_tree_level_order_traversal.rs @@ -26,7 +26,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0103_binary_tree_zigzag_level_order_traversal.rs b/src/solution/s0103_binary_tree_zigzag_level_order_traversal.rs similarity index 97% rename from src/n0103_binary_tree_zigzag_level_order_traversal.rs rename to src/solution/s0103_binary_tree_zigzag_level_order_traversal.rs index ce31b6b..96476fd 100644 --- a/src/n0103_binary_tree_zigzag_level_order_traversal.rs +++ b/src/solution/s0103_binary_tree_zigzag_level_order_traversal.rs @@ -26,7 +26,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0104_maximum_depth_of_binary_tree.rs b/src/solution/s0104_maximum_depth_of_binary_tree.rs similarity index 96% rename from src/n0104_maximum_depth_of_binary_tree.rs rename to src/solution/s0104_maximum_depth_of_binary_tree.rs index c5faf23..6d2f18e 100644 --- a/src/n0104_maximum_depth_of_binary_tree.rs +++ b/src/solution/s0104_maximum_depth_of_binary_tree.rs @@ -22,7 +22,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0105_construct_binary_tree_from_preorder_and_inorder_traversal.rs b/src/solution/s0105_construct_binary_tree_from_preorder_and_inorder_traversal.rs similarity index 97% rename from src/n0105_construct_binary_tree_from_preorder_and_inorder_traversal.rs rename to src/solution/s0105_construct_binary_tree_from_preorder_and_inorder_traversal.rs index 611725d..e271faa 100644 --- a/src/n0105_construct_binary_tree_from_preorder_and_inorder_traversal.rs +++ b/src/solution/s0105_construct_binary_tree_from_preorder_and_inorder_traversal.rs @@ -23,7 +23,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0106_construct_binary_tree_from_inorder_and_postorder_traversal.rs b/src/solution/s0106_construct_binary_tree_from_inorder_and_postorder_traversal.rs similarity index 97% rename from src/n0106_construct_binary_tree_from_inorder_and_postorder_traversal.rs rename to src/solution/s0106_construct_binary_tree_from_inorder_and_postorder_traversal.rs index 7d3e820..63c469b 100644 --- a/src/n0106_construct_binary_tree_from_inorder_and_postorder_traversal.rs +++ b/src/solution/s0106_construct_binary_tree_from_inorder_and_postorder_traversal.rs @@ -24,7 +24,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0107_binary_tree_level_order_traversal_ii.rs b/src/solution/s0107_binary_tree_level_order_traversal_ii.rs similarity index 97% rename from src/n0107_binary_tree_level_order_traversal_ii.rs rename to src/solution/s0107_binary_tree_level_order_traversal_ii.rs index 4285596..f77229a 100644 --- a/src/n0107_binary_tree_level_order_traversal_ii.rs +++ b/src/solution/s0107_binary_tree_level_order_traversal_ii.rs @@ -26,7 +26,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0108_convert_sorted_array_to_binary_search_tree.rs b/src/solution/s0108_convert_sorted_array_to_binary_search_tree.rs similarity index 97% rename from src/n0108_convert_sorted_array_to_binary_search_tree.rs rename to src/solution/s0108_convert_sorted_array_to_binary_search_tree.rs index 4da3378..67e4b2a 100644 --- a/src/n0108_convert_sorted_array_to_binary_search_tree.rs +++ b/src/solution/s0108_convert_sorted_array_to_binary_search_tree.rs @@ -21,7 +21,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0109_convert_sorted_list_to_binary_search_tree.rs b/src/solution/s0109_convert_sorted_list_to_binary_search_tree.rs similarity index 94% rename from src/n0109_convert_sorted_list_to_binary_search_tree.rs rename to src/solution/s0109_convert_sorted_list_to_binary_search_tree.rs index 072c6ea..6bb37b0 100644 --- a/src/n0109_convert_sorted_list_to_binary_search_tree.rs +++ b/src/solution/s0109_convert_sorted_list_to_binary_search_tree.rs @@ -21,8 +21,8 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; -use super::util::tree::{to_tree, TreeNode}; +use crate::util::linked_list::{to_list, ListNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0110_balanced_binary_tree.rs b/src/solution/s0110_balanced_binary_tree.rs similarity index 93% rename from src/n0110_balanced_binary_tree.rs rename to src/solution/s0110_balanced_binary_tree.rs index 68e1b2a..bb067d0 100644 --- a/src/n0110_balanced_binary_tree.rs +++ b/src/solution/s0110_balanced_binary_tree.rs @@ -40,7 +40,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0111_minimum_depth_of_binary_tree.rs b/src/solution/s0111_minimum_depth_of_binary_tree.rs similarity index 96% rename from src/n0111_minimum_depth_of_binary_tree.rs rename to src/solution/s0111_minimum_depth_of_binary_tree.rs index f537c31..1efb759 100644 --- a/src/n0111_minimum_depth_of_binary_tree.rs +++ b/src/solution/s0111_minimum_depth_of_binary_tree.rs @@ -22,7 +22,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0112_path_sum.rs b/src/solution/s0112_path_sum.rs similarity index 97% rename from src/n0112_path_sum.rs rename to src/solution/s0112_path_sum.rs index 72e34da..2f036b2 100644 --- a/src/n0112_path_sum.rs +++ b/src/solution/s0112_path_sum.rs @@ -23,7 +23,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0113_path_sum_ii.rs b/src/solution/s0113_path_sum_ii.rs similarity index 97% rename from src/n0113_path_sum_ii.rs rename to src/solution/s0113_path_sum_ii.rs index c9914e0..d567e69 100644 --- a/src/n0113_path_sum_ii.rs +++ b/src/solution/s0113_path_sum_ii.rs @@ -30,7 +30,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0114_flatten_binary_tree_to_linked_list.rs b/src/solution/s0114_flatten_binary_tree_to_linked_list.rs similarity index 97% rename from src/n0114_flatten_binary_tree_to_linked_list.rs rename to src/solution/s0114_flatten_binary_tree_to_linked_list.rs index 2b46cd4..9661e9e 100644 --- a/src/n0114_flatten_binary_tree_to_linked_list.rs +++ b/src/solution/s0114_flatten_binary_tree_to_linked_list.rs @@ -31,7 +31,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0115_distinct_subsequences.rs b/src/solution/s0115_distinct_subsequences.rs similarity index 100% rename from src/n0115_distinct_subsequences.rs rename to src/solution/s0115_distinct_subsequences.rs diff --git a/src/n0118_pascals_triangle.rs b/src/solution/s0118_pascals_triangle.rs similarity index 100% rename from src/n0118_pascals_triangle.rs rename to src/solution/s0118_pascals_triangle.rs diff --git a/src/n0119_pascals_triangle_ii.rs b/src/solution/s0119_pascals_triangle_ii.rs similarity index 100% rename from src/n0119_pascals_triangle_ii.rs rename to src/solution/s0119_pascals_triangle_ii.rs diff --git a/src/n0120_triangle.rs b/src/solution/s0120_triangle.rs similarity index 100% rename from src/n0120_triangle.rs rename to src/solution/s0120_triangle.rs diff --git a/src/n0121_best_time_to_buy_and_sell_stock.rs b/src/solution/s0121_best_time_to_buy_and_sell_stock.rs similarity index 100% rename from src/n0121_best_time_to_buy_and_sell_stock.rs rename to src/solution/s0121_best_time_to_buy_and_sell_stock.rs diff --git a/src/n0122_best_time_to_buy_and_sell_stock_ii.rs b/src/solution/s0122_best_time_to_buy_and_sell_stock_ii.rs similarity index 100% rename from src/n0122_best_time_to_buy_and_sell_stock_ii.rs rename to src/solution/s0122_best_time_to_buy_and_sell_stock_ii.rs diff --git a/src/n0123_best_time_to_buy_and_sell_stock_iii.rs b/src/solution/s0123_best_time_to_buy_and_sell_stock_iii.rs similarity index 100% rename from src/n0123_best_time_to_buy_and_sell_stock_iii.rs rename to src/solution/s0123_best_time_to_buy_and_sell_stock_iii.rs diff --git a/src/n0124_binary_tree_maximum_path_sum.rs b/src/solution/s0124_binary_tree_maximum_path_sum.rs similarity index 98% rename from src/n0124_binary_tree_maximum_path_sum.rs rename to src/solution/s0124_binary_tree_maximum_path_sum.rs index 5517d18..f76f317 100644 --- a/src/n0124_binary_tree_maximum_path_sum.rs +++ b/src/solution/s0124_binary_tree_maximum_path_sum.rs @@ -33,7 +33,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0125_valid_palindrome.rs b/src/solution/s0125_valid_palindrome.rs similarity index 100% rename from src/n0125_valid_palindrome.rs rename to src/solution/s0125_valid_palindrome.rs diff --git a/src/n0126_word_ladder_ii.rs b/src/solution/s0126_word_ladder_ii.rs similarity index 100% rename from src/n0126_word_ladder_ii.rs rename to src/solution/s0126_word_ladder_ii.rs diff --git a/src/n0127_word_ladder.rs b/src/solution/s0127_word_ladder.rs similarity index 100% rename from src/n0127_word_ladder.rs rename to src/solution/s0127_word_ladder.rs diff --git a/src/n0128_longest_consecutive_sequence.rs b/src/solution/s0128_longest_consecutive_sequence.rs similarity index 100% rename from src/n0128_longest_consecutive_sequence.rs rename to src/solution/s0128_longest_consecutive_sequence.rs diff --git a/src/n0129_sum_root_to_leaf_numbers.rs b/src/solution/s0129_sum_root_to_leaf_numbers.rs similarity index 97% rename from src/n0129_sum_root_to_leaf_numbers.rs rename to src/solution/s0129_sum_root_to_leaf_numbers.rs index 5e423c3..c52dc94 100644 --- a/src/n0129_sum_root_to_leaf_numbers.rs +++ b/src/solution/s0129_sum_root_to_leaf_numbers.rs @@ -40,7 +40,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0130_surrounded_regions.rs b/src/solution/s0130_surrounded_regions.rs similarity index 100% rename from src/n0130_surrounded_regions.rs rename to src/solution/s0130_surrounded_regions.rs diff --git a/src/n0131_palindrome_partitioning.rs b/src/solution/s0131_palindrome_partitioning.rs similarity index 100% rename from src/n0131_palindrome_partitioning.rs rename to src/solution/s0131_palindrome_partitioning.rs diff --git a/src/n0132_palindrome_partitioning_ii.rs b/src/solution/s0132_palindrome_partitioning_ii.rs similarity index 100% rename from src/n0132_palindrome_partitioning_ii.rs rename to src/solution/s0132_palindrome_partitioning_ii.rs diff --git a/src/n0134_gas_station.rs b/src/solution/s0134_gas_station.rs similarity index 100% rename from src/n0134_gas_station.rs rename to src/solution/s0134_gas_station.rs diff --git a/src/n0135_candy.rs b/src/solution/s0135_candy.rs similarity index 100% rename from src/n0135_candy.rs rename to src/solution/s0135_candy.rs diff --git a/src/n0136_single_number.rs b/src/solution/s0136_single_number.rs similarity index 100% rename from src/n0136_single_number.rs rename to src/solution/s0136_single_number.rs diff --git a/src/n0137_single_number_ii.rs b/src/solution/s0137_single_number_ii.rs similarity index 100% rename from src/n0137_single_number_ii.rs rename to src/solution/s0137_single_number_ii.rs diff --git a/src/n0139_word_break.rs b/src/solution/s0139_word_break.rs similarity index 100% rename from src/n0139_word_break.rs rename to src/solution/s0139_word_break.rs diff --git a/src/n0140_word_break_ii.rs b/src/solution/s0140_word_break_ii.rs similarity index 100% rename from src/n0140_word_break_ii.rs rename to src/solution/s0140_word_break_ii.rs diff --git a/src/n0143_reorder_list.rs b/src/solution/s0143_reorder_list.rs similarity index 93% rename from src/n0143_reorder_list.rs rename to src/solution/s0143_reorder_list.rs index 169c44d..06ec32a 100644 --- a/src/n0143_reorder_list.rs +++ b/src/solution/s0143_reorder_list.rs @@ -19,7 +19,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0144_binary_tree_preorder_traversal.rs b/src/solution/s0144_binary_tree_preorder_traversal.rs similarity index 96% rename from src/n0144_binary_tree_preorder_traversal.rs rename to src/solution/s0144_binary_tree_preorder_traversal.rs index 951014c..02ed1f7 100644 --- a/src/n0144_binary_tree_preorder_traversal.rs +++ b/src/solution/s0144_binary_tree_preorder_traversal.rs @@ -20,7 +20,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0145_binary_tree_postorder_traversal.rs b/src/solution/s0145_binary_tree_postorder_traversal.rs similarity index 96% rename from src/n0145_binary_tree_postorder_traversal.rs rename to src/solution/s0145_binary_tree_postorder_traversal.rs index 6649565..2670b5b 100644 --- a/src/n0145_binary_tree_postorder_traversal.rs +++ b/src/solution/s0145_binary_tree_postorder_traversal.rs @@ -20,7 +20,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0146_lru_cache.rs b/src/solution/s0146_lru_cache.rs similarity index 100% rename from src/n0146_lru_cache.rs rename to src/solution/s0146_lru_cache.rs diff --git a/src/n0147_insertion_sort_list.rs b/src/solution/s0147_insertion_sort_list.rs similarity index 96% rename from src/n0147_insertion_sort_list.rs rename to src/solution/s0147_insertion_sort_list.rs index edcd078..cdcd2d6 100644 --- a/src/n0147_insertion_sort_list.rs +++ b/src/solution/s0147_insertion_sort_list.rs @@ -9,7 +9,7 @@ *
* A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list.
* With each iteration one element (red) is removed from the input data and inserted in-place into the sorted list

- * + * * *
    *
@@ -39,7 +39,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0148_sort_list.rs b/src/solution/s0148_sort_list.rs similarity index 98% rename from src/n0148_sort_list.rs rename to src/solution/s0148_sort_list.rs index 5fd6a8a..4bc8ac1 100644 --- a/src/n0148_sort_list.rs +++ b/src/solution/s0148_sort_list.rs @@ -18,7 +18,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0149_max_points_on_a_line.rs b/src/solution/s0149_max_points_on_a_line.rs similarity index 95% rename from src/n0149_max_points_on_a_line.rs rename to src/solution/s0149_max_points_on_a_line.rs index dff9477..c2faf93 100644 --- a/src/n0149_max_points_on_a_line.rs +++ b/src/solution/s0149_max_points_on_a_line.rs @@ -13,7 +13,7 @@ * | * | o * | o - * | o + * | o * +-------------> * 0 1 2 3 4 * @@ -36,7 +36,7 @@ * */ pub struct Solution {} -use super::util::point::Point; +use crate::util::point::Point; /* 要回顾下高中数学:已知两点, 求解一般式: diff --git a/src/n0150_evaluate_reverse_polish_notation.rs b/src/solution/s0150_evaluate_reverse_polish_notation.rs similarity index 100% rename from src/n0150_evaluate_reverse_polish_notation.rs rename to src/solution/s0150_evaluate_reverse_polish_notation.rs diff --git a/src/n0151_reverse_words_in_a_string.rs b/src/solution/s0151_reverse_words_in_a_string.rs similarity index 100% rename from src/n0151_reverse_words_in_a_string.rs rename to src/solution/s0151_reverse_words_in_a_string.rs diff --git a/src/n0152_maximum_product_subarray.rs b/src/solution/s0152_maximum_product_subarray.rs similarity index 100% rename from src/n0152_maximum_product_subarray.rs rename to src/solution/s0152_maximum_product_subarray.rs diff --git a/src/n0153_find_minimum_in_rotated_sorted_array.rs b/src/solution/s0153_find_minimum_in_rotated_sorted_array.rs similarity index 100% rename from src/n0153_find_minimum_in_rotated_sorted_array.rs rename to src/solution/s0153_find_minimum_in_rotated_sorted_array.rs diff --git a/src/n0154_find_minimum_in_rotated_sorted_array_ii.rs b/src/solution/s0154_find_minimum_in_rotated_sorted_array_ii.rs similarity index 100% rename from src/n0154_find_minimum_in_rotated_sorted_array_ii.rs rename to src/solution/s0154_find_minimum_in_rotated_sorted_array_ii.rs diff --git a/src/n0155_min_stack.rs b/src/solution/s0155_min_stack.rs similarity index 100% rename from src/n0155_min_stack.rs rename to src/solution/s0155_min_stack.rs diff --git a/src/n0162_find_peak_element.rs b/src/solution/s0162_find_peak_element.rs similarity index 100% rename from src/n0162_find_peak_element.rs rename to src/solution/s0162_find_peak_element.rs diff --git a/src/n0164_maximum_gap.rs b/src/solution/s0164_maximum_gap.rs similarity index 100% rename from src/n0164_maximum_gap.rs rename to src/solution/s0164_maximum_gap.rs diff --git a/src/n0165_compare_version_numbers.rs b/src/solution/s0165_compare_version_numbers.rs similarity index 100% rename from src/n0165_compare_version_numbers.rs rename to src/solution/s0165_compare_version_numbers.rs diff --git a/src/n0166_fraction_to_recurring_decimal.rs b/src/solution/s0166_fraction_to_recurring_decimal.rs similarity index 100% rename from src/n0166_fraction_to_recurring_decimal.rs rename to src/solution/s0166_fraction_to_recurring_decimal.rs diff --git a/src/n0167_two_sum_ii_input_array_is_sorted.rs b/src/solution/s0167_two_sum_ii_input_array_is_sorted.rs similarity index 100% rename from src/n0167_two_sum_ii_input_array_is_sorted.rs rename to src/solution/s0167_two_sum_ii_input_array_is_sorted.rs diff --git a/src/n0168_excel_sheet_column_title.rs b/src/solution/s0168_excel_sheet_column_title.rs similarity index 100% rename from src/n0168_excel_sheet_column_title.rs rename to src/solution/s0168_excel_sheet_column_title.rs diff --git a/src/n0169_majority_element.rs b/src/solution/s0169_majority_element.rs similarity index 100% rename from src/n0169_majority_element.rs rename to src/solution/s0169_majority_element.rs diff --git a/src/n0171_excel_sheet_column_number.rs b/src/solution/s0171_excel_sheet_column_number.rs similarity index 100% rename from src/n0171_excel_sheet_column_number.rs rename to src/solution/s0171_excel_sheet_column_number.rs diff --git a/src/n0172_factorial_trailing_zeroes.rs b/src/solution/s0172_factorial_trailing_zeroes.rs similarity index 100% rename from src/n0172_factorial_trailing_zeroes.rs rename to src/solution/s0172_factorial_trailing_zeroes.rs diff --git a/src/n0173_binary_search_tree_iterator.rs b/src/solution/s0173_binary_search_tree_iterator.rs similarity index 94% rename from src/n0173_binary_search_tree_iterator.rs rename to src/solution/s0173_binary_search_tree_iterator.rs index 582e922..caef472 100644 --- a/src/n0173_binary_search_tree_iterator.rs +++ b/src/solution/s0173_binary_search_tree_iterator.rs @@ -5,7 +5,7 @@ * * Calling next() will return the next smallest number in the BST. * - * + * * * * @@ -27,7 +27,7 @@ * iterator.hasNext(); // return false * * - * + * * * Note: * @@ -38,7 +38,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; use std::cell::RefCell; use std::rc::Rc; diff --git a/src/n0174_dungeon_game.rs b/src/solution/s0174_dungeon_game.rs similarity index 100% rename from src/n0174_dungeon_game.rs rename to src/solution/s0174_dungeon_game.rs diff --git a/src/n0179_largest_number.rs b/src/solution/s0179_largest_number.rs similarity index 100% rename from src/n0179_largest_number.rs rename to src/solution/s0179_largest_number.rs diff --git a/src/n0187_repeated_dna_sequences.rs b/src/solution/s0187_repeated_dna_sequences.rs similarity index 100% rename from src/n0187_repeated_dna_sequences.rs rename to src/solution/s0187_repeated_dna_sequences.rs diff --git a/src/n0188_best_time_to_buy_and_sell_stock_iv.rs b/src/solution/s0188_best_time_to_buy_and_sell_stock_iv.rs similarity index 100% rename from src/n0188_best_time_to_buy_and_sell_stock_iv.rs rename to src/solution/s0188_best_time_to_buy_and_sell_stock_iv.rs diff --git a/src/n0189_rotate_array.rs b/src/solution/s0189_rotate_array.rs similarity index 100% rename from src/n0189_rotate_array.rs rename to src/solution/s0189_rotate_array.rs diff --git a/src/n0198_house_robber.rs b/src/solution/s0198_house_robber.rs similarity index 100% rename from src/n0198_house_robber.rs rename to src/solution/s0198_house_robber.rs diff --git a/src/n0199_binary_tree_right_side_view.rs b/src/solution/s0199_binary_tree_right_side_view.rs similarity index 97% rename from src/n0199_binary_tree_right_side_view.rs rename to src/solution/s0199_binary_tree_right_side_view.rs index 403a340..c580970 100644 --- a/src/n0199_binary_tree_right_side_view.rs +++ b/src/solution/s0199_binary_tree_right_side_view.rs @@ -18,7 +18,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0200_number_of_islands.rs b/src/solution/s0200_number_of_islands.rs similarity index 100% rename from src/n0200_number_of_islands.rs rename to src/solution/s0200_number_of_islands.rs diff --git a/src/n0201_bitwise_and_of_numbers_range.rs b/src/solution/s0201_bitwise_and_of_numbers_range.rs similarity index 100% rename from src/n0201_bitwise_and_of_numbers_range.rs rename to src/solution/s0201_bitwise_and_of_numbers_range.rs diff --git a/src/n0202_happy_number.rs b/src/solution/s0202_happy_number.rs similarity index 100% rename from src/n0202_happy_number.rs rename to src/solution/s0202_happy_number.rs diff --git a/src/n0203_remove_linked_list_elements.rs b/src/solution/s0203_remove_linked_list_elements.rs similarity index 95% rename from src/n0203_remove_linked_list_elements.rs rename to src/solution/s0203_remove_linked_list_elements.rs index 290923d..f8d9bc4 100644 --- a/src/n0203_remove_linked_list_elements.rs +++ b/src/solution/s0203_remove_linked_list_elements.rs @@ -12,7 +12,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0204_count_primes.rs b/src/solution/s0204_count_primes.rs similarity index 100% rename from src/n0204_count_primes.rs rename to src/solution/s0204_count_primes.rs diff --git a/src/n0205_isomorphic_strings.rs b/src/solution/s0205_isomorphic_strings.rs similarity index 100% rename from src/n0205_isomorphic_strings.rs rename to src/solution/s0205_isomorphic_strings.rs diff --git a/src/n0206_reverse_linked_list.rs b/src/solution/s0206_reverse_linked_list.rs similarity index 94% rename from src/n0206_reverse_linked_list.rs rename to src/solution/s0206_reverse_linked_list.rs index bdbe34e..4689f41 100644 --- a/src/n0206_reverse_linked_list.rs +++ b/src/solution/s0206_reverse_linked_list.rs @@ -16,7 +16,7 @@ * */ pub struct Solution {} -use super::util::linked_list::{to_list, ListNode}; +use crate::util::linked_list::{to_list, ListNode}; // submission codes start here diff --git a/src/n0207_course_schedule.rs b/src/solution/s0207_course_schedule.rs similarity index 100% rename from src/n0207_course_schedule.rs rename to src/solution/s0207_course_schedule.rs diff --git a/src/n0208_implement_trie_prefix_tree.rs b/src/solution/s0208_implement_trie_prefix_tree.rs similarity index 100% rename from src/n0208_implement_trie_prefix_tree.rs rename to src/solution/s0208_implement_trie_prefix_tree.rs diff --git a/src/n0209_minimum_size_subarray_sum.rs b/src/solution/s0209_minimum_size_subarray_sum.rs similarity index 100% rename from src/n0209_minimum_size_subarray_sum.rs rename to src/solution/s0209_minimum_size_subarray_sum.rs diff --git a/src/n0210_course_schedule_ii.rs b/src/solution/s0210_course_schedule_ii.rs similarity index 100% rename from src/n0210_course_schedule_ii.rs rename to src/solution/s0210_course_schedule_ii.rs diff --git a/src/n0211_add_and_search_word_data_structure_design.rs b/src/solution/s0211_add_and_search_word_data_structure_design.rs similarity index 100% rename from src/n0211_add_and_search_word_data_structure_design.rs rename to src/solution/s0211_add_and_search_word_data_structure_design.rs diff --git a/src/n0212_word_search_ii.rs b/src/solution/s0212_word_search_ii.rs similarity index 100% rename from src/n0212_word_search_ii.rs rename to src/solution/s0212_word_search_ii.rs diff --git a/src/n0213_house_robber_ii.rs b/src/solution/s0213_house_robber_ii.rs similarity index 100% rename from src/n0213_house_robber_ii.rs rename to src/solution/s0213_house_robber_ii.rs diff --git a/src/n0214_shortest_palindrome.rs b/src/solution/s0214_shortest_palindrome.rs similarity index 100% rename from src/n0214_shortest_palindrome.rs rename to src/solution/s0214_shortest_palindrome.rs diff --git a/src/n0215_kth_largest_element_in_an_array.rs b/src/solution/s0215_kth_largest_element_in_an_array.rs similarity index 100% rename from src/n0215_kth_largest_element_in_an_array.rs rename to src/solution/s0215_kth_largest_element_in_an_array.rs diff --git a/src/n0216_combination_sum_iii.rs b/src/solution/s0216_combination_sum_iii.rs similarity index 100% rename from src/n0216_combination_sum_iii.rs rename to src/solution/s0216_combination_sum_iii.rs diff --git a/src/n0217_contains_duplicate.rs b/src/solution/s0217_contains_duplicate.rs similarity index 100% rename from src/n0217_contains_duplicate.rs rename to src/solution/s0217_contains_duplicate.rs diff --git a/src/n0218_the_skyline_problem.rs b/src/solution/s0218_the_skyline_problem.rs similarity index 100% rename from src/n0218_the_skyline_problem.rs rename to src/solution/s0218_the_skyline_problem.rs diff --git a/src/n0219_contains_duplicate_ii.rs b/src/solution/s0219_contains_duplicate_ii.rs similarity index 100% rename from src/n0219_contains_duplicate_ii.rs rename to src/solution/s0219_contains_duplicate_ii.rs diff --git a/src/n0220_contains_duplicate_iii.rs b/src/solution/s0220_contains_duplicate_iii.rs similarity index 100% rename from src/n0220_contains_duplicate_iii.rs rename to src/solution/s0220_contains_duplicate_iii.rs diff --git a/src/n0221_maximal_square.rs b/src/solution/s0221_maximal_square.rs similarity index 100% rename from src/n0221_maximal_square.rs rename to src/solution/s0221_maximal_square.rs diff --git a/src/n0222_count_complete_tree_nodes.rs b/src/solution/s0222_count_complete_tree_nodes.rs similarity index 98% rename from src/n0222_count_complete_tree_nodes.rs rename to src/solution/s0222_count_complete_tree_nodes.rs index c511399..189fb3d 100644 --- a/src/n0222_count_complete_tree_nodes.rs +++ b/src/solution/s0222_count_complete_tree_nodes.rs @@ -22,7 +22,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0223_rectangle_area.rs b/src/solution/s0223_rectangle_area.rs similarity index 100% rename from src/n0223_rectangle_area.rs rename to src/solution/s0223_rectangle_area.rs diff --git a/src/n0224_basic_calculator.rs b/src/solution/s0224_basic_calculator.rs similarity index 100% rename from src/n0224_basic_calculator.rs rename to src/solution/s0224_basic_calculator.rs diff --git a/src/n0225_implement_stack_using_queues.rs b/src/solution/s0225_implement_stack_using_queues.rs similarity index 100% rename from src/n0225_implement_stack_using_queues.rs rename to src/solution/s0225_implement_stack_using_queues.rs diff --git a/src/n0226_invert_binary_tree.rs b/src/solution/s0226_invert_binary_tree.rs similarity index 97% rename from src/n0226_invert_binary_tree.rs rename to src/solution/s0226_invert_binary_tree.rs index 29e2a95..30bd001 100644 --- a/src/n0226_invert_binary_tree.rs +++ b/src/solution/s0226_invert_binary_tree.rs @@ -30,7 +30,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0227_basic_calculator_ii.rs b/src/solution/s0227_basic_calculator_ii.rs similarity index 100% rename from src/n0227_basic_calculator_ii.rs rename to src/solution/s0227_basic_calculator_ii.rs diff --git a/src/n0228_summary_ranges.rs b/src/solution/s0228_summary_ranges.rs similarity index 100% rename from src/n0228_summary_ranges.rs rename to src/solution/s0228_summary_ranges.rs diff --git a/src/n0229_majority_element_ii.rs b/src/solution/s0229_majority_element_ii.rs similarity index 100% rename from src/n0229_majority_element_ii.rs rename to src/solution/s0229_majority_element_ii.rs diff --git a/src/n0230_kth_smallest_element_in_a_bst.rs b/src/solution/s0230_kth_smallest_element_in_a_bst.rs similarity index 97% rename from src/n0230_kth_smallest_element_in_a_bst.rs rename to src/solution/s0230_kth_smallest_element_in_a_bst.rs index 65de448..fe14721 100644 --- a/src/n0230_kth_smallest_element_in_a_bst.rs +++ b/src/solution/s0230_kth_smallest_element_in_a_bst.rs @@ -36,7 +36,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0231_power_of_two.rs b/src/solution/s0231_power_of_two.rs similarity index 100% rename from src/n0231_power_of_two.rs rename to src/solution/s0231_power_of_two.rs diff --git a/src/n0232_implement_queue_using_stacks.rs b/src/solution/s0232_implement_queue_using_stacks.rs similarity index 100% rename from src/n0232_implement_queue_using_stacks.rs rename to src/solution/s0232_implement_queue_using_stacks.rs diff --git a/src/n0233_number_of_digit_one.rs b/src/solution/s0233_number_of_digit_one.rs similarity index 100% rename from src/n0233_number_of_digit_one.rs rename to src/solution/s0233_number_of_digit_one.rs diff --git a/src/n0238_product_of_array_except_self.rs b/src/solution/s0238_product_of_array_except_self.rs similarity index 100% rename from src/n0238_product_of_array_except_self.rs rename to src/solution/s0238_product_of_array_except_self.rs diff --git a/src/n0239_sliding_window_maximum.rs b/src/solution/s0239_sliding_window_maximum.rs similarity index 100% rename from src/n0239_sliding_window_maximum.rs rename to src/solution/s0239_sliding_window_maximum.rs diff --git a/src/n0241_different_ways_to_add_parentheses.rs b/src/solution/s0241_different_ways_to_add_parentheses.rs similarity index 100% rename from src/n0241_different_ways_to_add_parentheses.rs rename to src/solution/s0241_different_ways_to_add_parentheses.rs diff --git a/src/n0242_valid_anagram.rs b/src/solution/s0242_valid_anagram.rs similarity index 100% rename from src/n0242_valid_anagram.rs rename to src/solution/s0242_valid_anagram.rs diff --git a/src/n0257_binary_tree_paths.rs b/src/solution/s0257_binary_tree_paths.rs similarity index 97% rename from src/n0257_binary_tree_paths.rs rename to src/solution/s0257_binary_tree_paths.rs index ef5254c..c5d6d33 100644 --- a/src/n0257_binary_tree_paths.rs +++ b/src/solution/s0257_binary_tree_paths.rs @@ -22,7 +22,7 @@ * */ pub struct Solution {} -use super::util::tree::{to_tree, TreeNode}; +use crate::util::tree::{to_tree, TreeNode}; // submission codes start here diff --git a/src/n0258_add_digits.rs b/src/solution/s0258_add_digits.rs similarity index 100% rename from src/n0258_add_digits.rs rename to src/solution/s0258_add_digits.rs diff --git a/src/n0260_single_number_iii.rs b/src/solution/s0260_single_number_iii.rs similarity index 100% rename from src/n0260_single_number_iii.rs rename to src/solution/s0260_single_number_iii.rs diff --git a/src/n0263_ugly_number.rs b/src/solution/s0263_ugly_number.rs similarity index 100% rename from src/n0263_ugly_number.rs rename to src/solution/s0263_ugly_number.rs diff --git a/src/n0264_ugly_number_ii.rs b/src/solution/s0264_ugly_number_ii.rs similarity index 100% rename from src/n0264_ugly_number_ii.rs rename to src/solution/s0264_ugly_number_ii.rs diff --git a/src/n0268_missing_number.rs b/src/solution/s0268_missing_number.rs similarity index 100% rename from src/n0268_missing_number.rs rename to src/solution/s0268_missing_number.rs diff --git a/src/n0273_integer_to_english_words.rs b/src/solution/s0273_integer_to_english_words.rs similarity index 100% rename from src/n0273_integer_to_english_words.rs rename to src/solution/s0273_integer_to_english_words.rs diff --git a/src/n0274_h_index.rs b/src/solution/s0274_h_index.rs similarity index 100% rename from src/n0274_h_index.rs rename to src/solution/s0274_h_index.rs diff --git a/src/n0275_h_index_ii.rs b/src/solution/s0275_h_index_ii.rs similarity index 100% rename from src/n0275_h_index_ii.rs rename to src/solution/s0275_h_index_ii.rs diff --git a/src/n0279_perfect_squares.rs b/src/solution/s0279_perfect_squares.rs similarity index 100% rename from src/n0279_perfect_squares.rs rename to src/solution/s0279_perfect_squares.rs diff --git a/src/n0282_expression_add_operators.rs b/src/solution/s0282_expression_add_operators.rs similarity index 100% rename from src/n0282_expression_add_operators.rs rename to src/solution/s0282_expression_add_operators.rs diff --git a/src/n0283_move_zeroes.rs b/src/solution/s0283_move_zeroes.rs similarity index 100% rename from src/n0283_move_zeroes.rs rename to src/solution/s0283_move_zeroes.rs diff --git a/src/n0287_find_the_duplicate_number.rs b/src/solution/s0287_find_the_duplicate_number.rs similarity index 100% rename from src/n0287_find_the_duplicate_number.rs rename to src/solution/s0287_find_the_duplicate_number.rs diff --git a/src/n0289_game_of_life.rs b/src/solution/s0289_game_of_life.rs similarity index 100% rename from src/n0289_game_of_life.rs rename to src/solution/s0289_game_of_life.rs diff --git a/src/n0290_word_pattern.rs b/src/solution/s0290_word_pattern.rs similarity index 100% rename from src/n0290_word_pattern.rs rename to src/solution/s0290_word_pattern.rs diff --git a/src/n0292_nim_game.rs b/src/solution/s0292_nim_game.rs similarity index 100% rename from src/n0292_nim_game.rs rename to src/solution/s0292_nim_game.rs diff --git a/src/n0295_find_median_from_data_stream.rs b/src/solution/s0295_find_median_from_data_stream.rs similarity index 100% rename from src/n0295_find_median_from_data_stream.rs rename to src/solution/s0295_find_median_from_data_stream.rs diff --git a/src/n0299_bulls_and_cows.rs b/src/solution/s0299_bulls_and_cows.rs similarity index 100% rename from src/n0299_bulls_and_cows.rs rename to src/solution/s0299_bulls_and_cows.rs diff --git a/src/n0300_longest_increasing_subsequence.rs b/src/solution/s0300_longest_increasing_subsequence.rs similarity index 100% rename from src/n0300_longest_increasing_subsequence.rs rename to src/solution/s0300_longest_increasing_subsequence.rs diff --git a/src/n0301_remove_invalid_parentheses.rs b/src/solution/s0301_remove_invalid_parentheses.rs similarity index 100% rename from src/n0301_remove_invalid_parentheses.rs rename to src/solution/s0301_remove_invalid_parentheses.rs diff --git a/src/n0303_range_sum_query_immutable.rs b/src/solution/s0303_range_sum_query_immutable.rs similarity index 100% rename from src/n0303_range_sum_query_immutable.rs rename to src/solution/s0303_range_sum_query_immutable.rs diff --git a/src/n0304_range_sum_query_2d_immutable.rs b/src/solution/s0304_range_sum_query_2d_immutable.rs similarity index 100% rename from src/n0304_range_sum_query_2d_immutable.rs rename to src/solution/s0304_range_sum_query_2d_immutable.rs diff --git a/src/n0306_additive_number.rs b/src/solution/s0306_additive_number.rs similarity index 100% rename from src/n0306_additive_number.rs rename to src/solution/s0306_additive_number.rs diff --git a/src/n0307_range_sum_query_mutable.rs b/src/solution/s0307_range_sum_query_mutable.rs similarity index 100% rename from src/n0307_range_sum_query_mutable.rs rename to src/solution/s0307_range_sum_query_mutable.rs diff --git a/src/n0309_best_time_to_buy_and_sell_stock_with_cooldown.rs b/src/solution/s0309_best_time_to_buy_and_sell_stock_with_cooldown.rs similarity index 100% rename from src/n0309_best_time_to_buy_and_sell_stock_with_cooldown.rs rename to src/solution/s0309_best_time_to_buy_and_sell_stock_with_cooldown.rs diff --git a/src/n0310_minimum_height_trees.rs b/src/solution/s0310_minimum_height_trees.rs similarity index 100% rename from src/n0310_minimum_height_trees.rs rename to src/solution/s0310_minimum_height_trees.rs diff --git a/src/n0312_burst_balloons.rs b/src/solution/s0312_burst_balloons.rs similarity index 100% rename from src/n0312_burst_balloons.rs rename to src/solution/s0312_burst_balloons.rs diff --git a/src/n0313_super_ugly_number.rs b/src/solution/s0313_super_ugly_number.rs similarity index 100% rename from src/n0313_super_ugly_number.rs rename to src/solution/s0313_super_ugly_number.rs diff --git a/src/n0509_fibonacci_number.rs b/src/solution/s0509_fibonacci_number.rs similarity index 100% rename from src/n0509_fibonacci_number.rs rename to src/solution/s0509_fibonacci_number.rs diff --git a/src/n0704_binary_search.rs b/src/solution/s0704_binary_search.rs similarity index 100% rename from src/n0704_binary_search.rs rename to src/solution/s0704_binary_search.rs diff --git a/src/n0969_pancake_sorting.rs b/src/solution/s0969_pancake_sorting.rs similarity index 100% rename from src/n0969_pancake_sorting.rs rename to src/solution/s0969_pancake_sorting.rs diff --git a/src/n1018_binary_prefix_divisible_by_5.rs b/src/solution/s1018_binary_prefix_divisible_by_5.rs similarity index 100% rename from src/n1018_binary_prefix_divisible_by_5.rs rename to src/solution/s1018_binary_prefix_divisible_by_5.rs diff --git a/src/n1046_last_stone_weight.rs b/src/solution/s1046_last_stone_weight.rs similarity index 100% rename from src/n1046_last_stone_weight.rs rename to src/solution/s1046_last_stone_weight.rs