4

n*m (m is length of first string and n is the length of the other one)文字列に別の文字列が含まれているかどうかをテストするための時間の複雑さを伴うブルートフォースアプローチは知っていますが、より良い解決策があるかどうか知りたいですか?

boolean contains(String input,String search)
4

4 に答える 4

3

ソースを見ることができます:

public boolean contains(CharSequence s) {
    return indexOf(s.toString()) > -1;
}
于 2013-08-25T23:09:12.013 に答える