Skip to content

Commit a18cde4

Browse files
authored
Create Isograms - 7 kyu.cpp
1 parent 7bb3fdf commit a18cde4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

c++/Isograms - 7 kyu.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <iostream>
2+
#include <string>
3+
#include <vector>
4+
5+
bool is_isogram(std::string string) {
6+
std::string lower_string;
7+
for (char c : string) {
8+
lower_string += std::tolower(c);
9+
}
10+
std::vector<char> chars;
11+
for (char i : lower_string) {
12+
if (std::find(chars.begin(), chars.end(), i) != chars.end()) {
13+
return false;
14+
}
15+
chars.push_back(i);
16+
}
17+
return true;
18+
}

0 commit comments

Comments
 (0)