freeCodeCamp/curriculum/challenges/arabic/08-coding-interview-prep/rosetta-code/josephus-problem.arabic.md

1.3 KiB

title id challengeType videoUrl localeTitle
Josephus problem 5a23c84252665b21eecc7ec5 5

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert(typeof josephus=="function","<code>josephus</code> should be a function.");'
  - text: ''
    testString: 'assert(typeof josephus(30,3)=="number","<code>josephus(30,3)</code> should return a number.");'
  - text: ''
    testString: 'assert.equal(josephus(30,3),29,"<code>josephus(30,3)</code> should return <code>29</code>.");'
  - text: ''
    testString: 'assert.equal(josephus(30,5),3,"<code>josephus(30,5)</code> should return <code>3</code>.");'
  - text: ''
    testString: 'assert.equal(josephus(20,2),9,"<code>josephus(20,2)</code> should return <code>9</code>.");'
  - text: ''
    testString: 'assert.equal(josephus(17,6),2,"<code>josephus(17,6)</code> should return <code>2</code>.");'
  - text: ''
    testString: 'assert.equal(josephus(29,4),2,"<code>josephus(29,4)</code> should return <code>2</code>.");'

Challenge Seed

function josephus (init, kill) {
  // Good luck!
}

Solution

// solution required