Must-do problems: Lists
140 min · Intermediate
Need help? Ask a tutor on WhatsApp (opens in a new tab)Every problem here is solved with a list: read the input into an ArrayList (or a LinkedList), then add, insert, remove and search, and print the list with its own toString(). Mind remove(int) against remove(Object), never remove inside a for-each loop, and run every test before opening a hint.
What you will learn
- Read input into an ArrayList and use add, add(index), get, remove and set correctly
- Choose between remove(int) and remove(Object) on an Integer list
- Remove items safely with removeIf and search with indexOf and contains
- Use a LinkedList at both ends for queue-style problems
Sign in to continue this lesson
Create an account to read every lesson, practise with the exercises and keep track of your progress.