作者:fu昀
def comm(str: String, char: Char): Boolean = { for (i <- 3 until str.length if str.substring(0, i).matches(s"^.*${str.charAt(i)}.*$char.*$$")) { return false } true } def isLike(str: String):...
View Article作者:ZJCouple_linZhenRu
public String result (String str){ char[] strs=str.toCharArray(); int length =strs.length; if(length%2 == 0) return “Dislikes”; else{ for(int i = 0,j=length ; i < (length-1)/2 ; i++,j– ){ if (...
View Article作者:杨念初L
# -*- coding:utf-8 -*- # 2016/8/19 # mail:ybs.kakashi@gmail.com from collections import defaultdict input_words = raw_input("please input your words:\n") checkers = list() def check_1(words): if...
View Article作者:医图
第三个条件也可以用哈希表检测重复啊 C++ bool CheckRep(const string& str, int idx1, int idx2) { bool result = false; int hash[256] = {0}; for(int i = idx1+1; i < idx2; ++i) { ++hash[str[i]]; } for(int j = idx2+1;...
View Article作者:小湫哥
之前贴的代码 不太规范 重贴一遍吧 主要处理了判断条件 至于字符串长度和是否为空的规范性判断就没加了大家都会 贴上自己测试的 please input your request AAA dislike please input your request THETXH dislike please input your request A like please input your request...
View Article作者:makao007
Python #encoding:utf8 import re def like(s): for i in s: if ord(i) >= ord('A') and ord(i) <= ord('Z'): pass else: return 'False' last = None for i in s: if last == i: return False last = i def...
View Article
More Pages to Explore .....