Java beats 100% (no hashmap)
\nclass Solution {\n    public boolean canFormArray(int[] arr, int[][] pieces) {\n        int i = 0;\n        while (i < arr.length) {\n            int v = arr[
```\nclass Solution {\n    public boolean canFormArray(int[] arr, int[][] pieces) {\n        int i = 0;\n        while (i < arr.length) {\n            int v = arr[i];\n            int[] p = find(v, pieces);\n            if (p == null) return false;\n            int k = 0;\n            while (k < p.length && arr[i++] == p[k++]);\n            if (k != p.length) return false;\n        }\n        return true;\n    }\n    \n    private int[] find(int v, int[][] pieces) {\n        for (int i = 0; i < pieces.length; i++) {\n            if (v == pieces[i][0]) return pieces[i];\n        }\n        return null;\n    }\n}\n```
['Java']