Share My Submission URL?

How do I share my submission? I clicked on the user profile icon, then clicked Submissions, then clicked my latest submission. I was able to view the submission at this URL:
https://leetcode.com/submissions/detail/302104088/

I copied that URL and sent it to my friend for review. But my friend had to register and then got a 404 from that URL.

How can I share my submission with my friend?

Thank you.

https://leetcode.com/problems/longest-substring-without-repeating-characters/solution/

I need to study the given solutions. It's in a language I've mostly forgotten and I don't understand them. I don't understand the time complexity or O notation.

function lengthOfLongestSubstring(s) {
    let longest = 0;
    if(s === "") return 0;
    
    return mainLoop();
    
    function mainLoop() {

        for(let cursor = 0; cursor < s.length; ) {
            const lookahead = findLongestSubstring(cursor); //{1,a}, {2,a}, {1,b}, 
            if(lookahead > longest) {
                longest = +lookahead;
            }
            // console.log('cursor='+cursor, lookahead)
            const nextStartPosition = s.indexOf(lookahead.char, cursor)+1;
            cursor = nextStartPosition;
            //console.log('cursor='+cursor, '(after)');
            if(cursor === -1 || longest >= s.length - cursor) {
                return longest;
            }
        }

        function findLongestSubstring(startIndex) {
            const charMap = {};
            let substringLength = 0;
            let currentChar;
            for(let j = startIndex; j < s.length; j++) {
                currentChar = s[j];
                if(currentChar in charMap) break;

                charMap[currentChar] = true;
                substringLength++;
            }
            const lookahead = new Number(substringLength);
            lookahead.char = currentChar;
            // console.log('jloop returning:', lookahead)
            return lookahead;
        }
    }
};
Comments (0)