Game-problem

Time complexity

1-FindFirst2DArray() has two nested loops that why this function complexity is O(n2) where n is the size of the input array 2-MergeAndsort() is used to convert the 2D array into a single array and then sort it so this is have time complexity is O(nlogn) 3-last one findDoubleTarget() also have two nested loops so this also has time complexity O(n2) where n is the size of the input array

space complexity

1-The Space complecity of FindFirst2DArray O(1) because it only uses a fixed amount of additional space to store the result array, redardless of the input size 2-The "mergeand Sort' function creates anew array to store the merged and sorted array. The space complexityh ofthis functio is O(n) where n is the total size of the merged array 3-The FindDoubleTArget functio also creates a new array to store the result the space compxity of this function is o(n) where n is the size of the input array