QUESTION SESSION: Searching Q. 6: SER7 QUESTION DESCRIPTION Kanna is extremely disappointed to find out that no one in his school knows his first name. Even his classmates call him only by his last name. Frustrated, he decides to make his fellow college students know his first name by forcing them to solve this question. Kanna has given a long string as input in each testcase, containing any ASCII character. Your task is to find out the number of times SUVO and SUVOJIT appears in it. Input Format The first line contains the number of testcases, T. Next, T lines follow each containing a long string S. Output Format For each long string S, display the no. of times SUVO and SUVOJIT appears in it. TEST CASE 1 INPUT 5 SUVOJITSUVOSUVOJITUCSUVOJITSUVOVXSUVOJITSUVOGMSUVODMMVDSUVOJIT AXRSUVOJITHSUVOJITHSUVOJJSUVOJITSUVOJIT SUVOJITPRQSUVOJIT SUVOJITTXGSUVOUNSUVOJIT SUVOJITSUVOSUVOJITXGSUVOSUVOQSUVOJITKDSALASUOUSUVOJITGJEM OUTPUT SUVO = 4, SUVOJIT = 5 SUVO = 1,...
Posts
- Get link
- X
- Other Apps
QUESTION SESSION: Searching Q. 5: SER6 QUESTION DESCRIPTION Kapildev marketting a mobile phone like, if anyone answered this question, the mobile phone will be given for 50% flat offer. The task is to be find three closest elements from given three sorted arrays. So get three input aray from the user and these arrays should be in sorted mannar. Take the three sorted arrays and their sizes as input. Final answer should be the closest element from three arrays. Method name has to be used like void findClosest() TEST CASE 1 INPUT 3 1 4 10 3 2 15 20 2 10 12 OUTPUT 10 15 10 TEST CASE 2 INPUT 3 20 24 100 5 2 19 22 79 800 5 10 12 23 24 119 OUTPUT 24 22 23 answer------ #include<bits/stdc++.h> using namespace std; void findClosest(int A[], int B[], int C[], int p, int q, int r) { int diff = INT_MAX; int res_i =0, res_j = 0, res_k = 0; int i=0,j=0,k=0; while (i < p && j < q &...
- Get link
- X
- Other Apps
QUESTION SESSION: Searching Q. 2: SER2 QUESTION DESCRIPTION Ramu willing to play a game with Manimaran. So he decided to ask three numbers from the given array to make whose sum is zero. For this purpose he created an array with distinct elements. The task is to find three numbers in array whose sum is zero. Take the array as input. TEST CASE 1 INPUT 0 -1 2 -3 1 OUTPUT 0 -1 1 2 -3 1 TEST CASE 2 INPUT 1 -2 1 0 5 OUTPUT 1 -2 1 Answer-------------- #include <stdio.h> int main() { int a[5],i,j,k,p; for(i=0;i<5;i++) {scanf("%d",&a[i]);} for(i=4;i>=0;i--){ for(j=0;j<i;j++){ for(k=0;k<j;k++){ p=a[i]+a[j]+a[k]; if(p==0) { if(i<j&&j<k) {printf("%d %d %d",a[i],a[j],a[k]); printf("\n");} if(j<i&&i<k) { printf("%d %d %d",a[j],a[i],a[k]); printf("\n"); } if(k<i&&i<j) ...