Matching Submatrix with Pattern

Company: eBay MTS 1 - Software Engineer_4july

Difficulty: medium

Problem Statement

You are given a rectangular matrix of integers board and a square matrix of characters pattern . The elements of board are digits (integers between 0 and 9 ). The characters of pattern are either digits or lowercase English letters. Your task is to find a submatrix in board which matches the pattern. A submatrix of integers submatrix matches a matrix of characters pattern if: The matrices have identical dimensions. If any character of pattern is a digit, then the corresponding integer of submatrix in the same position should be equal to that digit. If any character of pattern is a letter, then all the occurrences of that letter in pattern should correspond to the same digit in submatrix . For any two distinct letters of pattern , their corresponding digits should be different. If there is a submatrix of board which matches the pattern , return an array of two integers representing the row and the column numbers (0-indexed) of the upper-left corner of the submatrix. If there are more th