Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include <assert.

h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char* readline();
char* ltrim(char*);
char* rtrim(char*);

int parse_int(char*);

/*
* Complete the 'getMinCost' function below.
*
* The function is expected to return a LONG_INTEGER.
* The function accepts following parameters:
* 1. INTEGER_ARRAY crew_id
* 2. INTEGER_ARRAY job_id
*/

long getMinCost(int crew_id_count, int* crew_id, int job_id_count, int* job_id) {


int i,sum=100,j,a;
for(i=0;i<crew_id_count;i++)
{
for(j=0;job_id_count;j++)
{
a=abs((*crew_id+i)-(*job_id+j));

if(a<sum)
sum=a;
}

}
return sum;
}

int main()

You might also like