Skip to content

Commit

Permalink
Fix syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
doompadee committed Jan 29, 2018
1 parent b1aa255 commit e829b35
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?

public class isUniqueChars {
public class IsUniqueChars {
public boolean isUniqueChars(String str) {
int checker = 0;
for(int i = 0; i < str.length(); i++) {
int val = str.charAt(i) - 'a';
if((checker & (1 << val)) > 0) {
return false;
}
checker |= (1 << val));
checker |= (1 << val);
}
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public static Stack<Integer> sort(Stack<Integer> s) {
while(!r.isEmpty() && r.peek() > tmp) { //step 2
s.push(r.pop());
}
r.push(tmp) //step 3
r.push(tmp); //step 3
}
return r;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void add(int d) {
System.out.println("Error placing disk " + d);
}
else {
disks.push(d):
disks.push(d);
}
}

Expand All @@ -56,4 +56,4 @@ public void moveDisks(int n, Tower destination, Tower buffer) {
buffer.moveDisks(n - 1, destination, this);
}
}
}
}

0 comments on commit e829b35

Please sign in to comment.