String t is generated by shuffling string s and then inserting one extra character at a random position. Return the extra character as a one-character String. Treat a null s as an empty string. Assume t is non-null and contains exactly one more character than s.

Examples:

Input: s = 'abcd', t = 'abcde' Output: 'e' Explanation: e is the extra character added to t Input: s = '', t = 'y' Output: 'y' Explanation: y is the only character, so it is the extra one Input: s = 'a', t = 'aa' Output: 'a' Explanation: One extra a was inserted, so the difference is a
Apex Code Editor

Welcome to Lightning Challenge!

How It Works

  • • Write your solution in the code editor
  • • Connect your Salesforce org to test
  • • Submit to check if your solution passes
  • • Use hints if you get stuck

Contest Alert

🏆 All Time Leaderboard

Contest runs January 1, 1970 - December 31, 9999. Complete challenges to climb the leaderboard!

Points are calculated for challenges completed during the contest period.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In