Java | Easy solution
class Solution {\n    public boolean canFormArray(int[] arr, int[][] pieces) {\n\n        String s = "";\n        Map myMap = new HashMap();\n\n        for (int
class Solution {\n    public boolean canFormArray(int[] arr, int[][] pieces) {\n\n        String s = "";\n        Map<Integer, int[]> myMap = new HashMap<Integer, int[]>();\n\n        for (int i = 0 ; i < pieces.length ; i++){\n            myMap.put(pieces[i][0], pieces[i]);\n        }\n\n        for (int i = 0 ; i < arr.length ; i++){\n            if (myMap.containsKey(arr[i])){\n                s = s + ", " + Arrays.toString(myMap.get(arr[i]));\n                i = i + (myMap.get(arr[i]).length) - 1;\n            }\n            else return false;\n        }\n\n        s = "[" + s.replaceAll("\\\\[|\\\\]", "").replaceAll("^, ", "") + "]";\n        return Arrays.toString(arr).equals(s);        \n    }\n}
['Java']