Skip to content

15-Ab/Leetcode-Daily-Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leetcode Daily Challenge Solutions

This is my attemp to make the coding experience easir for you guys so that you can easily learn what to do in today's leetcode challenge.

Preview

Todays 31-12-23

class Solution {
    public int maxLengthBetweenEqualCharacters(String s) {
        int msl = -1; // maximum substring length
        HashMap<Character, Integer> m = new HashMap<>();
        for( int i = 0; i < s.length(); i++){
            if( m.containsKey(s.charAt(i))){
                msl = Math.max( msl, i - m.get(s.charAt(i)));
            }
            else{
                m.put(s.charAt(i), i+1);
            }
        }
        return msl;
    }
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy