Preview:
 #include <algorithm>
#include <iostream>

// you can write to stdout for debugging purposes, e.g.
// cout << "this is a debug message" << endl;

int solution(vector<int> &A) {
    // write your code in C++14 (g++ 6.2.0)
    int n = A.size();
    std::sort(A.begin(),A.end());
    vector<int>B;
    for(int i = 1; i<=n; i++)
    {
       B.push_back(i);
    }
    if(B==A)
    {
        return 1;
    }
    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter