freeCodeCamp/curriculum/challenges/arabic/08-coding-interview-prep/rosetta-code/farey-sequence.arabic.md

1.2 KiB

title id challengeType videoUrl localeTitle
Farey sequence 59c3ec9f15068017c96eb8a3 5

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert(typeof farey === "function", "<code>farey</code> is a function.");'
  - text: ''
    testString: 'assert(Array.isArray(farey(3)), "<code>farey(3)</code> should return an array");'
  - text: ''
    testString: 'assert.deepEqual(farey(3), ["1/3","1/2","2/3"], "<code>farey(3)</code> should return <code>["1/3","1/2","2/3"]</code>");'
  - text: ''
    testString: 'assert.deepEqual(farey(4), ["1/4","1/3","1/2","2/4","2/3","3/4"], "<code>farey(4)</code> should return <code>["1/4","1/3","1/2","2/4","2/3","3/4"]</code>");'
  - text: ''
    testString: 'assert.deepEqual(farey(5), ["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"], "<code>farey(5)</code> should return <code>["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]</code>");'

Challenge Seed

function farey (n) {
  // Good luck!
}

Solution

// solution required