Skip to content

Chigazo Lesson 13 String Permutation Calculator #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 31 commits into from
Closed
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
887b8f0
Merge pull request #1 from code-differently/main
A1-4U2T1NN Sep 26, 2024
05ad627
Merge branch 'code-differently:main' into main
A1-4U2T1NN Sep 27, 2024
5715b6a
Merge branch 'code-differently:main' into main
A1-4U2T1NN Sep 30, 2024
6c909b0
Merge branch 'code-differently:main' into main
A1-4U2T1NN Sep 30, 2024
4c1a3f2
Merge branch 'code-differently:main' into main
A1-4U2T1NN Sep 30, 2024
de19403
Merge branch 'code-differently:main' into main
A1-4U2T1NN Sep 30, 2024
56aa83d
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 1, 2024
8529105
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 2, 2024
4f76813
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 3, 2024
48bf962
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 5, 2024
1da88b9
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 7, 2024
3068765
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 9, 2024
712efd6
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 11, 2024
5db7413
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 11, 2024
5096f8e
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 12, 2024
09341aa
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 14, 2024
a8f634e
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 15, 2024
b643a4c
feat: created chigazograham.json file
Oct 16, 2024
cae2152
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 16, 2024
68ccb5f
fix: deleted lesson_09 content from main;
Oct 16, 2024
7d4f86f
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 16, 2024
473eb98
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 17, 2024
1d19106
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 17, 2024
bba5af5
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 18, 2024
a51c852
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 19, 2024
8a39fcc
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 21, 2024
ac98745
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 22, 2024
eade00f
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 23, 2024
bf252ad
Merge branch 'code-differently:main' into main
A1-4U2T1NN Oct 23, 2024
09fa451
feat: created string permutation distance calculator; added comments …
Oct 24, 2024
f5872dd
fix: ran ./gradlew :maps_app:spotlessApply to correct formating;
Oct 24, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,24 @@ public class Lesson13 {

/**
* Provide the solution to LeetCode 3146 here:
* https://leetcode.com/problems/permutation-difference-between-two-strings
* 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
}
}