the concept of vectors hasnt been taught yet in this course so i am not able to understand it. pls explain the content of this video using another approach
Approach of vectors
Hey @vector.9974
Vectors are also arrays
So jusr keep this things in mind and you will understand the code
vector<int> v; //Declaring empty array of integer type
vector<int> v(10,-1); //declaring vector of size 10 initialized to -1 of integer type
v.push_back(10); //adding 10 to last of the array
v.size();;// current size of the array
If some other notation is used then let me know
sir, i tried to do it without using vectors but am not getting an output. pls check for the error.
Hey @vector.9974
Mentioned the changes in comments: https://ide.codingblocks.com/s/362564
Also reduced array size to 10^5 because we can use max space 10^6 insdide fucntions so to avoid segmentation I did that
If u want to use more space then declare dynamically or globally
thank you sir…