From b643a4c488a249f5da91b7765195f404c78c6f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Wed, 16 Oct 2024 15:19:05 +0000 Subject: [PATCH 1/4] feat: created chigazograham.json file --- .../main/resources/data/chigazograham.json | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 lesson_09/types/types_app/src/main/resources/data/chigazograham.json diff --git a/lesson_09/types/types_app/src/main/resources/data/chigazograham.json b/lesson_09/types/types_app/src/main/resources/data/chigazograham.json new file mode 100644 index 000000000..292620c54 --- /dev/null +++ b/lesson_09/types/types_app/src/main/resources/data/chigazograham.json @@ -0,0 +1,92 @@ +[ + { + "column1": "ms1wuglcnp", + "column2": "true", + "column3": "6463003749233522688", + "column4": "2.7921879E38", + "column5": "8.442422875678673E307", + "column6": "4743", + "column7": "1270272283" + }, + { + "column1": "7awo0gh", + "column2": "false", + "column3": "7752118028902647808", + "column4": "2.6698281E38", + "column5": "5.605056226818231E307", + "column6": "23516", + "column7": "1704066280" + }, + { + "column1": "cserf78x02", + "column2": "false", + "column3": "2540472457630355968", + "column4": "1.5396288E38", + "column5": "1.50417665803363E308", + "column6": "14580", + "column7": "2114160244" + }, + { + "column1": "zgqnjh5", + "column2": "false", + "column3": "953741867660372224", + "column4": "2.2381432E38", + "column5": "2.493477176095576E307", + "column6": "26539", + "column7": "996751379" + }, + { + "column1": "s5iqo80h3c", + "column2": "false", + "column3": "5714943984670955520", + "column4": "1.932927E38", + "column5": "1.705202914715676E308", + "column6": "7442", + "column7": "1112427416" + }, + { + "column1": "wcuo0zxejh", + "column2": "false", + "column3": "2704740152448495104", + "column4": "1.0179288E38", + "column5": "1.393686380125556E308", + "column6": "32762", + "column7": "1881329776" + }, + { + "column1": "cnq9kjd6hiu", + "column2": "true", + "column3": "6206221245541992448", + "column4": "1.3631897E38", + "column5": "1.2956738103127734E308", + "column6": "30578", + "column7": "1147532001" + }, + { + "column1": "8z0bnd", + "column2": "false", + "column3": "4562348053081931776", + "column4": "1.4620677E38", + "column5": "2.044622864892074E307", + "column6": "17197", + "column7": "1094615070" + }, + { + "column1": "0vl9htqrw", + "column2": "false", + "column3": "6077936030977995776", + "column4": "1.7550462E38", + "column5": "4.752956293100593E307", + "column6": "12867", + "column7": "724629435" + }, + { + "column1": "6ur49", + "column2": "true", + "column3": "1339556241029906688", + "column4": "1.944709E38", + "column5": "9.16514287771922E307", + "column6": "20363", + "column7": "562533284" + } +] \ No newline at end of file From 68ccb5fae54e5e7c969f4a4ace4c2947e82813e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Wed, 16 Oct 2024 19:01:53 +0000 Subject: [PATCH 2/4] fix: deleted lesson_09 content from main; --- .../main/resources/data/chigazograham.json | 92 ------------------- 1 file changed, 92 deletions(-) delete mode 100644 lesson_09/types/types_app/src/main/resources/data/chigazograham.json diff --git a/lesson_09/types/types_app/src/main/resources/data/chigazograham.json b/lesson_09/types/types_app/src/main/resources/data/chigazograham.json deleted file mode 100644 index 292620c54..000000000 --- a/lesson_09/types/types_app/src/main/resources/data/chigazograham.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "column1": "ms1wuglcnp", - "column2": "true", - "column3": "6463003749233522688", - "column4": "2.7921879E38", - "column5": "8.442422875678673E307", - "column6": "4743", - "column7": "1270272283" - }, - { - "column1": "7awo0gh", - "column2": "false", - "column3": "7752118028902647808", - "column4": "2.6698281E38", - "column5": "5.605056226818231E307", - "column6": "23516", - "column7": "1704066280" - }, - { - "column1": "cserf78x02", - "column2": "false", - "column3": "2540472457630355968", - "column4": "1.5396288E38", - "column5": "1.50417665803363E308", - "column6": "14580", - "column7": "2114160244" - }, - { - "column1": "zgqnjh5", - "column2": "false", - "column3": "953741867660372224", - "column4": "2.2381432E38", - "column5": "2.493477176095576E307", - "column6": "26539", - "column7": "996751379" - }, - { - "column1": "s5iqo80h3c", - "column2": "false", - "column3": "5714943984670955520", - "column4": "1.932927E38", - "column5": "1.705202914715676E308", - "column6": "7442", - "column7": "1112427416" - }, - { - "column1": "wcuo0zxejh", - "column2": "false", - "column3": "2704740152448495104", - "column4": "1.0179288E38", - "column5": "1.393686380125556E308", - "column6": "32762", - "column7": "1881329776" - }, - { - "column1": "cnq9kjd6hiu", - "column2": "true", - "column3": "6206221245541992448", - "column4": "1.3631897E38", - "column5": "1.2956738103127734E308", - "column6": "30578", - "column7": "1147532001" - }, - { - "column1": "8z0bnd", - "column2": "false", - "column3": "4562348053081931776", - "column4": "1.4620677E38", - "column5": "2.044622864892074E307", - "column6": "17197", - "column7": "1094615070" - }, - { - "column1": "0vl9htqrw", - "column2": "false", - "column3": "6077936030977995776", - "column4": "1.7550462E38", - "column5": "4.752956293100593E307", - "column6": "12867", - "column7": "724629435" - }, - { - "column1": "6ur49", - "column2": "true", - "column3": "1339556241029906688", - "column4": "1.944709E38", - "column5": "9.16514287771922E307", - "column6": "20363", - "column7": "562533284" - } -] \ No newline at end of file From 09fa4518f545f965d790f9c07c29a0eef28457fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Thu, 24 Oct 2024 01:47:26 +0000 Subject: [PATCH 3/4] feat: created string permutation distance calculator; added comments explaining each line of code; --- .../com/codedifferently/lesson13/Lesson13.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java b/lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java index 0c981abbf..a8834e7f4 100644 --- a/lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java +++ b/lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java @@ -5,8 +5,24 @@ public class Lesson13 { /** * Provide the solution to LeetCode 3146 here: * https://leetcode.com/problems/permutation-difference-between-two-strings + * You are given two strings s and t such that every character occurs at most once in s and t is a permutation of s. + * The permutation difference between s and t is defined as + * the sum of the absolute difference between the index of the occurrence + * of each character in s and the index of the occurrence of the same character in t. + * Return the permutation difference between s and t. */ public int findPermutationDifference(String s, String t) { - return 0; + + int permuDifference = 0; + // Created a counter to track Permutation Difference + for (int i = 0; i < s.length(); i++) { + // Loops through each letter in string 's' + int difference = s.indexOf(s.charAt(i)) - t.indexOf(s.charAt(i)); + // Subtracts possitional value of string 't' from the possitional value of string 's' + permuDifference += Math.abs(difference); + // Converts difference into absolute value and adds it to the Permutation Difference + } + return permuDifference; + // Returns the total Permutation Difference value } } From f5872dda2725967d034e9c636240ece0549c97a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Thu, 24 Oct 2024 01:58:26 +0000 Subject: [PATCH 4/4] fix: ran ./gradlew :maps_app:spotlessApply to correct formating; --- .../java/com/codedifferently/lesson13/Lesson13.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java b/lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java index a8834e7f4..da2b3e951 100644 --- a/lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java +++ b/lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java @@ -4,15 +4,14 @@ public class Lesson13 { /** * Provide the solution to LeetCode 3146 here: - * https://leetcode.com/problems/permutation-difference-between-two-strings - * You are given two strings s and t such that every character occurs at most once in s and t is a permutation of s. - * The permutation difference between s and t is defined as - * the sum of the absolute difference between the index of the occurrence - * of each character in s and the index of the occurrence of the same character in t. - * Return the permutation difference between s and t. + * https://leetcode.com/problems/permutation-difference-between-two-strings You are given two + * strings s and t such that every character occurs at most once in s and t is a permutation of s. + * The permutation difference between s and t is defined as the sum of the absolute difference + * between the index of the occurrence of each character in s and the index of the occurrence of + * the same character in t. Return the permutation difference between s and t. */ public int findPermutationDifference(String s, String t) { - + int permuDifference = 0; // Created a counter to track Permutation Difference for (int i = 0; i < s.length(); i++) {