LeetCode/go/make-two-arrays-equal-by-reversing-subarrays.go
2024-08-03 17:47:12 +02:00

16 lines
210 B
Go

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
}