← 返回 oracle 的题目列表Find Anagram Positions in Phrases
类型:online_judge
Given a list of phrases and a list of words, find out which words in the phrases can be replaced by words in the word list where the replacement condition is being an anagram. Return a list of integers indicating each possible replacement position in the phrases.
Example
Input:
Phrase List: ["hello world", "below elbow"]
Word List: ["below", "elbow"]
Output: [0, 4]
Explanation
The word to be replaced and the target word must be an anagram.
Return the position of all replaceable words in the phrases that satisfy the condition.
A word might appear multiple times in different phrases, but each word uses the first valid replacement only.
Example
Input
[["hello world", "below elbow"], ["below", "elbow"]]