Embracing Algorithms
But there is a problem that if you try to delete 2 consecutive elements.

Final Bug fix

Optimization
The remove(at: ) complexity is O(n)

So the deleteSelection() complexity is O(n²)

we can optimize the function O(n²) → O(n) by the removeAll(where: )


Linear vs Quadratic
Linear algorithms always wins

Problem 2


Optimization
O(n²) → O(n)

Problem 3

Optimization


Problem 4

Optimization
