Company: citi_16oct
Difficulty: medium
Contact Search Problem Description Picture opening your phone's dialer and typing digits: as you type, matching saved contacts pop up. This problem asks you to build the matching logic behind that behavior. Saved contacts are numbered from 0 to N-1. They are represented by two arrays A, B of N strings each. Name of K-th contact is A[K] and phone number is B[K]. Write a function: class Solution { public String solution(String[] A, String[] B, String P); } which, given two arrays A and B and a string P of length M representing a partial phone number, returns the contact name whose phone number contains P as a substring, that is a contiguous segment (for example, "436800143" contains as a substring "6800", but not "3614"). If there is more than one contact matching the search criteria, your function should return the alphabetically smallest contact name. If no match is found, your function should return "NO CONTACT". Examples Example 1: Input: A = ["pim", "pom"], B = ["999999999", "777888