Problem
This function returns the last item in an array.
def last_item(arr):
return arr[-1]
Solution
Whether it's the first item or the last, indexing an array is a constant time operation .
This workbook was created by Jad and Rayan Slim. Feel free to explore some of their courses:
The Complete Java Development Bootcamp
The Complete Spring Boot Development Bootcamp – Become a Java Web Developer
Feedback Summary
0.0
0 students
5
0%
4
0%
3
0%
2
0%
1
0%
Written Reviews
There are no written reviews yet.