FastPrepMatch Panel Code Splits

Match Panel Code Splits

ZipRecruiter logoZipRecruiter● EasyNEW GRADOA
Learn

Problem statement

panel is a digit string. For each digit string in codes, split it every possible way into a nonempty leading index and nonempty trailing pattern, in increasing index-length order.

Emit the pattern when it occurs in panel starting at the decoded zero-based index; otherwise emit not found. Concatenate all results in code and split order.

Function

matchPanelCodes(panel: String, codes: String[]) → String[]

Examples

Example 1

panel = "012345"codes = ["223"]return = ["23","not found"]

2|23 matches at index 2; 22|3 is out of range.

Example 2

panel = "012345"codes = ["0445"]return = ["not found","45","not found"]

03|45 matches at decoded index 3.

Constraints

  • 1 <= panel.length <= 100000
  • Every code has length at least two.

More ZipRecruiter problems

See ZipRecruiter hiring insights
public String[] matchPanelCodes(String panel, String[] codes) {
    // Write your code here.
}
panel"012345"
codes["223"]
expected["23", "not found"]
Checking account…