NeetCode #169LC-2306HardArrays & Hashing
← Back to All Problems#169 · #2306 · Naming a Company(公司命名)
📌 Problem Statement & Constraints
You are given an array of distinct strings
ideas, each of length 2. A company name is formed by swapping the first letters of two ideas; it is valid if the resulting name is not in the original list. Return the number of valid names. Constraints: 2 <= ideas.length <= 5 * 10^4, ideas[i].length == 2; all ideas are distinct.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!