Leetcode 389. Find the Difference
·
Algorithm
You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. 두 개의 문자열인 s와 t가 주어졌다. 문자열 t는 문자열 s에서 랜덤하게 하나의 문자가 추가된 것이다. 문자열 s에서 추가된 문자를 리턴하라. 두 문자열을 비교해 다른 문자를 찾아내는 문제였다. 문자열을 배열로 만들고 for문으로 순회하며 다른 값을 찾는다면 리턴하고자 했다. var findTheDifference = function(s, t) { if(!s) return t; const sA..