title: String reverse operation best time complexity: Is it O(n) or O(n/2)?
body: <p>Below code snippet for String reverse</p>
  
  <pre><code>private static String reverseString(String originalString){
  char arr[]= originalString.toCharArray();
  char temp;
  
  for(int i= 0,j=arr.length-1;i&lt;(arr.length/2);i++,j--){
  
   temp=arr[i];
   arr[i]=arr[j];
   arr[j]=temp;
  }
  return new String(arr);
  </code></pre>
  
  <p>I have seen lot of discussion over the time complexity for the above String reverse where some have mentioned the complexity to be O(n/2) and some O(n).</p>
  
  <p>I would like to understand which one would actually be the correct time complexity for the string reverse.</p>
  
  <p>Any insight would be really helpful in assuaging the confusion here.</p>