Update appNew update is available. Click here to update.
About
National Institute of Technology Patna 2025
My Stats
EXP gained
yellow-spark
9315
Level
6 (Specialist)
Community stats
Discussions
0
Upvotes
2
Know more
295
Total problems solved
285
Easy
8
Moderate
2
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:

3 days

Less

More

Achievements
4
Ronin
Topics
Arrays
Linked List
Greedy
+ 1 more
1
Ronin
Guided path
Basics of C++
2
Sensei
Guided path
Fundamentals of Css
+ 1 more
Discussions
Easy solution using two for loop
Interview problems

#include <iostream>

using namespace std;

 

int main() {

    int n,key;

    cin>>n;

    int arr[n];

 

    for (int i = 0; i < n; i++) {

      cin >> arr[i];

    }

   cin>>key;

   for(int i=key;i<n;i++){

       cout<<arr[i]<<" ";

   }

   for(int i=0;i<key;i++){

        cout<<arr[i]<<" ";

   }

      

    return 0;

}

profile
Nishant kumar
Published On 07-Aug-2023
101 views
0 replies
2 upvotes
Easy solution using two for loop
Interview problems

#include <iostream>

using namespace std;

 

int main() {

    int n,key;

    cin>>n;

    int arr[n];

 

    for (int i = 0; i < n; i++) {

      cin >> arr[i];

    }

   cin>>key;

   for(int i=key;i<n;i++){

       cout<<arr[i]<<" ";

   }

   for(int i=0;i<key;i++){

        cout<<arr[i]<<" ";

   }

      

    return 0;

}

profile
Nishant kumar
Published On 07-Aug-2023
101 views
0 replies
2 upvotes
solution
Interview problems

        for (int i = 0; i < n; i++) {

          cin >> arr[i];

        }

 

for(int j=0;j<n;j++){

    if(arr[j]==arr[j+1]){

arr[j+1]=arr[j];

return arr[j];

    }

    

profile
Nishant kumar
Published On 08-Apr-2023
106 views
0 replies
1 upvotes