Skip to content

Commit f5a85da

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 395a95d commit f5a85da

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

data_structures/strings/allunique.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ def has_unique_chars(s):
66
seen.add(char)
77
return True
88

9+
910
# Example
1011
s = "abcdefga"
1112
print("Unique Characters:", has_unique_chars(s))

data_structures/strings/anagram.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from collections import Counter
22

3+
34
def are_anagrams(s1, s2):
45
return Counter(s1) == Counter(s2)
56

7+
68
# Example
79
print("Anagram:", are_anagrams("listen", "silent"))

data_structures/strings/frequencyofeachchar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ def char_frequency(s):
44
freq[char] = freq.get(char, 0) + 1
55
return freq
66

7+
78
# Example
89
print(char_frequency("datastructure"))

data_structures/strings/reverseword.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ def reverse_words(sentence):
33
stack = []
44
for word in words:
55
stack.append(word)
6-
reversed_sentence = ' '.join(stack[::-1])
6+
reversed_sentence = " ".join(stack[::-1])
77
return reversed_sentence
88

9+
910
# Example
1011
print(reverse_words("Data Structures in Python"))

0 commit comments

Comments
 (0)