今天在網上看到乙個好玩的題目哪來練練哈

2021-08-30 10:41:17 字數 1511 閱讀 1911

[quote]

好像描述的由點問題,再細化點吧!

1、找出 連續相同的字元個數最少為min的字串

2、對字串排序,這裡的排序不是指按字母排序,而是按「連續相同的字元個數」排序

比如:str1="abcdbcebcgh" str2="eabcfbcxbcv" min=2

所得的結果希望是:

no1. str1: start 0; end 2; str2: start 1; end 3

the same string: abc

no2. str1: start 4; end 5; str2: start 5; end 6

the same string: bc

no3. str1: start 4; end 5; str2: start 8; end 9

the same string: bc

no4. str1: start 7; end 8; str2: start 5; end 6

the same string: bc

no5. str1: start 7; end 8; str2: start 8; end 9

the same string: bc

因為abc比bc長,所以不在abc查詢bc了,而其餘的bc因為都相同,所以都需要輸出

[/quote]

去重沒寫..

public class test

}private static char chars2 = null ;

private static setset = new treeset() ;

public static void result(string str1 , string str2 , int min)}}

public static void find(string str,int begin ,int end)

if(chars2[i]==cs[k])else}}

}class str implements comparable

private int end2 ;

public string getstr()

public void setstr(string str)

public int getbegin1()

public void setbegin1(int begin1)

public int getbegin2()

public void setbegin2(int begin2)

public int getend1()

public void setend1(int end1)

public int getend2()

public void setend2(int end2)

public int compareto(str o) else

}public string tostring()

}

今天在網上看到乙個帖子,怎麼樣鍛鍊自己的大腦

多參加運動 每天從事一些簡單的運動,如騎車 散步或園藝勞動等,能為大腦提供更多的血液 從而有助於保持認知功能活躍。減少心血管疾病的風險因素 心血管疾病的風險因素,包括高血壓 糖尿病和吸菸等,會損傷大腦中的微血管,從而加速老化程序。為減少風險,你需要戒菸,並保持健康的體重,控制好血壓和膽固醇。慎服藥物...

在網上看到這樣乙個問題

有關利用teamviewer的vpn訪問受控機器內網功能問題?外網有一台機器b 中文xp sp3 也安裝了teamviewer3.6.4756,能通過這個東東連線到內網的機器a,進行遠端控制 現在我想使用這個軟體的vpn功能,從外網的機器直接訪問內網的網路 選擇 vpn 點連線,顯示連線成功,我的i...

在網上看到的,一些獲取值得方法

遍歷option和新增 移除option function changeshipmethod shipping else 判斷是否已經打勾 當然jquery的選擇器是強大的.還有很多方法.aaass 11 22 33 44 55 66 jquery radio取值,checkbox取值,select...