GATE Exam  >  GATE Questions  >   The number of substrings (both trivial and n... Start Learning for Free
The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters is
  • a)
  • b)
  • c)
  • d)
Correct answer is option 'D'. Can you explain this answer?
Verified Answer
The number of substrings (both trivial and nontrivial included) for a...
This is how we derive the number of substrings in a string of n characters. Substrings containing 0 letters = 1(ϵ)
1 letters = n
2 letters = n − 1
3 letters = n − 2
(n − 1) letters = 2
n letters =1
Add then up, 1 + (n + m − 1 + n − 2 +…….+ 3 + 2 + 1)
=1 + [n(n + 1)2]
Hence (d) is the most appropriate choice.
View all questions of this test
Explore Courses for GATE exam

Similar GATE Doubts

The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer?
Question Description
The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared according to the GATE exam syllabus. Information about The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer?.
Solutions for The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE. Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer?, a detailed solution for The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer? has been provided alongside types of The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice The number of substrings (both trivial and nontrivial included) for a string containing n distinct characters isa)b)c)d)Correct answer is option 'D'. Can you explain this answer? tests, examples and also practice GATE tests.
Explore Courses for GATE exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev