Untitled
fn(arr[],left,right) { i = 0; j = 0; int cnt = 0; while(j<n) { if(arr[j]<left) j++; continue; else if(arr[j]>right) { i = j + 1; j++; continue; } cnt += j - i + 1; j++; } return cnt; }
Leave a Comment
fn(arr[],left,right) { i = 0; j = 0; int cnt = 0; while(j<n) { if(arr[j]<left) j++; continue; else if(arr[j]>right) { i = j + 1; j++; continue; } cnt += j - i + 1; j++; } return cnt; }