The document provides instructions for completing a function called areAlmostEquivalent that takes in two string arrays, s and t, and returns an array indicating whether each corresponding string pair in s and t are almost equivalent. Two strings are almost equivalent if they have the same length and for each lowercase letter, the difference in occurrences between the two strings is less than or equal to 3. The function must return an array the same length as s and t with either "YES" or "NO" for each pair.
1. I need code to solve following comments
#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 'areAlmostEquivalent' function below.
*
* The function is expected to return a STRING_ARRAY.
* The function accepts following parameters:
* 1. STRING_ARRAY s
* 2. STRING_ARRAY t
*/
/*
* To return the string array from the function, you should:
* - Store the size of the array to be returned in the result_count variable
* - Allocate the array statically or dynamically
*
* For example,
* char** return_string_array_using_static_allocation(int* result_count) {
* *result_count = 5;
*
* static char* a[5] = {"static", "allocation", "of", "string", "array"};
*
* return a;
* }
*
* char** return_string_array_using_dynamic_allocation(int* result_count) {
* *result_count = 5;
*
* char** a = malloc(5 * sizeof(char*));
2. *
* for (int i = 0; i < 5; i++) {
* *(a + i) = malloc(20 * sizeof(char));
* }
*
* *(a + 0) = "dynamic";
* *(a + 1) = "allocation";
* *(a + 2) = "of";
* *(a + 3) = "string";
* *(a + 4) = "array";
*
* return a;
* }
*
*/
char** areAlmostEquivalent(int s_count, char** s, int t_count, char** t, int* result_count) {
}
1. Almost Equivalent Strings Two strings are considered "almost equivalent" if they have the same
length AND for each lowercase letter x, the number of occurrences of x in the two strings differs by
no more than 3. There are two arrays of n strings, arrays s and t. Strings s[i] and t[i] make the t th
pair. They are of equal length and consist of lowercase English letters. For each pair of strings,
determine if they are almost equivalent. Return an array of i strings, either 'YES' or 'NO', one for
each pair. Example s=[[aabaab,aaaaabb]t=[bbabbc,abb] The number of occurrences of ' a ', ' b ',
and ' c ' in (s[0],t[0]) never differs by more than 3 . This pair is almost equivalent. In (s[1], t[1]),a '
violates the condition. The return array is ['YES', 'NO']. Function DescriptionThe number of
occurrences of ' a ', ' b ', and ' c ' in (s[0],t[0]) never differs by more than 3 . This pair is almost
equivalent. In (s[1], [[1]), 'a' violates the condition. The return array is ['YES', 'NO']. Function
Description Complete the function areAlmostEquivalent in the editor below. areAlmostEquivalent
has the following parameters: string s[n] : an array of strings string t[n] : an array of strings
Returns: string[n]: an array of strings, either 'YES' or 'NO' in answer to each test case Constraints -
1n5 - 1 length of any string in the input 105