Consider the following code snippet: [code] int max_sum_rectangle(int arr[][3],int row,int col) { int left, right, tmp[row], mx_sm

Ivanesn

New member
Consider the following code snippet:
Code:
int max_sum_rectangle(int arr[][3],int row,int col)
{
      int left, right, tmp[row], mx_sm = INT_MIN, idx, val;
      for(left = 0; left < col; left++)
      {
           for(right = left; right < col; right++)
           {
               if(right == left)
               {
                   for(idx = 0; idx < row; idx++)
                     tmp[idx] = arr[idx][right];
               }
               else
               {
                   for(idx = 0; idx < row; idx++)
                      tmp[idx] += arr[idx][right];
               }
               val = kadane_algo(tmp,row);
               if(val > mx_sm)
                  ______;
           }
      }
      return mx_sm;
}
Which of the following lines should be inserted to complete the above code?
A. val = mx_sm
B. return val
C. mx_sm = val
D. return mx_sm
 

Tìm kiếm

Back
Top