登录 注册
当前位置:主页 > 资源下载 > 9 > 解决Codewars网站上的Josephus Survivor问题,即Josephus_Survivor!

解决Codewars网站上的Josephus Survivor问题,即Josephus_Survivor!

  • 更新:2024-11-28 14:20:56
  • 大小:1KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:其它 - 开发技术
  • 格式:ZIP

资源介绍

约瑟夫斯幸存者 在此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