The following Java code exceeds the time limit:

```
public class Solution {
public int trailingZeroes(int n) {
int result = 0;
int k = 5;
while (k <= n) {
result += n / k;
k *= 5;
}
return result;
}
}
```