Simple and Easy to understand solution using Hashmap / Dictionary with comments
in C#, Dictionary is similar to HashMap in Java. \n\n\npublic class CheckArrayFormationThroughConcatenationSolution\n{\n    public bool CanFormArray(int[] arr, 
in C#, Dictionary is similar to HashMap in Java. \n\n```\npublic class CheckArrayFormationThroughConcatenationSolution\n{\n    public bool CanFormArray(int[] arr, int[][] pieces)\n    {\n        //Store all the first values, row number in Dictionary for the pieces array.\n        Dictionary<int, int> values = new Dictionary<int, int>();\n        for (int i = 0; i < pieces.Length; i++)\n        {\n            values.Add(pieces[i][0], i);\n        }\n\n        for (int i = 0; i < arr.Length;)\n        {\n            int val = arr[i];\n            //Check if you have found the value from the hashmap.\n            if (values.ContainsKey(val))\n            {\n                int index = values[val];\n                //once you found the index value for that element iterate over the inner elements of pieces[index] array\n                for (int j = 0; j < pieces[index].Length; j++)\n                {\n                    //at any point if you have not found the element matching with arr[] array just return false otherwise increment i.\n                    if (arr[i] != pieces[index][j])\n                    {\n                        return false;\n                    }\n\n                    i++;\n                }\n            }\n            //If you have not found then you can return false as we didn\'t find the required element\n            else\n            {\n                return false;\n            }\n        }\n\n        return true;\n    }\n}\n```\n\nLet me  know if you have any doubts.\nhttps://github.com/pankajrathi95/DS-Algo/tree/master/src/LeetCode/30DayLeetCodeChallenge-Jan2021
['Array']