Update appNew update is available. Click here to update.
About
-> Rishabh Jain, a passionate B.Tech student specializing in Computer Science at College of Engineering Roorkee. With a love for coding, he aspires to become a coding ninja. Mastering various programm...
College of Engineering Roorkee 2025
My Stats
EXP gained
yellow-spark
19061
Level
7 (Expert)
Community stats
Discussions
2
Upvotes
5
Know more
759
Total problems solved
744
Easy
15
Moderate
0
Hard
0
Ninja
Dec Dec Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov

Current streak:

0 days

Longest streak:

24 days

Less

More

Achievements
4
Ronin
Topics
Arrays
Sorting
Strings
+ 1 more
1
Ronin
Guided path
Basics of C++
2
Sensei
Guided path
Pointers
ChatGPT

College monthly badge

1 Time topper

College of Engineering Roorkee

291 average partcipants
Discussions
Five simple approaches 🙌||Easiest CPP solution🚀
Interview problems

// we can swap by taking a third variable 

 

void swapNumber(int &a, int &b) {

    int temp=0;

    temp=a;

    a=b;

    b=temp;

}

 

// we can swap with our inbuilt swap function 

void swapNumber(int &a, int &b) {

swap(a,b);

}

 

//using + and - operator

void swapNumber(int &a, int &b){

a=a+b;

b=a-b;

a=a-b;

}

 

//using * and / operator

void swapNumber(int &a, int &b){

a=a*b;

b=a/b;

a=a/b;

}

 

//using xor ^ operator

void swapNumber(int &a, int &b){

a=a^b;

b=a^b;

a=a^b;

}

 

//Kindly upvote if this helps you in any way.

profile
Enrish
Published On 30-Oct-2023
128 views
0 replies
6 upvotes
Five simple approaches 🙌||Easiest CPP solution🚀
Interview problems

// we can swap by taking a third variable 

 

void swapNumber(int &a, int &b) {

    int temp=0;

    temp=a;

    a=b;

    b=temp;

}

 

// we can swap with our inbuilt swap function 

void swapNumber(int &a, int &b) {

swap(a,b);

}

 

//using + and - operator

void swapNumber(int &a, int &b){

a=a+b;

b=a-b;

a=a-b;

}

 

//using * and / operator

void swapNumber(int &a, int &b){

a=a*b;

b=a/b;

a=a/b;

}

 

//using xor ^ operator

void swapNumber(int &a, int &b){

a=a^b;

b=a^b;

a=a^b;

}

 

//Kindly upvote if this helps you in any way.

profile
Enrish
Published On 30-Oct-2023
128 views
0 replies
6 upvotes
Five simple approaches 🙌||Easiest CPP solution🚀
Interview problems

// we can swap by taking a third variable 

 

void swapNumber(int &a, int &b) {

    int temp=0;

    temp=a;

    a=b;

    b=temp;

}

 

// we can swap with our inbuilt swap function 

void swapNumber(int &a, int &b) {

swap(a,b);

}

 

//using + and - operator

void swapNumber(int &a, int &b){

a=a+b;

b=a-b;

a=a-b;

}

 

//using * and / operator

void swapNumber(int &a, int &b){

a=a*b;

b=a/b;

a=a/b;

}

 

//using xor ^ operator

void swapNumber(int &a, int &b){

a=a^b;

b=a^b;

a=a^b;

}

 

//Kindly upvote if this helps you in any way.

profile
Enrish
Published On 30-Oct-2023
128 views
0 replies
6 upvotes
Five simple approaches 🙌||Easiest CPP solution🚀
Interview problems

// we can swap by taking a third variable 

 

void swapNumber(int &a, int &b) {

    int temp=0;

    temp=a;

    a=b;

    b=temp;

}

 

// we can swap with our inbuilt swap function 

void swapNumber(int &a, int &b) {

swap(a,b);

}

 

//using + and - operator

void swapNumber(int &a, int &b){

a=a+b;

b=a-b;

a=a-b;

}

 

//using * and / operator

void swapNumber(int &a, int &b){

a=a*b;

b=a/b;

a=a/b;

}

 

//using xor ^ operator

void swapNumber(int &a, int &b){

a=a^b;

b=a^b;

a=a^b;

}

 

//Kindly upvote if this helps you in any way.

profile
Enrish
Published On 30-Oct-2023
128 views
0 replies
6 upvotes
Five simple approaches 🙌||Easiest CPP solution🚀
Interview problems

// we can swap by taking a third variable 

 

