Skip to content

Commit a9ca633

Browse files
authored
Added tasks 2413-2545
1 parent 0717a30 commit a9ca633

File tree

120 files changed

+9644
-141
lines changed
  • src/main/kotlin
    • g0001_0100
    • g2401_2500
      • s2413_smallest_even_multiple
      • s2414_length_of_the_longest_alphabetical_continuous_substring
      • s2415_reverse_odd_levels_of_binary_tree
      • s2416_sum_of_prefix_scores_of_strings
      • s2418_sort_the_people
      • s2419_longest_subarray_with_maximum_bitwise_and
      • s2420_find_all_good_indices
      • s2421_number_of_good_paths
      • s2423_remove_letter_to_equalize_frequency
      • s2424_longest_uploaded_prefix
      • s2425_bitwise_xor_of_all_pairings
      • s2426_number_of_pairs_satisfying_inequality
      • s2427_number_of_common_factors
      • s2428_maximum_sum_of_an_hourglass
      • s2429_minimize_xor
      • s2430_maximum_deletions_on_a_string
      • s2432_the_employee_that_worked_on_the_longest_task
      • s2433_find_the_original_array_of_prefix_xor
      • s2434_using_a_robot_to_print_the_lexicographically_smallest_string
      • s2435_paths_in_matrix_whose_sum_is_divisible_by_k
      • s2437_number_of_valid_clock_times
      • s2438_range_product_queries_of_powers
      • s2439_minimize_maximum_of_array
      • s2440_create_components_with_same_value
      • s2441_largest_positive_integer_that_exists_with_its_negative
      • s2442_count_number_of_distinct_integers_after_reverse_operations
      • s2443_sum_of_number_and_its_reverse
      • s2444_count_subarrays_with_fixed_bounds
      • s2446_determine_if_two_events_have_conflict
      • s2447_number_of_subarrays_with_gcd_equal_to_k
      • s2448_minimum_cost_to_make_array_equal
      • s2449_minimum_number_of_operations_to_make_arrays_similar
      • s2451_odd_string_difference
      • s2452_words_within_two_edits_of_dictionary
      • s2453_destroy_sequential_targets
      • s2454_next_greater_element_iv
      • s2455_average_value_of_even_numbers_that_are_divisible_by_three
      • s2457_minimum_addition_to_make_integer_beautiful
      • s2458_height_of_binary_tree_after_subtree_removal_queries
      • s2460_apply_operations_to_an_array
      • s2461_maximum_sum_of_distinct_subarrays_with_length_k
      • s2462_total_cost_to_hire_k_workers
      • s2463_minimum_total_distance_traveled
      • s2465_number_of_distinct_averages
      • s2466_count_ways_to_build_good_strings
      • s2467_most_profitable_path_in_a_tree
      • s2468_split_message_based_on_limit
      • s2469_convert_the_temperature
      • s2470_number_of_subarrays_with_lcm_equal_to_k
      • s2471_minimum_number_of_operations_to_sort_a_binary_tree_by_level
      • s2472_maximum_number_of_non_overlapping_palindrome_substrings
      • s2475_number_of_unequal_triplets_in_array
      • s2476_closest_nodes_queries_in_a_binary_search_tree
      • s2477_minimum_fuel_cost_to_report_to_the_capital
      • s2478_number_of_beautiful_partitions
      • s2481_minimum_cuts_to_divide_a_circle
      • s2482_difference_between_ones_and_zeros_in_row_and_column
      • s2483_minimum_penalty_for_a_shop
      • s2484_count_palindromic_subsequences
      • s2485_find_the_pivot_integer
      • s2486_append_characters_to_string_to_make_subsequence
      • s2487_remove_nodes_from_linked_list
      • s2488_count_subarrays_with_median_k
      • s2490_circular_sentence
      • s2491_divide_players_into_teams_of_equal_skill
      • s2492_minimum_score_of_a_path_between_two_cities
      • s2493_divide_nodes_into_the_maximum_number_of_groups
      • s2496_maximum_value_of_a_string_in_an_array
      • s2497_maximum_star_sum_of_a_graph
      • s2498_frog_jump_ii
      • s2499_minimum_total_cost_to_make_arrays_unequal
      • s2500_delete_greatest_value_in_each_row
    • g2501_2600
      • s2501_longest_square_streak_in_an_array
      • s2502_design_memory_allocator
      • s2503_maximum_number_of_points_from_grid_queries
      • s2506_count_pairs_of_similar_strings
      • s2507_smallest_value_after_replacing_with_sum_of_prime_factors
      • s2508_add_edges_to_make_degrees_of_all_nodes_even
      • s2509_cycle_length_queries_in_a_tree
      • s2511_maximum_enemy_forts_that_can_be_captured
      • s2512_reward_top_k_students
      • s2513_minimize_the_maximum_of_two_arrays
      • s2514_count_anagrams
      • s2515_shortest_distance_to_target_string_in_a_circular_array
      • s2516_take_k_of_each_character_from_left_and_right
      • s2517_maximum_tastiness_of_candy_basket
      • s2518_number_of_great_partitions
      • s2520_count_the_digits_that_divide_a_number
      • s2521_distinct_prime_factors_of_product_of_array
      • s2522_partition_string_into_substrings_with_values_at_most_k
      • s2523_closest_prime_numbers_in_range
      • s2525_categorize_box_according_to_criteria
      • s2526_find_consecutive_integers_from_a_data_stream
      • s2527_find_xor_beauty_of_array
      • s2528_maximize_the_minimum_powered_city
      • s2529_maximum_count_of_positive_integer_and_negative_integer
      • s2530_maximal_score_after_applying_k_operations
      • s2531_make_number_of_distinct_characters_equal
      • s2532_time_to_cross_a_bridge
      • s2535_difference_between_element_sum_and_digit_sum_of_an_array
      • s2536_increment_submatrices_by_one
      • s2537_count_the_number_of_good_subarrays
      • s2538_difference_between_maximum_and_minimum_price_sum
      • s2540_minimum_common_value
      • s2541_minimum_operations_to_make_array_equal_ii
      • s2542_maximum_subsequence_score
      • s2543_check_if_point_is_reachable
      • s2544_alternating_digit_sum
      • s2545_sort_the_students_by_their_kth_score

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+9644
-141
lines changed

