freeCodeCamp/curriculum/challenges/arabic/08-coding-interview-prep/rosetta-code/hofstadter-q-sequence.arabi...

1.4 KiB

title id challengeType videoUrl localeTitle
Hofstadter Q sequence 59637c4d89f6786115efd814 5

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert(typeof hofstadterQ === "function", "<code>hofstadterQ</code> is a function.");'
  - text: ''
    testString: 'assert(Number.isInteger(hofstadterQ(1000)), "<code>hofstadterQ()</code> should return <code>integer</code>");'
  - text: ''
    testString: 'assert.equal(hofstadterQ(testCase[0]), res[0], "<code>hofstadterQ(1000)</code> should return <code>502</code>");'
  - text: ''
    testString: 'assert.equal(hofstadterQ(testCase[1]), res[1], "<code>hofstadterQ(1500)</code> should return <code>755</code>");'
  - text: ''
    testString: 'assert.equal(hofstadterQ(testCase[2]), res[2], "<code>hofstadterQ(2000)</code> should return <code>1005</code>");'
  - text: ''
    testString: 'assert.equal(hofstadterQ(testCase[3]), res[3], "<code>hofstadterQ(2500)</code> should return <code>1261</code>");'

Challenge Seed

function hofstadterQ (n) {
  // Good luck!
  return n;
}

After Test

console.info('after the test');

Solution

// solution required