From 68fc104f31e66e2b9529df781794b85613c4eebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Gil=20de=20G=C3=B3mez=20P=C3=A9rez?= Date: Tue, 18 Aug 2026 10:07:24 +0300 Subject: [PATCH] Solved: 36 - Digit Separators --- modules/10_cpp14/src/digit_separators.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/10_cpp14/src/digit_separators.cpp b/modules/10_cpp14/src/digit_separators.cpp index b3babbe..e3498ee 100644 --- a/modules/10_cpp14/src/digit_separators.cpp +++ b/modules/10_cpp14/src/digit_separators.cpp @@ -3,18 +3,20 @@ namespace cpp14 { auto million() -> int { - // TODO: Return 1'000'000 using digit separators - return 0; + return 1'000'000; } auto mask() -> std::uint32_t { - // TODO: Return 0xFF00'00FF - return 0; + return 0xFF00'00FF; } auto bits_set() -> int { - // TODO: Return population count of mask() - return 0; + const auto m = mask(); + auto count = 0; + for (auto i = 0; i < 32; i++) { + if (m & (1 << i)) ++count; + } + return count; } } // namespace cpp14