Josephus_Survivor:从Codewars网站解决Josephus Survivor问题!

时间:2024-03-09 08:28:09
【文件属性】:

文件名称:Josephus_Survivor:从Codewars网站解决Josephus Survivor问题!

文件大小:1KB

文件格式:ZIP

更新时间:2024-03-09 08:28:09

Go

约瑟夫斯幸存者 在此kata中,您必须正确返回谁是“幸存者”,即: 的最后一个元素。 基本上,您必须假设将n个人围成一个圈,并按照k个元素的步骤将其消除,如下所示: josephus_survivor(7,3) => means 7 people in a circle; one every 3 is eliminated until one remains [1,2,3,4,5,6,7] - initial sequence [1,2,4,5,6,7] => 3 is counted out [1,2,4,5,7] => 6 is counted out [1,4,5,7] => 2 is counted out [1,4,5] => 7 is counted out [1,4] => 5 is counted out [4] => 1 counted out, 4 is the l


【文件预览】:
Josephus_Survivor-master
----survivor.go(554B)
----README.md(1KB)

网友评论