File tree Expand file tree Collapse file tree 4 files changed +10
-10
lines changed 
src/main/kotlin/g3301_3400 
s3386_button_with_longest_push_time 
s3387_maximize_amount_after_two_days_of_conversions 
s3388_count_beautiful_splits_in_an_array 
s3389_minimum_operations_to_make_character_frequencies_equal Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 11package  g3301_3400.s3386_button_with_longest_push_time 
22
3- //  #Easy #2024_12_15_Time_0_ms_ (100.00%)_Space_44 .6_MB_(100.00%)
3+ //  #Easy #2024_12_15_Time_1_ms_ (100.00%)_Space_40 .6_MB_(100.00%)
44
55import  kotlin.math.min 
66
@@ -15,7 +15,7 @@ class Solution {
1515                time =  diff
1616                ans =  event[0 ]
1717            } else  if  (diff ==  time) {
18-                 ans =  min(ans.toDouble() , event[0 ].toDouble()).toInt( )
18+                 ans =  min(ans, event[0 ])
1919            }
2020            last =  event[1 ]
2121        }
Original file line number Diff line number Diff line change 11package  g3301_3400.s3387_maximize_amount_after_two_days_of_conversions 
22
3- //  #Medium #2024_12_15_Time_7_ms_ (100.00%)_Space_46.6_MB_ (100.00%)
3+ //  #Medium #2024_12_15_Time_13_ms_ (100.00%)_Space_43.7_MB_ (100.00%)
44
55import  kotlin.math.max 
66
Original file line number Diff line number Diff line change 11package  g3301_3400.s3388_count_beautiful_splits_in_an_array 
22
3- //  #Medium #2024_12_15_Time_165_ms_ (100.00%)_Space_266.1_MB_ (100.00%)
3+ //  #Medium #2024_12_15_Time_162_ms_ (100.00%)_Space_235.2_MB_ (100.00%)
44
55import  kotlin.math.min 
66
77class  Solution  {
88    fun  beautifulSplits (nums :  IntArray ): Int  {
99        val  n =  nums.size
10-         val  lcp =  Array <IntArray ? >(n +  1 ) { IntArray (n +  1 ) }
10+         val  lcp =  Array <IntArray >(n +  1 ) { IntArray (n +  1 ) }
1111        for  (i in  n -  1  downTo 0 ) {
1212            for  (j in  n -  1  downTo 0 ) {
1313                if  (nums[i] ==  nums[j]) {
14-                     lcp[i]!! [j] =  1  +  lcp[i +  1 ]!! [j +  1 ]
14+                     lcp[i][j] =  1  +  lcp[i +  1 ][j +  1 ]
1515                } else  {
16-                     lcp[i]!! [j] =  0 
16+                     lcp[i][j] =  0 
1717                }
1818            }
1919        }
2020        var  res =  0 
2121        for  (i in  0 .. < n) {
2222            for  (j in  i +  1 .. < n) {
2323                if  (i >  0 ) {
24-                     val  lcp1 =  min(min(lcp[0 ]!! [i], i), (j -  i))
25-                     val  lcp2 =  min(min(lcp[i]!! [j], (j -  i)), (n -  j))
24+                     val  lcp1 =  min(min(lcp[0 ][i], i), (j -  i))
25+                     val  lcp2 =  min(min(lcp[i][j], (j -  i)), (n -  j))
2626                    if  (lcp1 >=  i ||  lcp2 >=  j -  i) {
2727                        ++ res
2828                    }
Original file line number Diff line number Diff line change 11package  g3301_3400.s3389_minimum_operations_to_make_character_frequencies_equal 
22
3- //  #Hard #2024_12_15_Time_56_ms_ (100.00%)_Space_44.8_MB_ (100.00%)
3+ //  #Hard #2024_12_15_Time_88_ms_ (100.00%)_Space_40.7_MB_ (100.00%)
44
55import  kotlin.math.max 
66import  kotlin.math.min 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments