2016-01-01から1年間の記事一覧
問題文 TopCoder Statistics - Problem Statement 書いた class PeacefulLine: def makeLine(self, x): counter = collections.Counter(x) count_arr = [] for word, cnt in counter.most_common(): count_arr.append(cnt) is_continue = True while is_cont…
問題文 https://apps.topcoder.com/wiki/display/tc/SRM+642 書いた class ForgetfulAddition: def minNumber(self, expression): num = str(expression) res = 0 for i in xrange(1, len(num)): sum_num = int(num[:i]) + int(num[i:]) if res == 0: res = …
問題文 https://apps.topcoder.com/wiki/display/tc/SRM+639 書いた class ElectronicPetEasy: def isDifficult(self, st1, p1, t1, st2, p2, t2): first = [] for i in xrange(t1): first.append(st1+(p1*i)) second = [] for i in xrange(t2): second.appe…
問題文 https://community.topcoder.com/stat?c=problem_statement&pm=13521 書いた class NamingConvention: def toCamelCase(self, variableName): while variableName.count('_') > 0: replace_char_index = variableName.index('_') variableName = vari…
問題文 Limak has found a large field with some piles of stones. Limak likes perfection. It would make him happy if every pile had the same number of stones. He is now going to move some stones between the piles to make them all equal. Howe…
Problem Statement We call a pair of Strings (s, t) "wood" if t is contained in s as a subsequence. (See Notes for a formal definition.) Given Strings s and t, return the String "Yep, it's wood." (quotes for clarity) if the pair (s, t) is w…