4. List Manipulation Basics - Technology Fundamentals Java
Колеги защо ми дава 80/100, решението ми изглежда същото като обяснението към задачата?
Ето и условието:
Write a program that reads a list of integers. Then until you receive "end", you will be given different commands:
Add {number}: add a number to the end of the list
Remove {number}: remove number from the list
RemoveAt {index}: removes number at a given index
Insert {number} {index}: inserts a number at a given index
Note: All the indices will be valid!
When you receive the "end" command print the final state of the list (separated by spaces)
Example
Input |
Output |
4 19 2 53 6 43 Add 3 Remove 2 RemoveAt 1 Insert 8 3 end |
4 53 6 8 43 3 |
Аз правя така:
case "Remove":
nums.remove((Object) value);
break;