Skip to content

Commit

Permalink
Create 001. Number of substrings of a string.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirPaulb committed Dec 8, 2022
1 parent 37f28ea commit cbd9ca8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 16_String/001. Number of substrings of a string.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://www.geeksforgeeks.org/number-substrings-string/


# Python3 program to count number
# of substrings of a string

def countNonEmptySubstr(str):
n = len(str)
return int(n * (n + 1) / 2)

s = "abcde"
print (countNonEmptySubstr(s))

0 comments on commit cbd9ca8

Please sign in to comment.