You are viewing a single comment's thread. Return to all comments →
C: For some reason I get a Runtime Error. Any ideas?
int beautifulTriplets(int d, int arr_count, int* arr) { int counter = 0; for(int i = 0; i < arr_count; i++) { for(int j = i+1; j < arr_count; j++) { int j_i = *(j+arr) - *(i+arr); if(!(j_i == d && i != j)) { continue; } for(int k = j+1; k < arr_count; k++) { if(j != k) { int k_j = *(k+arr) - *(j+arr); printf("j_i: %d; k_j: %d\n",j_i,k_j); if(k_j == d) { printf("Increase Counter\n"); counter++; } } } } } return counter; }
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Triplets
You are viewing a single comment's thread. Return to all comments →
C: For some reason I get a Runtime Error. Any ideas?