Practice Naming a Company
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Choose an ordered pair of different names in ideas and exchange their first letters. The pair is valid only when neither resulting name is in the original ideas. Return the number of distinct valid ordered name pairs, represented as the two names separated by a space.
Source: Naming a Company on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
ideas = ["coffee","donuts","time","toffee"]
Output
6
# Example 2
Input
ideas = ["lack","back"]
Output
0
Constraints
2 <= ideas.length <= 5 * 10^4
1 <= ideas[i].length <= 10
ideas[i] consists of lowercase English letters.
All the strings in ideas are unique.
Related LeetCode Problems
Practice more problems similar to Naming a Company.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.