title: How to calculate time complexity for below function?
body: <p>What is the time complexity for the below function?</p>
  
  <pre><code>void function(int n){
          for(int i=0; i&lt;n; i++){. //n times
              for(int j=i ; j&lt; i*i; j++){ // n*n times
                  if(j%i == 0){
                      for(int k=0; k&lt;j; k++){ // j times = n * n times.
                          ++counter;
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>Book says <code>O(n^5)</code>. But I couldn't understand why book didn't take <code>j%i</code> into account. The <code>k</code> loop determines based on that.  Can you clarify?</p>