
算法
forever19911314
保持学习热情,专心专注
展开
-
KMP查询字符串是否存在
soruce 源字符串 target 目标字符串 例如 source = “abcdefg”; target = “bcd” 结果返回 1;如果target=“cd”结果返回 2;如果target = “cdg”结果返回-1。 不在返回-1,存在返回在源字符串的位置。 具体的代码如下:public class Solution { public staic void main(S原创 2017-07-03 13:53:40 · 332 阅读 · 0 评论 -
字符串变位词
source 字符串1 target 字符串2 如果 source = “abcd”和target=“bdca” 结果返回 true public class Solution{ public static void main(String[] args){ String source = "abvc"; String target = "abcv";原创 2017-07-03 14:30:21 · 515 阅读 · 0 评论