diff --git a/go/make-two-arrays-equal-by-reversing-subarrays.go b/go/make-two-arrays-equal-by-reversing-subarrays.go new file mode 100644 index 0000000..38ce7e7 --- /dev/null +++ b/go/make-two-arrays-equal-by-reversing-subarrays.go @@ -0,0 +1,16 @@ +package main + +import "slices" + +func canBeEqual(target []int, arr []int) bool { + slices.Sort(target) + slices.Sort(arr) + + for i := range target { + if arr[i] != target[i] { + return false + } + } + + return true +}