GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Leetcode-Algorithms/src/leetcode/ValidAnagram.java at master · edyluisrey/Leetcode-Algorithms Expand file tree/ Copy pathValidAnagram.javaMore file actions 23 lines (21 loc) · 588 Bytes / Copy pathValidAnagram.javaFile metadata and controls23 lines (21 loc) · 588 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 package leetcode; import java.util.Arrays; public class ValidAnagram { public static void main(String[] args){ ValidAnagram test = new ValidAnagram(); System.out.println(test.isAnagram("anagram", "nagaram")); } public boolean isAnagram(String s, String t) { if(s.length()!=t.length()) return false; char[] s1= s.toCharArray(); Arrays.sort(s1); char[] s2 = t.toCharArray(); Arrays.sort(s2); for(int i =0; i< s.length();i++){ if(s1[i]!=s2[i]){ return false; } } return true; } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |