National Institute of Technology Patna 2025
My Stats
EXP gained
9315
Level
6 (Specialist)
Community stats
Discussions
0
2
Know more
295
Total problems solved
285
Easy
8
Moderate
2
Hard
0
Ninja

Current streak:

0 days

Longest streak:

3 days

Less

More

Achievements
4
Ronin
Topics
Arrays
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;

}

Nishant kumar
Published On 07-Aug-2023
101 views
0 replies
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;

}

Nishant kumar
Published On 07-Aug-2023
101 views
0 replies
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];

}

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