1 Star 0 Fork 0

Sunny / type-challenges

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
antfu 提交于 2022-11-29 18:02 . chore: update readme

FizzBuzz hard #array #math #infer

by Lee Crosby @Cygnut

Take the Challenge

The FizzBuzz problem is a classic test given in coding interviews. The task is simple:

Print integers 1 to N, except:

  • Print "Fizz" if an integer is divisible by 3;
  • Print "Buzz" if an integer is divisible by 5;
  • Print "FizzBuzz" if an integer is divisible by both 3 and 5.

For example, for N = 20, the output should be: 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz, 16, 17, Fizz, 19, Buzz

In the challenge below, we will want to generate this as an array of string literals.

For large values of N, you will need to ensure that any types generated do so efficiently (e.g. by correctly using the tail-call optimisation for recursion).


Back Share your Solutions Check out Solutions
1
https://gitee.com/ztes/type-challenges.git
git@gitee.com:ztes/type-challenges.git
ztes
type-challenges
type-challenges
main

搜索帮助