SlideShare a Scribd company logo
1 of 2
Download to read offline
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*));
*
* 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

More Related Content

Similar to Code to Check if Strings are Almost Equivalent

regular-expression.pdf
regular-expression.pdfregular-expression.pdf
regular-expression.pdfDarellMuchoko
 
Handling of character strings C programming
Handling of character strings C programmingHandling of character strings C programming
Handling of character strings C programmingAppili Vamsi Krishna
 
Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)Dharma Kshetri
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfaroraopticals15
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
3.ArraysandPointers.pptx
3.ArraysandPointers.pptx3.ArraysandPointers.pptx
3.ArraysandPointers.pptxFolkAdonis
 
fundamentals of c programming_String.pptx
fundamentals of c programming_String.pptxfundamentals of c programming_String.pptx
fundamentals of c programming_String.pptxJStalinAsstProfessor
 
Java Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptxJava Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptxOmarBinkasimSefat
 

Similar to Code to Check if Strings are Almost Equivalent (20)

Unitii string
Unitii stringUnitii string
Unitii string
 
regular-expression.pdf
regular-expression.pdfregular-expression.pdf
regular-expression.pdf
 
Strings
StringsStrings
Strings
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
Unit ii data structure-converted
Unit  ii data structure-convertedUnit  ii data structure-converted
Unit ii data structure-converted
 
Strings
StringsStrings
Strings
 
Handling of character strings C programming
Handling of character strings C programmingHandling of character strings C programming
Handling of character strings C programming
 
Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)
 
Python data handling
Python data handlingPython data handling
Python data handling
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
14 ruby strings
14 ruby strings14 ruby strings
14 ruby strings
 
Array&amp;string
Array&amp;stringArray&amp;string
Array&amp;string
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
Software Construction Assignment Help
Software Construction Assignment HelpSoftware Construction Assignment Help
Software Construction Assignment Help
 
3.ArraysandPointers.pptx
3.ArraysandPointers.pptx3.ArraysandPointers.pptx
3.ArraysandPointers.pptx
 
fundamentals of c programming_String.pptx
fundamentals of c programming_String.pptxfundamentals of c programming_String.pptx
fundamentals of c programming_String.pptx
 
Java Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptxJava Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptx
 
Arrays
ArraysArrays
Arrays
 
[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++
 

More from sukhvir71

HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfHW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfsukhvir71
 
httpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfhttpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfsukhvir71
 
Human impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfHuman impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfsukhvir71
 
HR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfHR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfsukhvir71
 
Humans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfHumans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfsukhvir71
 
i A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfi A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfsukhvir71
 
HuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfHuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfsukhvir71
 
humans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfhumans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfsukhvir71
 
Hunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfHunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfsukhvir71
 
I need full assignment with every steps Write a program tha.pdf
I need full assignment  with every steps Write a program tha.pdfI need full assignment  with every steps Write a program tha.pdf
I need full assignment with every steps Write a program tha.pdfsukhvir71
 
I need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfI need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfsukhvir71
 
I need an explanation for the wrong and the correct answer .pdf
I need an explanation for the wrong and the correct answer  .pdfI need an explanation for the wrong and the correct answer  .pdf
I need an explanation for the wrong and the correct answer .pdfsukhvir71
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfsukhvir71
 
I need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfI need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfsukhvir71
 
I need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfI need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfsukhvir71
 
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfHxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfsukhvir71
 
I measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfI measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfsukhvir71
 
I need a Full Runnable code and UML Diagram for the followin.pdf
I need a Full Runnable code and UML Diagram for the followin.pdfI need a Full Runnable code and UML Diagram for the followin.pdf
I need a Full Runnable code and UML Diagram for the followin.pdfsukhvir71
 
How would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfHow would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfsukhvir71
 
i Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfi Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfsukhvir71
 

More from sukhvir71 (20)

HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfHW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
 
httpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfhttpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdf
 
Human impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfHuman impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdf
 
HR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfHR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdf
 
Humans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfHumans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdf
 
i A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfi A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdf
 
HuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfHuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdf
 
humans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfhumans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdf
 
Hunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfHunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdf
 
I need full assignment with every steps Write a program tha.pdf
I need full assignment  with every steps Write a program tha.pdfI need full assignment  with every steps Write a program tha.pdf
I need full assignment with every steps Write a program tha.pdf
 
I need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfI need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdf
 
I need an explanation for the wrong and the correct answer .pdf
I need an explanation for the wrong and the correct answer  .pdfI need an explanation for the wrong and the correct answer  .pdf
I need an explanation for the wrong and the correct answer .pdf
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdf
 
I need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfI need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdf
 
I need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfI need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdf
 
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfHxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
 
I measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfI measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdf
 
I need a Full Runnable code and UML Diagram for the followin.pdf
I need a Full Runnable code and UML Diagram for the followin.pdfI need a Full Runnable code and UML Diagram for the followin.pdf
I need a Full Runnable code and UML Diagram for the followin.pdf
 
How would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfHow would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdf
 
i Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfi Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdf
 

Recently uploaded

Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Celine George
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 

Recently uploaded (20)

Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 

Code to Check if Strings are Almost Equivalent

  • 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