I am learning Big O notation and am wondering what the time complexity for this for loop would be.
public int loop(String text) { int result = 0; for (int i = 0; i < text.length(); i++) { result += text.charAt(i); } return result; } I'm not sure if the time complexity would be O(n) or O(1). I know if the loop was going to n I would assume a time complexity of O(n) but I'm not sure if text.length() would mean the same thing.