# 2351. First Letter to Appear Twice ###### tags: `Leetcode` `Easy` Link: https://leetcode.com/problems/first-letter-to-appear-twice/description/ ## Code ```java= class Solution { public char repeatedCharacter(String s) { boolean[] exists = new boolean[26]; for(int i=0; i<s.length(); i++){ if(exists[s.charAt(i)-'a']) return s.charAt(i); exists[s.charAt(i)-'a'] = true; } return 'a'; } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up