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

6th May 2020, 3:48 AM
Aditya Singh
Aditya Singh - avatar
6 Answers
+ 1
I understand the question but simply can't put the logic into code. If u can do it, then thanks in advance.
7th May 2020, 5:36 PM
Aditya Singh
Aditya Singh - avatar
+ 1
let me see your code or pseudocode then i can help you
7th May 2020, 5:37 PM
Monkey D. Luffy
Monkey D. Luffy - avatar
7th May 2020, 5:52 PM
Monkey D. Luffy
Monkey D. Luffy - avatar
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
7th May 2020, 5:32 PM
Monkey D. Luffy
Monkey D. Luffy - avatar
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.
7th May 2020, 5:49 PM
Aditya Singh
Aditya Singh - avatar
0
Okay thanks man
7th May 2020, 5:52 PM
Aditya Singh
Aditya Singh - avatar