[ad_1]
“Hello World” is a constant so it is O(1) whereas string str is variable of length n so the complexity is O(n)
2
[ad_2]
solved Time complexity difference in System.out.println() [closed]
[ad_1]
“Hello World” is a constant so it is O(1) whereas string str is variable of length n so the complexity is O(n)
2
[ad_2]
solved Time complexity difference in System.out.println() [closed]