Did not understand v[v.size( )-1]

did not understand v[v.size( )-1]

@Aditya-Kushwaha-914550392281281

hello Aditya,
v[v.size()-1] will give u last element of the vector.
because v.size() is number elements in vector and v.size() -1 is the index of last element of that vector.

u can also try v.back() to get last element of the vector.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.