-
567. Permutation in String javaLeetCode_Study_Plan/Algorithm 2022. 12. 21. 11:08
https://leetcode.com/problems/permutation-in-string/
class Solution { public boolean checkInclusion(String s1, String s2) { s1 = sort(s1); for (int i = 0; i < s2.length()-s1.length()+1; i++) { if (s1.equals(sort(s2.substring(i, i+s1.length())))) { return true; } } return false; } public String sort(String s) { char[] s1 = s.toCharArray(); Arrays.sort(s1); return new String(s1); } }
'LeetCode_Study_Plan > Algorithm' 카테고리의 다른 글
733. Flood Fill java (0) 2022.12.22 3. Longest Substring Without Repeating Characters java (0) 2022.12.21 🎵 19. Remove Nth Node From End of List java (0) 2022.12.21 876. Middle of the Linked List java (0) 2022.12.21 🎵 557. Reverse Words in a String III java (0) 2022.12.20