Your question is Solve Two Sum and Anagrams. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Akkodis Canada receives numeric identifiers and text labels from multiple workflow surfaces. Implement one function that solves two independent tasks efficiently: find the unique pair of identifier indices whose values equal a target, and group labels that are anagrams.
Implement analyze_inputs(nums, target, words):
nums whose values sum to target. Return indices in ascending order. Exactly one pair exists.words so that words containing the same letters, with the same frequencies, belong to one group. Preserve the order in which groups are first encountered and preserve the original order of words within each group. Matching is case-sensitive, and anagrams must have identical lengths.Return a dictionary with this exact shape:
{"two_sum": [i, j], "anagram_groups": [[...], [...]]}.
def analyze_inputs(nums, target, words):