go: add «1460. Make Two Arrays Equal by Reversing Subarrays»

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-08-03 17:47:12 +02:00
parent 79db7a329c
commit ef40cbb1fd
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -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
}