Refactor Code Style (#4151)

This commit is contained in:
Saurabh Rahate
2023-04-15 13:55:54 +05:30
committed by GitHub
parent 1ce907625b
commit 1dc388653a
100 changed files with 293 additions and 319 deletions

View File

@ -50,8 +50,8 @@ public class Anagrams {
if (s.length() != t.length()) {
return false;
} else {
char c[] = s.toCharArray();
char d[] = t.toCharArray();
char[] c = s.toCharArray();
char[] d = t.toCharArray();
Arrays.sort(c);
Arrays.sort(
d
@ -65,8 +65,8 @@ public class Anagrams {
if (a.length() != b.length()) {
return false;
} else {
int m[] = new int[26];
int n[] = new int[26];
int[] m = new int[26];
int[] n = new int[26];
for (char c : a.toCharArray()) {
m[c - 'a']++;
}
@ -90,8 +90,8 @@ public class Anagrams {
}
// this is similar to approach number 2 but here the string is not converted to character array
else {
int a[] = new int[26];
int b[] = new int[26];
int[] a = new int[26];
int[] b = new int[26];
int k = s.length();
for (int i = 0; i < k; i++) {
a[s.charAt(i) - 'a']++;