Tuesday, 13 September 2016

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.

Submit your solution here:- Click here


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]; 

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment