hi, can someone please tell me the approach i should take to find the distinct substrings of a string ?
pranay_agg
0
Newbie Poster
Recommended Answers
Jump to PostThe question is too vague. Give us an example of a string and the appropriate substrings for that string.
Jump to PostDo you mean std::string? Yes, then use its find() method. If you mean character array then use standrd C function strstr() which is declared in string.h (or cstring for c++ programs)
Of course you may not be allowed to use either of those if your instructor wants you to …
Jump to Poste.g 1
string s = "ccccc"
then ans = 1
e.g 2
s = "abc"
ans = 7Not sure what you mean. 2 and 7 aren't substrings and they aren't the number of distinct substrings either. I can make more than two substrings from "ccccc". ("c", "cc", "ccc", "cccc"). …
All 12 Replies
VernonDozier
2,218
Posting Expert
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
pranay_agg
0
Newbie Poster
VernonDozier
2,218
Posting Expert
Featured Poster
pranay_agg
0
Newbie Poster
pranay_agg
0
Newbie Poster
VernonDozier
2,218
Posting Expert
Featured Poster
tetron
22
Junior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
mrnutty
761
Senior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
mrnutty
761
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.