Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insertion in deque #25

Open
Ankit152 opened this issue May 18, 2021 · 3 comments
Open

Insertion in deque #25

Ankit152 opened this issue May 18, 2021 · 3 comments
Assignees
Labels
good first issue Good for newcomers ksoc'21

Comments

@Ankit152
Copy link
Owner

Given an array arr[] of size N containing non-negative integers. You need to insert all elements of the array to deque and return it.

Input:
5
1 2 3 4 5

Output:
1 2 3 4 5

@Ankit152 Ankit152 added good first issue Good for newcomers ksoc'21 labels May 18, 2021
@shubhamsharma6701
Copy link
Contributor

#include<iostream>
#include<deque>
using namespace std;
void pushindeque(int arr[], int n){
    deque <int> q;
    for(int i=0;i<n;i++)
        q.push_back(arr[i]);
    for(int i=0;i<n;i++)
        cout<<q[i]<<" ";
}
int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    pushindeque(arr,n);
   return 0;
}

@Ankit152
Copy link
Owner Author

You need to claim it first. Would you like to work on it @shubhamsharma6701?

@shubhamsharma6701
Copy link
Contributor

Yes, I can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers ksoc'21
Projects
None yet
Development

No branches or pull requests

2 participants