String ReductionProblem Submissions Leaderboard Discussions Editorial Topics You are viewing a single comment's thread. Return to all comments → yashparihar729 1 year ago Here is my solution in java, javascript, python, C, C++, Csharp HackerRank String Reduction Problem Solution 0|PermalinkBlog Sco...
②如果不是 那么答案 可能是1 或者是 2 ③我们可以反着推回去。就是假如 刚开始的状态的1 我们可以先假定 x = 字符a的数量 y = 字符b的数量 z = 字符c的数量 如果某个字符串 是由 1 推过去的 那么刚开始 x, y, z的数量就是 (1, 0, 0) || (0, 1, 0) || (0, 0, 1) 其奇偶状态就...
String Reduction defstringReduction(s):str=sn=len(str)count=[0]*3foriinrange(n):count[ord(str[i])-ord('a')]+=1if(count[0]==norcount[1]==norcount[2]==n):returnnif((count[0]%2)==(count[1]%2)and(count[1]%2)==(count[2]%2)):return2return1...
got no where because the choices of reduction for a string cant seem to be reduced to choices of reduction for its substrings, so the problem cant seem to be analyzed in terms of its subproblems - irreducible problem.
String Reduction You are viewing a single comment's thread.Return to all comments → vsvsasas 2 years ago i can understand ... it myself took a long while to understand whay was happening