Thanks .
for (int j = (sum / k) * k; j >= k; j -= k) {
this part solved my problem. I have a similar method, but try to traverse from small to big, then got TLE for testcase [1,1000000000]

@benny201 Same here. I think around half of the 2D array is wasted anyway. Instead, I used a HashMap to track the progressive sum starting at each index (and also check if it is divisible by the k).

Nice solution. However, I find the trick with k = INT_MAX dicey. For one, it's hard to understand, and for two, will it work with real case of k == INT_MAX?

If's easy to handle the edge case of k == 0 separately:

if(k == 0)
if(i > 0 and nums[i] == 0 and nums[i-1] == 0)
return true;

@Fantas-LeoTao I think you're right. It should return False instead of True for the input [0,5,7] k=7.
This soultion forgot to check the condition continuous subarray of size at least 2, and the online judge doesn't have cases to check it either.
But the idea of this solution is still very smart :-)