Part 1 — Group Anagrams: Given an array of strings, group together strings that are anagrams of one another and output both the grouped lists and the count of groups. Specify the time and space complexities. Part 2 — Count Target in Grid: Given a 2D matrix of characters and a target string, count how many distinct paths in the grid spell the string by moving to orthogonally adjacent cells (up, down, left, right). You may start at any cell; a cell cannot be reused within a single match. Return the total count, or -1 if the string does not occur at least once. Discuss an efficient algorithm and its complexity.