https://leetcode.com/explore/interview/card/top-interview-questions-easy/102/math/743/
Explore - LeetCode
LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore.
leetcode.com
javascript
닫기/**
* @param {number} n
* @return {string[]}
*/
function fizzBuzz(n) {
let answer = [];
for (let i = 1; i <= n; i++) {
let FIZZ = i % 3 == 0;
let BUZZ = i % 5 == 0;
answer.push(FIZZ ? (BUZZ ? "FizzBuzz" : "Fizz") : BUZZ ? "Buzz" : i.toString());
}
return answer;
}
GitHub : https://github.com/developeSHG/Algorithm-LeetCode/tree/main/fizz-buzz
GitHub - developeSHG/Algorithm-LeetCode: 릿코드 소스코드
릿코드 소스코드. Contribute to developeSHG/Algorithm-LeetCode development by creating an account on GitHub.
github.com
'Coding Test > LeetCode' 카테고리의 다른 글
[LeetCode] (Array) Lv Easy. Rotate Array (0) | 2023.01.31 |
---|---|
[LeetCode] (Design) Lv Easy. Shuffle an Array (0) | 2023.01.25 |
[LeetCode] (Dynamic Programming) Lv Easy. Climbing Stairs (0) | 2023.01.22 |
[LeetCode] (Sorting and Searching) Lv Easy. First Bad Version (0) | 2023.01.22 |
[LeetCode] (Sorting and Searching) Lv Easy. Merge Sorted Array (0) | 2023.01.22 |
댓글