From 1f90763e7df5d1847516aa3dd90b5398aa125bb6 Mon Sep 17 00:00:00 2001 From: Dale Seo <5466341+DaleSeo@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:08:25 -0500 Subject: [PATCH] feat: add to-lower-case onboarding solution --- to-lower-case/DaleSeo.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 to-lower-case/DaleSeo.rs diff --git a/to-lower-case/DaleSeo.rs b/to-lower-case/DaleSeo.rs new file mode 100644 index 0000000000..3fc2638784 --- /dev/null +++ b/to-lower-case/DaleSeo.rs @@ -0,0 +1,15 @@ +// TC: O(n) +// SC: O(n) +impl Solution { + pub fn to_lower_case(s: String) -> String { + s.chars() + .map(|c| { + if c.is_ascii_uppercase() { + (c as u8 + (b'a' - b'A')) as char + } else { + c + } + }) + .collect() + } +}