14,034,673 members
See more:
Given n, which is the number of strings taken as input. For each input use have to print “YES” or “NO” whether the current string is already present or not.

Input:
5
Geeks
Hello
Great
Geeks
Hello
Output:

No
No
No
Yes
Yes

What I have tried:

```bool isSubSequence(char str1[], char str2[], int m, int n)
{
// Base Cases
if (m == 0) return true;
if (n == 0) return false;

// If last characters of two strings are matching
if (str1[m-1] == str2[n-1])
return isSubSequence(str1, str2, m-1, n-1);

// If last characters are not matching
return isSubSequence(str1, str2, m, n-1);
}```
Posted
Updated 6-Sep-18 20:58pm
Patrice T 7-Sep-18 1:53am

And ?
you have a question ?

## Solution 1

think about what your code should do: "Look up every new string whether it is already in my array?"

=> so you need to loop every time through the complete array.
a) use a for loop
b) when found you are done
c) after looping all entry you know that you havent found it.

You can use some C++ tutorial to learn the basics.

Develop your code and pseudo code yourself to learn programming. Use always a verb and objects.

The first can be: "Ask numbers for input"
v2
Member 13602584 7-Sep-18 3:00am

Can you please provide pseudocode, I beginner to programming

## Solution 2

I beginner to programming, can you please provide pseudocode to me
Richard MacCutchan 7-Sep-18 4:47am

You have tagged this C and Java, but which is it?
Richard Deeming 7-Sep-18 10:02am

1) This is not a solution to your problem, and should not have been posted in the "Add your solution here" box.

2) THIS IS NOT A SOLUTION TO YOUR PROBLEM, and should not have been marked as the "accepted" solution.

3) We do not do your homework for you.

Top Experts
Last 24hrsThis month
 OriginalGriff 250 Maciej Los 210 Gerry Schmitz 125 Patrice T 125 CHill60 120
 OriginalGriff 3,339 Dave Kreskowiak 1,160 Maciej Los 1,136 Patrice T 1,073 Gerry Schmitz 1,047