-
389. Find the Difference javaLeetCode_Study_Plan/Programming Skills 2022. 9. 21. 15:28
https://leetcode.com/problems/find-the-difference/
class Solution { public char findTheDifference(String s, String t) { char[] s_arr = s.toCharArray(); char[] t_arr = t.toCharArray(); Arrays.sort(s_arr); Arrays.sort(t_arr); for (int i = 0; i < s_arr.length; i++) { if(s_arr[i] != t_arr[i]){ return t_arr[i]; } } return t_arr[t_arr.length-1]; } }
'LeetCode_Study_Plan > Programming Skills' 카테고리의 다른 글
709. To Lower Case java (0) 2022.09.22 [Programming Skills I] 이틀 뒤, 중간 점검 (2) 2022.09.21 1678. Goal Parser Interpretation java (1) 2022.09.21 1768. Merge Strings Alternately java (1) 2022.09.21 566. Reshape the Matrix java (1) 2022.09.21