8kyu Duck Duck Goose

Posted tong24

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了8kyu Duck Duck Goose相关的知识,希望对你有一定的参考价值。

题目:

The objective of ‘Duck, duck, goose‘ is to walk in a circle, tapping on each player‘s head until one is finally chosen.

Task: Given an array of Player objects (an array of associative arrays in php) and an index (1-based), return the name of the chosen Player.

Example:

duck_duck_goose([a, b, c, d], 1) should return a.name
duck_duck_goose([a, b, c, d], 5) should return a.name
duck_duck_goose([a, b, c, d], 4) should return d.name
// PHP only
duck_duck_goose([$a, $b, $c, $d], 1); // => $a["name"]
duck_duck_goose([$a, $b, $c, $d], 5); // => $a["name"]
duck_duck_goose([$a, $b, $c, $d], 4); // => $d["name"]

答案:

以上是关于8kyu Duck Duck Goose的主要内容,如果未能解决你的问题,请参考以下文章

raing,this,brother,school coat,goose,写出每个单词的3个同类词

类 对象 封装

如何在 Cyber​​Duck 中通过 SFTP 使用 sudo?

python duck.py组合聚合

ruby duck.rb

面向对象-duck