EXERCISE · AlgoCasts

Circular linked list

Given a linked list, return true if the list is circular, false if it is not.

4 testsAlgoCastsGPL-3.0exercise 20 of 26

Directions

Directions

Given a linked list, return true if the list is circular, false if it is not.

Examples#

JS
const l = new List();const a = new Node('a');const b = new Node('b');const c = new Node('c');l.head = a;a.next = b;b.next = c;c.next = b;circular(l) // true

Try it first#

Copy the stub, make the 4 tests pass on your machine, then open the solution. The reveal is remembered per page in this browser.

JSexercises/circular/index.js
function circular(list) {} module.exports = circular;

See also