[ Go ] Using map
Idea is to store the first element of piece as key and other elements as value in the map and then use this information to validate the piece order in the given
Idea is to store the first element of piece as key and other elements as value in the map and then use this information to validate the piece order in the given array\n\n```\nfunc canFormArray(arr []int, pieces [][]int) bool {\n    m := make(map[int][]int)\n    \n    for _, p := range pieces {\n        m[p[0]] = p[1:]\n    }\n    \n    for i :=0; i < len(arr); {\n        piece, ok := m[arr[i]]\n        \n        if !ok {\n            return false\n        }\n        \n        i++\n        for _, p := range piece {\n            if p != arr[i] {\n                return false\n            }\n            i++\n        }\n    }\n    \n    return true\n}\n```
['Go']