Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import java.util.HashSet;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
System.out.printf("Hello and welcome!");

for (int i = 1; i <= 5; i++) {
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
System.out.println("i = " + i);
System.out.println("Hello and welcome!\n");
System.out.println("Is 'test' unique: " + isUnique("test"));
System.out.println("is 'steak' unique: "+ isUnique("steak"));
}
public static boolean isUnique(String inputString)
{
HashSet testString = new HashSet(); //Maybe not hashSet?
for(int i = 0; i < inputString.length(); i++)
{
//still need to check format before add.
if (!(testString.add(inputString.charAt(i))))
return false;
}
return true;
}
}