Ad
  • Default User Avatar

    This program runs in O(N*M) since
    str1.contains(s) is O(N) with N = length(str1), M = length(str2)

    Using List it takes O(N) only, N = max length of (str1, str2).

  • Default User Avatar

    I make several classes but compile error shows:
    /Calculator.java:24: error: class Square is public, should be declared in a file named Square.java

    How to compile multitple classes here?