gs gs122 Dynamic Programming - Minimum Insertions to form a Palindrome - Quiz No.1
gs gs122 Data Communication and Computer Network Quiz

This quiz belongs to book/course code gs gs122 Data Communication and Computer Network of gs organization. We have 268 quizzes available related to the book/course Data Communication and Computer Network. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Dynamic Programming. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
#include<stdio.h> #include<string.h> int max(int a, int b) { if(a > b) return a; return b; } int min_ins(char *s) { int len = strlen(s), i, j; int arr[len + 1][len + 1]; char rev[len + 1]; strcpy(rev, s); strrev(rev); for(i = 0;i <= len; i++) arr[i][0] = 0; for(i = 0; i <= len; i++) arr[0][i] = 0; for(i = 1; i <= len; i++) { for(j = 1; j <= len; j++) { if(s[i - 1] == rev[j - 1]) arr[i][j] = arr[i - 1][j - 1] + 1; else arr[i][j] = max(arr[i - 1][j], arr[i][j - 1]); } } return _____________; } int main() { char s[] = "abcda"; int ans = min_ins(s); printf("%d",ans); return 0; }
Which of the following lines should be added to complete the code?
Online Quizzes of gs122 Data Communication and Computer Network





