/**
 * Given a string, find the length of the longest substring without repeating characters.
 * Given "abcabcbb", the answer is "abc", which the length is 3.
 * Complexity : O(n) time, O(n) space
 */
public class Solution {
  public int lengthOfLongestSubstring(String s) {

int j = 0; // front pointer
int i = 0; // back pointer
int size = s.length();
HashSet<Character> set = new HashSet<Character>();
int result = 0;
while ( i < size && j < size) {
  // adds only the unique values
  if (!set.contains(s.charAt(i))) {
    // Move the back pointer, increasing the substring length.
    i++;
    set.add(s.charAt(i - 1));
    // i - j, since that will give use the length of the substring
    result = Math.max(result, i - j);
  } else {
    // Move the front pointer, decreasing the substring length.
    j++;
    set.remove(s.charAt(j - 1));
  }
}
return result;

  }
}

@@ -268,17 +268,20 @@
 ng s) %7B%0A
-%0A
+    
 int j = 
@@ -296,24 +296,28 @@
 ont pointer%0A
+    
 int i = 0; /
@@ -331,16 +331,20 @@
 pointer%0A
+    
 int size
@@ -358,16 +358,20 @@
 ngth();%0A
+    
 HashSet%3C
@@ -413,16 +413,20 @@
 ter%3E();%0A
+    
 int resu
@@ -433,16 +433,20 @@
 lt = 0;%0A
+    
 while ( 
@@ -469,16 +469,20 @@
 size) %7B%0A
+    
   // add
@@ -506,16 +506,20 @@
  values%0A
+    
   if (!s
@@ -542,24 +542,28 @@
 arAt(i))) %7B%0A
+    
     // Move 
@@ -609,24 +609,28 @@
 ing length.%0A
+    
     i++;%0A   
@@ -622,24 +622,28 @@
        i++;%0A
+    
     set.add(
@@ -660,16 +660,20 @@
  - 1));%0A
+    
     // i
@@ -735,16 +735,20 @@
 ing%0A    
+   
+ 
 result =
@@ -773,16 +773,20 @@
 i - j);%0A
+    
   %7D else
@@ -788,16 +788,20 @@
  else %7B%0A
+    
     // M
@@ -864,13 +864,21 @@
     
+ 
+   
 j++;%0A
+    
     
@@ -908,20 +908,32 @@
  1));%0A  
-%7D%0A%7D%0A
+    %7D%0A    %7D%0A    
 return r
@@ -939,15 +939,14 @@
 result;%0A
-%0A
   %7D%0A%7D%0A

Fix comments and styling