From 5550d9da4be7166a6ee63fdc684ff64327092337 Mon Sep 17 00:00:00 2001 From: Haroon Albar <91939783+haroonalbar@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:27:57 +0530 Subject: [PATCH] Note for more context --- array/find_duplicate_in_array.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/array/find_duplicate_in_array.go b/array/find_duplicate_in_array.go index f193720..5338b3f 100644 --- a/array/find_duplicate_in_array.go +++ b/array/find_duplicate_in_array.go @@ -18,3 +18,8 @@ func abs(a int) int { } return a } + +// Note: This solution uses Marking Technique +// Pros: No extra space required. +// Cons: Modifies the original list, Only works if the item value is between 0 and len(list)-1 +// A more general solution would be to use a set. But the space complexity will become O(n).