Company: Agoda
Difficulty: medium
1. Similar Strings Two strings are said to be similar if they are composed of the same characters. For example "abca" and "cba" are similar since both of them are composed of the characters 'a', 'b', and 'c'. However "abca" and "bcd" are not similar since they do not share all of the same letters. Given an array of strings words of length n , find the number of pairs of strings that are similar. Note: Each string is composed of lowercase English characters only. Pairs are considered index-wise, i.e., two equal strings at different indices are counted as separate pairs. A pair at indices (i, j) is the same as the pair at (j, i). Function Description Complete the function countSimilarPairs in the editor below. countSimilarPairs has the following parameter: string words[n] : an array of n strings Returns long_int : the number of similar pairs Constraints 1 ≤ n ≤ 10 5 The sum of the lengths of all strings does not exceed 10 6 Example Consider n = 3, words = ["xyz", "foo", "of"] Here, the s