-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution.java
More file actions
26 lines (25 loc) · 767 Bytes
/
Copy pathsolution.java
File metadata and controls
26 lines (25 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// 205. Isomorphic Strings
// https://leetcode.com/problems/isomorphic-strings/
// Easy | Java | Accepted 2022-08-21
// Runtime 399 ms | Memory 342.7 MB
class Solution {
public boolean isIsomorphic(String s, String t) {
Map<Character, Character> joe = new HashMap<>();
Map<Character, Character> joes = new HashMap<>();
String bruh = "";
for(int i = 0; i<s.length(); i++)
{
if(joe.get(s.charAt(i))==null&&joes.get(t.charAt(i))==null)
{
joe.put(s.charAt(i), t.charAt(i));
joes.put(t.charAt(i), s.charAt(i));
}
bruh+=joe.get(s.charAt(i));
}
if(bruh.equals(t))
{
return true;
}
return false;
}
}