MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / isAnagram

Method isAnagram

242-valid-anagram/valid-anagram.java:4–16  ·  view source on GitHub ↗
(String s, String t)

Source from the content-addressed store, hash-verified

2
3class Solution {
4 public boolean isAnagram(String s, String t) {
5 if (s.length() != t.length()) {
6 return false;
7 }
8
9 char[] sChars = s.toCharArray();
10 char[] tChars = t.toCharArray();
11
12 Arrays.sort(sChars);
13 Arrays.sort(tChars);
14
15 return Arrays.equals(sChars, tChars);
16 }
17}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected