[FEATURE REQUEST] Add Swap Nodes in Pairs Problem in recursion .
What would you like to Propose?
A solution which can be understood by all.
Issue details
Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.
class Solution { public ListNode swapPairs(ListNode head) { if(head==null) return head; ListNode temp1=head; ListNode temp2=head; temp1=temp1.next; if(temp2.next!=null) temp2.next=swapPairs(temp2.next.next); if(temp1!=null){ temp1.next=temp2; head=temp1;} return head; } }
Additional Information
No response
@siriak Please assign me this issue. I want to add this to recursion sectio n
@siriak Please assign this issue to I am interested to work on this.
We don't add leetcode problems
@siriak Can you please tell what problems should I add. As I want to contribute by creating a PR . Thankyou !
General computer science problems, or specific well-known algorithms like encodings, string search algorithms, graph algorithms, etc.
okay! Thankyou for reply