non-trivial means the substring's excluding $\varepsilon$ and the string itself.

The Gateway to Computer Science Excellence

0 votes

Consider the string “GATE2000”, the number of non-trivial substrings of given string are

i am constatly confused in these types of substrings questions please specify some resource or plzz derive how to solve these questions

i am constatly confused in these types of substrings questions please specify some resource or plzz derive how to solve these questions

+5

count the number of substrings it would be 8*9/2 = 36

000 -- three 1 length substrings 0,0,0 which are same, two 2 length substrings 00, 00 are same

1 for the original string

36 - (1+2+1) = 32

000 -- three 1 length substrings 0,0,0 which are same, two 2 length substrings 00, 00 are same

1 for the original string

36 - (1+2+1) = 32

+1

answer should be 32 only there are 3 0's so substring '0','0','00' should be excluded from 35.

@Deepanshu, there are 8 char. in string so total substring should be -

n(n+1)/2 + 1= 8.9/2 +1 =37

2 are trivial and there are 3 0's so number of total non trivial substring = 37-2-3=**32**.

+1

specify the link in your question.

i edited my answer with your requirement, may you check https://gateoverflow.in/216914/

52,223 questions

59,811 answers

201,020 comments

118,086 users