Problem Statement | |||||||||||||
Given a dictionary of words, where will a newly coined word be most likely
to fit?
We are given k, the length of the new word, and dictionary, a String[] of words in ascending alphabetical order. Suppose that the new word is equally likely to be any k-letter word that is not already in the dictionary. Return the most likely 0-based index for the new word. If there is more than one most likely index, return -1. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | dictionary will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of dictionary will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | Each character in each element of dictionary will be a lowercase letter ('a'-'z'). | ||||||||||||
- | The elements of dictionary will be distinct and in ascending alphabetical order. | ||||||||||||
- | k will be between 1 and 10, inclusive. | ||||||||||||
- | There will be at least one k-letter word that is not in dictionary. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|