freeCodeCamp/curriculum/challenges/arabic/08-coding-interview-prep/project-euler/problem-14-longest-collatz-...

1.3 KiB

id challengeType title videoUrl localeTitle
5900f37a1000cf542c50fe8d 5 Problem 14: Longest Collatz sequence

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert.strictEqual(longestCollatzSequence(14), 9, "<code>longestCollatzSequence(14)</code> should return 9.");'
  - text: ''
    testString: 'assert.strictEqual(longestCollatzSequence(5847), 3711, "<code>longestCollatzSequence(5847)</code> should return 3711.");'
  - text: ''
    testString: 'assert.strictEqual(longestCollatzSequence(46500), 35655, "<code>longestCollatzSequence(46500)</code> should return 35655.");'
  - text: ''
    testString: 'assert.strictEqual(longestCollatzSequence(54512), 52527, "<code>longestCollatzSequence(54512)</code> should return 52527.");'
  - text: ''
    testString: 'assert.strictEqual(longestCollatzSequence(1000000), 837799, "<code>longestCollatzSequence(1000000)</code> should return 837799.");'

Challenge Seed

function longestCollatzSequence(limit) {
  // Good luck!
  return true;
}

longestCollatzSequence(14);

Solution

// solution required