From bb83b31326b746b970eb16dea1794bc1f5e84a00 Mon Sep 17 00:00:00 2001 From: Eatswap Date: Mon, 31 Oct 2022 00:58:46 +0800 Subject: [PATCH] add: 0383 --- cpp/more/0383.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cpp/more/0383.cpp diff --git a/cpp/more/0383.cpp b/cpp/more/0383.cpp new file mode 100644 index 0000000..f234f0d --- /dev/null +++ b/cpp/more/0383.cpp @@ -0,0 +1,12 @@ +#include +#include + +class Solution { +public: + bool canConstruct(const std::string& r, const std::string& m) { + for (char c = 'a'; c <= 'z'; ++c) + if (std::count(r.begin(), r.end(), c) > std::count(m.begin(), m.end(), c)) + return false; + return true; + } +};