Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr


        

Your Answer

Calling v.push_back(x) for x=1,2,3,4,5...
 Solution: [ 1, 2, 3, 4, 5 ]
Your code: [ 1, 2, 3, 4, 5 ]

Calling v.pop_back() twice...
 Solution: [ 1, 2, 3 ]
Your code: [ 1, 2, 3 ]

Calling v.push_back(-1)...
 Solution: [ 1, 2, 3, -1 ]
Your code: [ 1, 2, 3, -1 ]

Calling v.at(0) and v.at(3)...
 Solution: v.at(0) = 1 and v.at(3) = -1
Your code: v.at(0) = 1 and v.at(3) = -1

Emptying using while (!v.empty()) { v.pop_back(); }
 Solution: [ ]
Your code: [ ]

Adding 2 one hundred times.
grow() was called. Capacity is now 10.
grow() was called. Capacity is now 20.
grow() was called. Capacity is now 40.
grow() was called. Capacity is now 80.
grow() was called. Capacity is now 160.
 Solution: v.size() = 100 and v.at(99) = 2
Your code: v.size() = 100 and v.at(99) = 2

JOJ Answer

Calling v.push_back(x) for x=1,2,3,4,5...
 Solution: [ 1, 2, 3, 4, 5 ]
Your code: [ 1, 2, 3, 4, 5 ]

Calling v.pop_back() twice...
 Solution: [ 1, 2, 3 ]
Your code: [ 1, 2, 3 ]

Calling v.push_back(-1)...
 Solution: [ 1, 2, 3, -1 ]
Your code: [ 1, 2, 3, -1 ]

Calling v.at(0) and v.at(3)...
 Solution: v.at(0) = 1 and v.at(3) = -1
Your code: v.at(0) = 1 and v.at(3) = -1

Emptying using while (!v.empty()) { v.pop_back(); }
 Solution: [ ]
Your code: [ ]

Adding 2 one hundred times.
grow() was called. Capacity is now 10.
grow() was called. Capacity is now 20.
grow() was called. Capacity is now 40.
grow() was called. Capacity is now 80.
grow() was called. Capacity is now 160.
 Solution: v.size() = 100 and v.at(99) = 2
Your code: v.size() = 100 and v.at(99) = 2