void swapNumber(int &a, int &b) {

    int temp=0;

    temp=a;

    a=b;

    b=temp;

}

 

// we can swap with our inbuilt swap function 

void swapNumber(int &a, int &b) {

swap(a,b);

}

 

//using + and - operator

void swapNumber(int &a, int &b){

a=a+b;

b=a-b;

a=a-b;

}

 

//using * and / operator

void swapNumber(int &a, int &b){

a=a*b;

b=a/b;

a=a/b;

}

 

//using xor ^ operator

void swapNumber(int &a, int &b){

a=a^b;

b=a^b;

a=a^b;

}

 

//Kindly upvote if this helps you in any way.

profile
Enrish
Published On 30-Oct-2023
128 views
0 replies
6 upvotes
Dutch national Flag Algo 🚀with explaination||Easiest CPP solution 🙌||
Interview problems

dutch nationial flag algo basically deals with the thing that 0 is in beginning , 1 in mid and 2 in the end, you can see that easily in below code. 

 

#include <bits/stdc++.h> 

void sort012(int *arr, int n)

{

   int low=0,high=n-1,mid=0;

   while(high>=mid)

   {

       if(arr[mid]==0)

       {

          swap(arr[low],arr[mid]);

          low++;

          mid++;

       }

       else if(arr[mid]==1)

       {

          mid++;

       }

      else if(arr[mid]==2)

       {

          swap(arr[mid],arr[high]);

          high--;

       }

   }

}

 

Kindly upvote if it helps you in anyway :)

profile
Enrish
Published On 30-Oct-2023
98 views
0 replies
3 upvotes
Dutch national Flag Algo 🚀with explaination||Easiest CPP solution 🙌||
Interview problems

dutch nationial flag algo basically deals with the thing that 0 is in beginning , 1 in mid and 2 in the end, you can see that easily in below code. 

 

#include <bits/stdc++.h> 

void sort012(int *arr, int n)

{

   int low=0,high=n-1,mid=0;

   while(high>=mid)

   {

       if(arr[mid]==0)

       {

          swap(arr[low],arr[mid]);

          low++;

          mid++;

       }

       else if(arr[mid]==1)

       {

          mid++;

       }

      else if(arr[mid]==2)

       {

          swap(arr[mid],arr[high]);

          high--;

       }

   }

}

 

Kindly upvote if it helps you in anyway :)

profile
Enrish
Published On 30-Oct-2023
98 views
0 replies
3 upvotes
Dutch national Flag Algo 🚀with explaination||Easiest CPP solution 🙌||
Interview problems

dutch nationial flag algo basically deals with the thing that 0 is in beginning , 1 in mid and 2 in the end, you can see that easily in below code. 

 

#include <bits/stdc++.h> 

void sort012(int *arr, int n)

{

   int low=0,high=n-1,mid=0;

   while(high>=mid)

   {

       if(arr[mid]==0)

       {

          swap(arr[low],arr[mid]);

          low++;

          mid++;

       }

       else if(arr[mid]==1)

       {

          mid++;

       }

      else if(arr[mid]==2)

       {

          swap(arr[mid],arr[high]);

          high--;

       }

   }

}

 

Kindly upvote if it helps you in anyway :)

profile
Enrish
Published On 30-Oct-2023
98 views
0 replies
3 upvotes
Dutch national Flag Algo 🚀with explaination||Easiest CPP solution 🙌||
Interview problems

dutch nationial flag algo basically deals with the thing that 0 is in beginning , 1 in mid and 2 in the end, you can see that easily in below code. 

 

#include <bits/stdc++.h> 

void sort012(int *arr, int n)

{

   int low=0,high=n-1,mid=0;

   while(high>=mid)

   {

       if(arr[mid]==0)

       {

          swap(arr[low],arr[mid]);

          low++;

          mid++;

       }

       else if(arr[mid]==1)

       {

          mid++;

       }

      else if(arr[mid]==2)

       {

          swap(arr[mid],arr[high]);

          high--;

       }

   }

}

 

Kindly upvote if it helps you in anyway :)

profile
Enrish
Published On 30-Oct-2023
98 views
0 replies
3 upvotes
Smallest || Optimized CPP sol 🧑‍💻|| Very easy approach🚀🙌
Interview problems

#include <iostream>

using namespace std;

 

int main() {

    int Length;

    int Breadth;

    cin>>Length>>Breadth;

    cout<<Length*Breadth;

 

    return 0;

}

profile
Enrish
Published On 30-Oct-2023
148 views
0 replies
1 upvotes