LeetCode: To Lower Case Solution

1/**
2 * @param {string} s
3 * @return {string}
4 */
5var toLowerCase = function (s) {
6 return s.toLowerCase()
7}
8
9var toLowerCase = function (s) {
10 return s
11 .split("")
12 .map(c =>
13 "A" <= c && c <= "Z" ? String.fromCharCode(c.charCodeAt(0) + 32) : c
14 )
15 .join("")
16}

Comments

Loading comments...

Tags

leetcode

string

Apply and earn a $2,500 bonus once you're hired on your first job!

Clients from the Fortune 500 to Silicon Valley startups

Choose your own rate, get paid on time

From hourly, part-time, to full-time positions

Flexible remote working environment

A lot of open JavaScript jobs!!

Fact corner: Referred talent are 5x more likely to pass the Toptal screening process than the average applicant.

Still hesitate? Read HoningJS author's guide on dealing with Toptal interview process.

Next Post

LeetCode: Evaluate Reverse Polish Notation

May 26, 2021

Previous Post

LeetCode: N Queens

May 23, 2021

HoningJS

Search Posts