1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # @param {String[]} ideas # @return {Integer} def distinct_names(ideas) let={} ('a'..'z').each{|i|let[i]=[]} ideas.each{|s|let[s[0]]<<s[1..]} p let ans=0 ('a'..'z').each do|i| ('a'..'z').each do|j| next if i==j m=(let[i]&let[j]).size ans+=(let[i].size-m)*(let[j].size-m) end end ans end | cs |
2306. Naming a Company.
chromat..(hjroh0315)
2023-02-09 21:41
추천 0
다른 게시글
-
2306. Naming a Company개발뉴비(coderhs) | 23.02.09추천 0
-
2306. Naming a company (설명X) [1]익명(218.234) | 23.02.09추천 0
-
45. Jump Game II이벤트(1.226) | 23.02.08추천 0
-
45. Jump Game IIchromate00(hjroh0315) | 23.02.08추천 0
-
45. Jump Game II개발뉴비(coderhs) | 23.02.08추천 0
-
904. Fruit Into Baskets개발뉴비(coderhs) | 23.02.08추천 0
-
904. Fruit Into Baskets이벤트(1.226) | 23.02.07추천 0
-
904. Fruit Into Basketschromate00(hjroh0315) | 23.02.07추천 0
-
1470. Shuffle the Array이벤트(1.226) | 23.02.07추천 0
-
1470. Shuffle the Array개발뉴비(coderhs) | 23.02.06추천 0
댓글 0