We’re asked to solve it in constant space O(1), but the provided solution is linear space O(N). Either change the solution or the statement to clear this up
Hi @Nicolas_F ,
Ignoring the space required for storing the duplicates, the algorithm runs in constant space O(1). The time complexity of that algorithm is O(n), not the space complexity.
We hope Educative has inspired you to further your learning.
exactly, if you ignore the space required for storing the duplicates will make any solution to any problem constant space O(1). it’s like saying you won’t ingest calories if you remove the apple before eating an apple.