starting from one which is of length four are there any others that come after it that are even longer than four or also are there any that come after that that can maybe create an lis that's even longer than four and if there are then we're obviously not gonna put four here we're gonna put that longer one maybe a NUMBER_TOKEN and then update the count accordingly or maybe there are other lisses over here that will also lead to us having an lis of exactly length NUMBER_TOKEN. in that case we'll take the counts of those and add them to the count over here or maybe there's gonna be lisses that are actually shorter than four and in that case which obviously is the case here we're not going to end up updating our account at all with those lisses because right now we found one we found exactly one lis of length four so that's what we're going to put here when we were looking at one and then going to three but we can also go to five where the lis is two two plus one is going to be three that's not greater than NUMBER_TOKEN another NUMBER_TOKEN over here and then a NUMBER_TOKEN over here so none of those are going to make a longer lis so this is our finished computation oh and whoops i actually just realized i made a mistake we're not actually putting a NUMBER_TOKEN here we should be putting a NUMBER_TOKEN here and the reason is because when we were looking here and then looking at the the next value we found that NUMBER_TOKEN plus NUMBER_TOKEN makes the lisb of length NUMBER_TOKEN and what we're going to do is actually take the count from here and then add that over here we're not just adding one we're adding the count from that lis so sorry if that was confusing uh but now knowing this how are we going to return the result well in this case the result is at index zero the longest lis is of length four how many are there there's two of them and that's what we were expected to return up above right you can see two and these are the two lisses but that's not always gonna be the case it's not always gonna be at index zero just imagine uh if the value over here instead of being a one was actually let's say a NUMBER_TOKEN right a NUMBER_TOKEN over here then what would be the lis starting from here it would not be of length NUMBER_TOKEN because all of these values that come after are actually smaller than NUMBER_TOKEN so the lis here would actually end up being NUMBER_TOKEN. so that's basically just to show you what a counter example would look like so the generic way to return the result here is going to be scan through this basically or as we are building this just maintain what the the max lis length actually is in this case it's four and then for that add up all the counts corresponding to that lis in this case there's only one but it could have been a different you know suppose this value actually didn't even exist and actually suppose this value didn't exist either in this case we have the max lis being of length two and there were actually two of them right there was one over here and one over here so what we would do is return the counts added up which would end up being two so after all of that we're actually finally ready to get into the code so let's do that before we continue with the video let me just
START_SPONSOR_TOKEN into the code so let's do that before we continue with the video let me just END_SPONSOR_TOKEN