Ad
  • Custom User Avatar

    You have trailing spaces in your answer

  • Custom User Avatar

    Hey, you're already iterating over a full array. If you can do all your addition and multiplication in the same loop (inside if) you won't have to run reducers again. It will improve your performance atleast twice. :)

  • Custom User Avatar

    The tests don't pass even if I get correct output. Am I missing something?

    ✘ Expected: <pre>    *
       ***
      *****
     *******
    *********
     *******
      *****
       ***
        *
    </pre>instead got :<pre>    *    
       ***   
      *****  
     ******* 
    *********
     ******* 
      *****  
       ***   
        *    
    </pre>
    

    Another one

    ✘ Expected: <pre>         *
            ***
           *****
          *******
         *********
        ***********
       *************
      ***************
     *****************
    *******************
     *****************
      ***************
       *************
        ***********
         *********
          *******
           *****
            ***
             *
    </pre>instead got :<pre>         *         
            ***        
           *****       
          *******      
         *********     
        ***********    
       *************   
      ***************  
     ***************** 
    *******************
     ***************** 
      ***************  
       *************   
        ***********    
         *********     
          *******      
           *****       
            ***        
             *         
    </pre>
    
  • Custom User Avatar

    Hey,

    You don't need to split the string just to use .indexOf on it. i.toString().indexOf() will work just as fine. :)
    So in your solution, inside for loop,

    if(i.toString().indexOf('5') === -1) counter++
    

    or

    if(!i.toString().includes('5')) counter++
    

    will do just fine.