雨滴是 FizzBuzz 挑战的稍微复杂一点的版本,这是一个经典的面试题。
你的任务是把一个数字转换成它对应的雨滴声。
如果给定的数字:
"Plong"。"PlingPlang"。"34"。在本练习中,你将实现一个过程,它需要为返回的字符串分配内存。释放该字符串由这个过程的调用方负责。
// The procedure will be called like that:
converted := convert(3)
// ...
// and eventually the caller will delete the string
delete(converted)