JAVA 1ms memory 100%, o(n), 7 lines
\nclass Solution {\n    public boolean canFormArray(int[] arr, int[][] pieces) {\n        Map<Integer, Integer> map = new HashMap();\n        for (int i = 0; i 
```\nclass Solution {\n    public boolean canFormArray(int[] arr, int[][] pieces) {\n        Map<Integer, Integer> map = new HashMap();\n        for (int i = 0; i < arr.length; i++) map.put(arr[i], i);\n        for (int[] piece: pieces) {\n            if (!map.containsKey(piece[0])) return false;\n            for (int i = 0; i < piece.length - 1; i++)\n                if (map.getOrDefault(piece[i], Integer.MIN_VALUE) + 1 != map.getOrDefault(piece[i + 1], Integer.MIN_VALUE)) return false;\n        }\n        return true;\n    }\n}\n```
[]