diff options
author | terminaldweller <thabogre@gmail.com> | 2022-04-04 16:36:22 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-04-04 16:36:22 +0000 |
commit | 2fe0e87bd53f221b58ff862b1db3ce6f5bd5217c (patch) | |
tree | 2a2335d2ac1a702ecdbe0ebe4e481af50b433e4c /383/main.cpp | |
parent | added 13 (diff) | |
download | leetcode-2fe0e87bd53f221b58ff862b1db3ce6f5bd5217c.tar.gz leetcode-2fe0e87bd53f221b58ff862b1db3ce6f5bd5217c.zip |
update
Diffstat (limited to '383/main.cpp')
-rw-r--r-- | 383/main.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/383/main.cpp b/383/main.cpp new file mode 100644 index 0000000..f7d4fa4 --- /dev/null +++ b/383/main.cpp @@ -0,0 +1,25 @@ + +#include "header.hpp" +#include <unordered_map> + +class Solution { +public: + static bool canConstruct(std::string ransomNote, std::string magazine) { + bool result; + + for (auto &iter : ransomNote) { + std::cout << iter; + auto pos = magazine.find(iter); + if (pos == std::string::npos) { + return false; + } else { + magazine[pos] = '\n'; + } + std::cout << magazine << "\n"; + } + + return true; + } +}; + +int main(int argc, char **argv) { Solution::canConstruct("maga", "magazine"); } |