From 87111aa044e0dba16dd52e7702d9fae6c3f99c4c Mon Sep 17 00:00:00 2001 From: Cmatthews Date: Tue, 9 Jan 2024 09:55:26 -0800 Subject: [PATCH 1/3] Trail run --- .idea/vcs.xml | 6 ++++++ src/Main.java | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java index 930198c..448d58a 100644 --- a/src/Main.java +++ b/src/Main.java @@ -12,4 +12,8 @@ public static void main(String[] args) { System.out.println("i = " + i); } } + public static boolean isUnique(String word) + { return false; + + } } \ No newline at end of file From 772b4ae347f68a84546d455b98da65e54ff5dce4 Mon Sep 17 00:00:00 2001 From: Cmatthews Date: Tue, 9 Jan 2024 10:03:11 -0800 Subject: [PATCH 2/3] Trail run2 --- src/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Main.java b/src/Main.java index 448d58a..dcfa91d 100644 --- a/src/Main.java +++ b/src/Main.java @@ -14,6 +14,6 @@ public static void main(String[] args) { } public static boolean isUnique(String word) { return false; - +//test 2 } } \ No newline at end of file From 87d916b5a24ff09296f6516f3a55de91c78d52e7 Mon Sep 17 00:00:00 2001 From: Cmatthews Date: Wed, 10 Jan 2024 19:33:36 -0800 Subject: [PATCH 3/3] Finished basic isUnique --- src/Main.java | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/Main.java b/src/Main.java index dcfa91d..ce87750 100644 --- a/src/Main.java +++ b/src/Main.java @@ -2,18 +2,38 @@ // click the icon in the gutter. public class Main { public static void main(String[] args) { - //TIP Press 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 to start debugging your code. We have set one breakpoint - // for you, but you can always add more by pressing . - System.out.println("i = " + i); + if (isUnique("always")) { + System.out.println("this is unqiue"); + } else { + System.out.println("this is not unquie"); } } - public static boolean isUnique(String word) - { return false; -//test 2 + + + public static boolean isUnique(String word) { + + for (int i = 0; i <= word.length(); i++) { + char a = word.charAt(i); + for (int j = i + 1; j < word.length(); j++) { + if (word.charAt(j) == a) { + + return true; + } + + } + + + } + + return false; + + } + + + } -} \ No newline at end of file + + + + +