@shradhaKD

We'll be starting with the next data structure i.e. Stack tomorrowβ™₯ Hope you are benefitting & learning a lot of things from the series!

@weby-vansh

we can also use this recursive approach :

class Solution {
public:
    ListNode* swapPairs(ListNode* head) {
        int k = 2;
        ListNode* temp = head;
        int count = 0;

        // Step 1: Check if we have at least k nodes
        while (count < k && temp != nullptr) {
            temp = temp->next;
            count++;
        }

        // If we have fewer than k nodes, return head (no reversal)
        if (count < k) return head;

        // Step 2: Reverse k nodes
        ListNode* prev = swapPairs(temp);  // Recurse for the rest of the list
        temp = head;
        int cnt = 0;
        while (cnt < k) {
            ListNode* next = temp->next;
            temp->next = prev;
            prev = temp;
            temp = next;
            cnt++;
        }

        return prev;
    }
};

@GurudasDev

i have done this question on my own i have finally succeed

@rish_tr

I accomplished it! I just had to watch the last part once. This part:

while (count < k) {
            ListNode* next = temp->next;
            temp->next = prevNode;
            prevNode = temp;
            temp = next;
            count++;
        }

@ShushantKumar-y2u

Your way of explaining is awesome Didi, You explain difficult questions in a very simple way.

@SHQUIZCORNER

React js course when coming plz replay......

@OMEGAGaming-cv1ty

please continue the DSA series

@tanishqvishwakarma9518

Done πŸ‘ 
Thank you Didi 😊

@SonaliParida-q5c

Awsome explaination

@samyabiswas8366

You're an awesome educator di!!

@MOHD_ASHRAF.707

Great lecture πŸ₯°πŸ“ŒπŸ₯°πŸ“ŒπŸ₯°πŸ”₯πŸ”₯πŸ”₯πŸ“ŒπŸ“ŒπŸ₯°πŸ₯°πŸ₯°πŸ₯°πŸ“Œ

@HayAbhi1

Continuity go slowly, But go High ❀

@PrashChandra71

Done Today's Lecture❀

@vivekmalviya3124

Thanku you very much for this DSA series

@sumanexclusive5653

thank you didi ...😍😍😍

@DhananjayIngole-jy3rh

plz continue the series plz

@Shaswat_Shrivas

Lecture Completed!

@sharma-q2q

Hello Didi , i'm from Bangladesh . Since you began creating videos for the DSA course using C + +, I have been viewing your videos on a regular basis. I also gained a lot of fresh knowledge. If I wish to enrol in your course, what can I do?

@hemadevi7106

This question can be solved with same algorithm discuss in previous video(leetcode 25) with k=2.. 
 Relpy if and edge case stucks😊😊😊

@learn_with_rks

Please upload the next video