File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed 
src/main/kotlin/g3401_3500/s3441_minimum_cost_good_caption Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,11 @@ class Solution {
1313            return  " " 
1414        }
1515        val  arr =  caption.toCharArray()
16-         val  prefixCost =  Array <IntArray ? >(n +  1 ) { IntArray (26 ) }
16+         val  prefixCost =  Array <IntArray >(n +  1 ) { IntArray (26 ) }
1717        for  (i in  0 .. < n) {
1818            val  orig =  arr[i].code -  ' a' 
1919            for  (c in  0 .. 25 ) {
20-                 prefixCost[i +  1 ]!! [c] =  prefixCost[i]!! [c] +  abs((orig -  c))
20+                 prefixCost[i +  1 ][c] =  prefixCost[i][c] +  abs((orig -  c))
2121            }
2222        }
2323        val  dp =  IntArray (n +  1 )
@@ -37,7 +37,7 @@ class Solution {
3737                    var  bestLetter =  0 
3838                    var  bestCost:  Int  =  INF 
3939                    for  (c in  0 .. 25 ) {
40-                         val  costBlock =  prefixCost[i +  l]!! [c] -  prefixCost[i]!! [c]
40+                         val  costBlock =  prefixCost[i +  l][c] -  prefixCost[i][c]
4141                        if  (costBlock <  bestCost) {
4242                            bestCost =  costBlock
4343                            bestLetter =  c
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments