0
Please explain this?
Given a string,return the count of the number of times that a substring length 2 appears in the string and also as the 2 chars of the string, so "hixxxhi" yields 1 (we wont count the end substring). last2('hixxhi')-->1 last2('xaxxaxaxx')--> 1 last2('axxxaaxx')-->2
6 ответов
+ 1
I understand the question but simply can't put the logic into code. If u can do it, then thanks in advance.
+ 1
let me see your code or pseudocode
then i can help you
0
You have to check how many times any substring consisting 2 characters (letters) occurs in a given string ....
******
You wont count the substring that is in the end of string
*******
for example
given_str = ab*****"ab****
Here "ab" is a substring that occurs two times in this given string
0
I got the answer now it's just I haven't noticed before that any substring arises in the string must be equal to the last two characters as given in the question but now I got it , btw thanks for the help.
0
Okay thanks man