Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool is_unique_string(const std::string& s)
- {
- std::array<bool, 1 << CHAR_BIT> tbl{};
- for (auto x : s)
- {
- if (tbl[static_cast<unsigned char>(x)])
- return false;
- tbl[ static_cast<unsigned char>(x)] = true;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement