LeetCode – 389. Find the Difference

Given two strings s and t which consist of only lowercase letters.

String t is generated by random shuffling string s and then add one more letter at a random position.

Find the letter that was added in t.

Example:

Input: s = 'abcd' t = 'abcde' Output: e Explanation: 'e' is the letter that was added.  

public class Solution { public char findTheDifference(String  s, String  t) { int[] chars = new int[26]; for(int i=0;i 

This siteOriginal articleAll follow "Attribution-NonCommercial-ShareAlike 4.0 License (CC BY-NC-SA 4.0)Please retain the following annotations when sharing or adapting:

Original author:Jake Tao,source:「LeetCode – 389. Find the Difference」

131
0 0 131

Further Reading

Post a reply

Log inYou can only comment after that.
Share this page
Back to top