首页 > 编程知识 正文

阿里java笔试题,阿里java面试题

时间:2023-05-06 11:27:54 阅读:34478 作者:4954

记录自己写的解答的构想。 无论如何,绝对不要当真。 很大的概率就是反例。

/* * * @ title : searchkeywordintext * @ description :查询关键字索引* @ param : @ param text * @ param : @ param kekey string * @ throws */publicmapstring,stringsearchkeywordintext (string text,liststringkeywords (throwskeynotfoundexcepceptiords ) String result=new HashMapString, 对于string Keywords.Foreach(key-(/过滤包含目标文本的if (key.index of ) text )0) keywords,按text拆分string [ ] sparard for(intI=0; i spArr.length; I )索引buffer.append (sparr [ I ].length ); if(I1sparr.length((/)2_5_7) indexbuffer.append ) _ ); (}//如果keywords发生冲突…这里是result.put(key,indexbuffer.toString ) ); }; ); if(result.isempty () ) { throw new KeyNotFoundException ('目标文件不匹配!' ); }返回结果; }如果大人物知道的话,请指出来。 谢谢你。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。