README.md

Lines changed: 234 additions & 124 deletions
Large diffs are not rendered by default.

src/main/kotlin/g0001_0100/s0004_median_of_two_sorted_arrays/readme.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ The overall run time complexity should be `O(log (m+n))`.
5555
## Solution
5656

5757
```kotlin
58-
import kotlin.collections.ArrayList
59-
6058
class Solution {
6159
fun findMedianSortedArrays(nums1: IntArray, nums2: IntArray): Double {
6260
val l: MutableList<Int> = ArrayList()

src/main/kotlin/g0001_0100/s0008_string_to_integer_atoi/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ Since -91283472332 is less than the lower bound of the range [-2<sup>31</sup>, 2
119119

120120
```kotlin
121121
class Solution {
122-
fun myAtoi(str: String?): Int {
123-
if (str.isNullOrEmpty()) {
122+
fun myAtoi(str: String): Int {
123+
if (str.isEmpty()) {
124124
return 0
125125
}
126126
var i = 0

src/main/kotlin/g0001_0100/s0012_integer_to_roman/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Given an integer, convert it to a roman numeral.
6868

6969
```kotlin
7070
class Solution {
71-
fun intToRoman(num: Int): String? {
71+
fun intToRoman(num: Int): String {
7272
var localNum = num
7373
val sb = StringBuilder()
7474
val m = 1000

src/main/kotlin/g0001_0100/s0015_3sum/readme.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ Notice that the solution set must not contain duplicate triplets.
3535
## Solution
3636

3737
```kotlin
38-
import kotlin.collections.ArrayList
39-
4038
class Solution {
4139
fun threeSum(nums: IntArray): List<List<Int>> {
4240
nums.sort()

src/main/kotlin/g0001_0100/s0016_3sum_closest/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ You may assume that each input would have exactly one solution.
3535

3636
```kotlin
3737
class Solution {
38-
fun threeSumClosest(nums: IntArray?, target: Int): Int {
39-
if (nums == null || nums.size < 3) {
38+
fun threeSumClosest(nums: IntArray, target: Int): Int {
39+
if (nums.size < 3) {
4040
return 0
4141
}
4242
if (nums.size == 3) {

src/main/kotlin/g0001_0100/s0025_reverse_nodes_in_k_group/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ You may not alter the values in the list's nodes, only nodes themselves may be c
5151
## Solution
5252

5353
```kotlin
54+
9
5455
import com_github_leetcode.ListNode
5556

5657
/*
File renamed without changes.

src/main/kotlin/g0001_0100/s0031_next_permutation/readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class Solution {
5454
while (j >= i + 1 && nums[i] >= nums[j]) { j-- }
5555
nums[i] = nums[j].also { nums[j] = nums[i] }
5656
}
57-
var l = i + 1; var r = nums.size - 1
57+
var l = i + 1
58+
var r = nums.size - 1
5859
while (l < r) {
5960
nums[l] = nums[r].also { nums[r] = nums[l] }
6061
l++

src/main/kotlin/g0001_0100/s0044_wildcard_matching/readme.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ The matching should cover the **entire** input string (not partial).
4646

4747
```kotlin
4848
class Solution {
49-
fun isMatch(inputString: String, pattern: String): Boolean {
49+
fun isMatch(s: String, p: String): Boolean {
5050
var i = 0
5151
var j = 0
5252
var starIdx = -1
5353
var lastMatch = -1
54-
while (i < inputString.length) {
55-
if (j < pattern.length &&
56-
(inputString[i] == pattern[j] || pattern[j] == '?')
54+
while (i < s.length) {
55+
if (j < p.length &&
56+
(s[i] == p[j] || p[j] == '?')
5757
) {
5858
i++
5959
j++
60-
} else if (j < pattern.length && pattern[j] == '*') {
60+
} else if (j < p.length && p[j] == '*') {
6161
starIdx = j
6262
lastMatch = i
6363
j++
@@ -76,10 +76,10 @@ class Solution {
7676
}
7777
}
7878
var isMatch = true
79-
while (j < pattern.length && pattern[j] == '*') {
79+
while (j < p.length && p[j] == '*') {
8080
j++
8181
}
82-
if (i != inputString.length || j != pattern.length) {
82+
if (i != s.length || j != p.length) {
8383
isMatch = false
8484
}
8585
return isMatch

0 commit comments

Comments
 (0)