We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/*
* Complete the 'extremumPermutations' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER n
* 2. INTEGER_ARRAY a
* 3. INTEGER_ARRAY b
*/
int extremumPermutations(int n, int a_count, int* a, int b_count, int* b) {
}
int main()
{
FILE* fptr = fopen(getenv("OUTPUT_PATH"), "w");
char** first_multiple_input = split_string(rtrim(readline()));
int n = parse_int(*(first_multiple_input + 0));
int k = parse_int(*(first_multiple_input + 1));
int l = parse_int(*(first_multiple_input + 2));
char** a_temp = split_string(rtrim(readline()));
int* a = malloc(k * sizeof(int));
for (int i = 0; i < k; i++) {
int a_item = parse_int(*(a_temp + i));
*(a + i) = a_item;
}
char** b_temp = split_string(rtrim(readline()));
int* b = malloc(l * sizeof(int));
for (int i = 0; i < l; i++) {
int b_item = parse_int(*(b_temp + i));
*(b + i) = b_item;
}
int result = extremumPermutations(n, k, a, l, b);
fprintf(fptr, "%d\n", result);
fclose(fptr);
return 0;
Extremum Permutations
You are viewing a single comment's thread. Return to all comments →
include
include
include
include
include
include
include
include
include
include
char* readline(); char* ltrim(char*); char* rtrim(char*); char** split_string(char*);
int parse_int(char*);
/* * Complete the 'extremumPermutations' function below. * * The function is expected to return an INTEGER. * The function accepts following parameters: * 1. INTEGER n * 2. INTEGER_ARRAY a * 3. INTEGER_ARRAY b */
int extremumPermutations(int n, int a_count, int* a, int b_count, int* b) {
}
int main() { FILE* fptr = fopen(getenv("OUTPUT_PATH"), "w");
}
char* readline() { size_t alloc_length = 1024; size_t data_length = 0;
}
char* ltrim(char* str) { if (!str) { return '\0'; }
}
char* rtrim(char* str) { if (!str) { return '\0'; }
}
char** split_string(char* str) { char** splits = NULL; char* token = strtok(str, " ");
}
int parse_int(char* str) { char* endptr; int value = strtol(str, &endptr, 10);
}