LeetCode 412. Fizz Buzz
2022.07.18
問題
typescript
typescriptfunction fizzBuzz(n: number): string[] { const result: string[] = [] for (let i = 1; i <= n; i++) { const r = i % 15 === 0 ? 'FizzBuzz' : i % 3 === 0 ? 'Fizz' : i % 5 === 0 ? 'Buzz' : String(i) result.push(r) } return result };