Ray so my end is already I’m out of bounds mo my start isn’t let’s think of a test case that actually has that mmm it was a good way to make sure that my end is already done because let’s think about this is it ever the case that my actual longest substring is going.
To be something at the very end yes right but I’m not sure what the value of start would be in this so okay let’s go with what I said the bunch of a is and then it B I can just make the shorter to go through it quicker so first time through my found.
Is added or AIDS added to found I move up now I see that it’s the same value so.
My start and end are both index one next time through my I’ll get at the position again where my start and end right index to and so here my start is already at the position that I want it’s at index two my end is going to move forward once and it’s going to say you know I am.
Going to add B to the set and then next time through okay I see there was an air with this what I ended up saying here was that my longest is going to be length one but that’s not true my longest is length two and the reason that doesn’t work out is because I don’t actually have I.
Actually have a branch to handle when end.
Goes outside of the length yeah in your while loop you can actually test for your end instead of the start yeah I think they might I think that makes a lot more sense just because the the only time that the end will the only time that.
Run is when you know I don’t have a valid substring right without repeats and it is impossible for my value for start to get larger than my value for end so I think this fixes that but I still have an off by one in the sense that when I get to the end yeah I can remove this but when I get to the end I’m not actually a you know.
Checking the final set right so let’s say I have a longest up string that is this it’s just a bunch of A’s well I get the correct answer yes in this version it is it’s okay so the last case is still alone they don’t want to check I’m thinking it might be fair to.
Say that my long I can just see.
Longest people’s Max’s longest , and might have start but I don’t think that’s necessarily true I don’t think you require to check the longest again it just.
Whatever you have before it checks even if your longest ringing is towards the end of your array.
Yeah oh yeah okay I yeah I made a what is it a typo when I.
In my head when I was doing this in the example of a be my end is incremented first and then I do the check so you’re right the example of a a a B will return to correctly I thought I did that the other way around for a.
Second yeah you had your while you’re starting with oculus and it might be but yeah so I think this ends up being my final solution the only things you need to check for our edge cases such as the empty array and if that’s the case I just don’t you know I don’t go through.
The loop at all right and I just return 0 in the other case if I actually get invalid input of none cool so yeah should I run this we just detergent I’m not familiar with writing in Python but because if s is none does it handle both empty and null keys if s is none that only handles the the null case the while end is less than Lenna bass that’ll cover the empty case so s is equal to this no we’re down yeah is it okay if.
I run this hmm actually forgot it’s like I’m not sure if I can actually.
Uh I just forget if you can actually operate with strings in Python cool so we gave three which is a correct port in cases I want to cover our empty string and the a B cool so those both worked out and I think that should be most.
Of the cases the other one I can think of it was just all A’s reasoning through the code I think this should work out cool okay this one went pretty well shall we go with the next question okay let’s see you know have the IP addresses are.
You know for example being four octaves yes it has four octave like you said and everything has digits between only maximum three digits only values between 0 and 255 okay only then it is considered a value valid IP address so 255 dot 255 dot dot but let’s say it has 300 then it is not going to say something like 300 dot 38.9 dot this is invalid because any flood cannot have a value.
Which is greater than 255 right sorry just kidding again you’re saying that the range is just a 1 – 2 – 5 you don’t do the super duper I gotta make sense because that’s exactly where IP ranges go cool ok so from my understanding of this question what I’m basically doing or what I’m getting is I have an input string that could be.
Of any length and sorry yeah it could be of any length okay and basically what I want to do is parse through and determine in which locations I can actually place the dots in order to separate it so in this example I got 255 255 11 and then 135 the alternative option is to do 111 and 35 okay just thinking through ideas I figured that using recursion and this is probably.
Going to be relevant is it always the case that I want to break it into 1 space 2 space and three space segments I think so so as a naive option what I think I.
Can try and do is let’s say I have my input string and what I would do is I’m gonna say I’m gonna pick putting a dot after one character after two characters or after three characters and then that’s my first segment and then i recurse on this four times and at each of the steps each.
Of the recursive calls i would just want to check oh is this a.
Valid you know is this a valid IP or not IP is this a valid range if yes continuing the recursive calls if it isn’t then you know just just backtrack this.
Definitely works as a solution it’s going to end up having.
A pretty insane complexity of say like it’s exponential I want to say it’s three to.
The end but is that actually true if I define n is the length of the input like if I know you had let’s think let’s see you have to sit down and write down all the IP addresses ever possible how many IP addresses would there be possible it’s at a finite number yeah that’s a pretty finite number so that’s why that 3 to the N doesn’t.
Sound entirely correct just because like if I think of it in terms of the branches in a you know the recursive call tree then you know it is but there’s a.
Limit to how far that can go right and I’m only going down to I’m.