# Hacker Rank solution for Vector-Sort In C++

Problem:- Vector-Sort Hacker Rank Solution or Vector-Sort hacker rank solution c++ orMulti Level Inheritance in java or Vector-Sort solution or Vector-Sort solution in C++ or Vector-Sort hacker rank solution in Java or Vector-Sort hacker rank solution c++ or Vector-Sort hacker rank solution c++ or Vector-Sort program in c or Vector-Sort solution in C or Hacker Rank Solution For Vector-Sort in C++ or Vector-Sort in C++ or Hacker Rank solution for Vector-Sort in C++.

Explanation:- Check this some vector functions.

Declaration:

vector<int>v; (creates an empty vector of integers)

Size:

int size=v.size();

Pushing an integer into a vector:

v.push_back(x);(where x is an integer.The size increases by 1 after this.)

Popping the last element from the vector:

v.pop_back(); (After this the size decreases by 1)

Sorting a vector:

sort(v.begin(),v.end()); (Will sort all the elements in the vector)

Check- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard Domain.

Solution:-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{

int n,i;

cin>>n;

vector<int> arr(n);

for(i=0;i<n;i++)
cin>>arr[i];