Your question is LeetCode 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.
For an AKKODIS engineering assessment, implement one function that solves two independent collection tasks: find the unique pair of indices whose values add to a target, and group a list of lowercase words by anagram equivalence.
Define solve_two_sum_and_group_anagrams(nums, target, words):
nums whose values sum to target.words. Words in the same group must contain identical character counts. Preserve the order of words within each group and order groups by the first occurrence of any word in that group.two_sum and anagram_groups. The value of two_sum is a two-element list of indices. The value of anagram_groups is a list of word lists.Each input is guaranteed to contain exactly one valid Two Sum pair. Do not reuse an array element. All words contain only lowercase English letters.
def solve_two_sum_and_group_anagrams(nums, target, words):