LeetCode Exercise In Java - Longest Substring Without Repeating Characters - FAST Solution

preview_player
Показать описание
Full tutorial for solving the LeetCode longest substring without repeating characters problem in Java!

00:00 The Problem
03:51 Brute Force Solution Discussion
07:27 Brute Force Solution Implementation
15:57 Brute Force Solution Results
16:35 Coming Up With a Better Solution
20:09 Fast Solution Discussion
26:50 Fast Solution Implementation
32:34 Fast Solution Results
33:21 Even... FASTER?

☕Complete Java course:

Are you starting to grind LeetCode in Java, but getting stuck on the how to figure out some of the trickier fast solutions?

In this video we'll walk through a fast solution for the LeetCode longest substring without repeating characters problem, LeetCode Problem #3, written in Java!

📕 THE best book to learn Java, Effective Java by Joshua Bloch

📕 One of my favorite programming books, Clean Code by Robert Martin

🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial

🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)

📹Camera I use for recording:

🎙️Microphone I use (classy, I know):

Donate with PayPal (Thank you so much!)

☕Complete Java course:

Рекомендации по теме
Комментарии
Автор

Looking forward to seeing how you guys make this solution even better!

CodingWithJohn
Автор

You genuinely have one of the best programming explanation videos on this site, honestly. Funny, I was discussing learning about the Sliding Window algorithm to practice Leetcode questions with a friend yesterday, and lo and behold you've uploaded a great explanation literally 24hrs later, legendary! Could you please upload more Leetcode explanation questions? If not on Youtube, perhaps a course?

nahomg
Автор

please keep doing these, your explanations are so much more in depth than other youtube channels

vijal-patel
Автор

I had just solved this problem and found this video. You explained each solution and your approach in the best way. Your way to explaining make things crystal clear John !!

jayshreebargohil
Автор

John, you are a wizard. Everythings looks so logical and simple. Please make more videos like this.

thomas_m
Автор

More leetcode videos plzzz! love this series.

blairliu
Автор

Would love to watch a complete java dsa course from you

claytonalmeida
Автор

This is probably one of the best tutorials out there and i think YouTube is with me in this.❤️ I could you not, even though I have watched it already it is every time the first video in my recommended 😂
Guess I'll watch it twice. Keep up the good work!

tund__hd
Автор

An excellent in-depth explanation of two approaches to solving this problem. Thank you very much, John.

minakianrad
Автор

A unique way of explanation, clear concise.

gauravmehta
Автор

You have to be careful when using a MAP to lookup something because, even though its O(1) in time complexity, there is a lot of overhead. Let's say that the constant time for a lookup in a MAP is always 500 nanoseconds, if the indexOf (that has a time complexity of O(n)) takes only 300 nanoseconds because it finds the answer in the first few characters, then the indexOf will perform better. This obviously can be measured and we can come up with some threshold that tells us what algorithm to use in each situation. My guess is that in the English language indexOf will always perform better because we are dealing with words that are small in size (there is always the repeating space character).

tiagocarvalho
Автор

Great job, please keep posting the leetcode solution videos in structural manner(for eg top 50 that includes most practices/datastructures), this helps a lot in preparing for interviews.

rushio
Автор

You are really a coding geek. Even the concepts known, still visit them and keep something. Your explanations are far reaching. Thank you.

isaacwhiz
Автор

Hey John, I love all of your videos. Learning so many important skills. However, I have one suggestion, If you could make more of this type of problem-solving videos then it would be very helpful to the viewers as it will teach new programmers how to think of a solution to the given problem and how can we actually implement the solution using the programming language.

By the way thanks again for all efforts that you put in to make this possible.

Looking forward to seeing more problem-solving videos. Have a wonderful day.

ronakpatel
Автор

I appreciate that you go into the brute force solution and also the more clever solution. Thanks for these!!

Michaelpschreib
Автор

John I love your Java explanations, can you please add more leetcode to your channel or bootcamp? I would love to see more Java leetcode solution guides properly explained

elizabeth
Автор

I love the final thoughts on the differences of performance between the 2 last algorithms, answered all the questions I had to myself. Thnak you!

SimanAndGarfunkel
Автор

Great and in-depth explanation for every approach. I really liked this video. I have found another better approach
final int n = s.length();
int len = 0;
int [] repeat = new int[128];
for (int c = 0, j = 0, i = 0; j < n; j++) {
c = s.charAt(j);
i = Math.max(repeat[c], i);
len = Math.max(len, j - i +1);
repeat[c] = j+1;
}
return len;
I somewhat understood, but it would be better if you can explain. Thanks John and keep creating more videos for different problems.

shaileshsathe
Автор

It's great! Please, do more Leetcode Exercise explanations!🙏

lanatimmo
Автор

This is the most detailed and accurate explanation of this problem I've seen. 👍

kevolala
visit shbcf.ru