![]() | 1 Wonderwall OP 更正:输入是string,所以第一步我先把它变了array。感谢! |
2 hyesun 2015-07-20 16:44:43 +08:00 ![]() 楼主你这个代码。。我输入 "a bb ccc" 输出来的是 -1。你把 return word 放在第一层循环里,循环一次就返回了,后面的字符串怎么能被处理。。 |
![]() | 4 imlonghao 2015-07-20 23:47:40 +08:00 ![]() 学着写了个 Python 版本 我感觉我还是不会用 Python3 , return 那里感觉我是傻逼。。。。。。 https://gist.github.com/imlonghao/df181988bd285753c1b8 |
![]() | 5 Wonderwall OP |
![]() | 6 madeinclojure 2015-07-21 07:15:56 +08:00 ```clojure (defn freq-of-cha [str] (->> str frequencies (sort-by val >) first second (vector str))) (defn answer [col] (->> col (map freq-of-cha) (sort-by second >) ffirst)) ``` |
![]() | 7 madeinclojure 2015-07-21 07:20:39 +08:00 |