Skip to content

Latest commit

 

History

History

260-swapPairs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

swapPairs

Interview question of the issue #260 of rendezvous with cassidoo.

The Question

Given a list, swap every two adjacent nodes. Something to think about: How would your code change if this were a linked list, versus an array?

Example:

> swapPairs([1,2,3,4])
> [2,1,4,3]

> swapPairs([])
> []

Installing & Running

Just pnpm i to install all dependencies and then pnpm t to run the tests!