Demohack2022 / hacktoberfest2022

HacktoberFest Contribution Repo
https://github.com/Demohack2022/hacktoberfest2022
MIT License
8 stars 61 forks source link

code for swap nodes in pair #75

Open gaurav-312 opened 1 year ago

gaurav-312 commented 1 year ago

Example 1:

Input: head = [1,2,3,4] Output: [2,1,4,3]

Example 2:

Input: head = [] Output: []

Example 3:

Input: head = [1] Output: [1]