๐
Camel to Kebab Case
Camel to Kebab Case๋ณดํต ๋ฌธ์์ด +20pts
Problem
Write a function that converts camelCase to kebab-case.
Examples
Input:
camelToKebab("helloWorld")Output:
"hello-world"Explanation
์ด ๋ฌธ์ ๋ **์ ๊ทํํ์**๊ณผ **์ผ์ด์ค ๋ณํ**์ ํ์ตํฉ๋๋ค. ์น ๊ฐ๋ฐ์์ CSS ์์ฑ๊ณผ JavaScript ์์ฑ ๊ฐ ๋ณํ์ ์์ฃผ ์ฌ์ฉ๋ฉ๋๋ค. **์ผ์ด์ค ์คํ์ผ** - camelCase: backgroundColor (JavaScript) - kebab-case: background-color (CSS) - snake_case: background_color (Python) **์ ๊ทํํ์ ๋ถ์: /([A-Z])/g** - `[A-Z]`: ๋๋ฌธ์ A-Z ์ค ํ๋ - `()`: ์บก์ฒ ๊ทธ๋ฃน (๋งค์น๋ ๋ฌธ์๋ฅผ ์ ์ฅ) - `g`: ์ ์ญ ...
View detailed explanation โKey Concepts
์ ๊ทํํ์ ์บก์ฒ ๊ทธ๋ฃน replace ๋ฉ์๋ ์ผ์ด์ค ๋ณํ $1 ์ฐธ์กฐ
Time: O(n) Space: O(n)
solution.js
Ctrl + Enter
Run tests to see results here.