Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
std::vector::size()
returns an unsigned integer type, so beware of unsigned integer arithmetic.If
numbers
is empty,numbers.size() - 1
will be evaluated to18446744073709551615
(orstd::numeric_limits<std::vector<int>::size_type>::max()
).I think the best practice to check for empty vector has always been
empty()
and notsize()
, sinceempty()
guaranteesO(1)
complexity regardless of the container of the vector.