You are viewing a single comment's thread. Return to all comments →
C++ code solution
int squares(int a, int b) { int count = 0; int sqrta = sqrt(a); int sqrtb = sqrt(b); if (sqrta * sqrta - a == 0){ for (int i = sqrta; i <= sqrtb; i++){ count++; } } else { for (int i = sqrta + 1; i <= sqrtb; i++){ count++; } } return count; }
Sherlock and Squares
You are viewing a single comment's thread. Return to all comments →
C++ code solution