 What's up guys, my name is Michael and welcome to my YouTube channel today. We're gonna do another lead code challenge It's called the lead comms to make sorted Excuse me. I'm still kind of sick, but this is what we're gonna do. Okay, so essentially you're given an array of strings of All that are the same length and they're lowercase letter strings basically you They're saying is that Given like a set of indices After you could delete Whatever is inside of the array Based on the indices. So they're saying is that we have an array a bcdf uvw xyz right and if I pass in the indices 0 2 3 They're gonna delete the index at 0 2 and 3. So they deleted See, what do they delete? 0 which is the space they deleted that 0 1 2 3 wait, hold up and deletion and then the final okay, so 0 So they deleted a okay as 0 for some reason they're removing all the spaces, but okay, let's think about that later. They deleted a as 0 0 1 2 they deleted c which was the second end of c 0 1 2 3 and they deleted d Which is the third end of c and they did that for this string also So that's why this the string spat out be f because they deleted they deleted the Indicities at 0 2 and 3. Okay, and The remaining columns of a are b v e y f and z. Okay, so yeah, that's what they're saying here But now let's suppose we choose a set of deletion indices d such that after deletions each remaining column is in I Don't know why they say non-decreasing word. That's just increasing order. So Suppose that we have a set of Indices such that after deleting it's an increasing order increasing sorted order now return the minimum possible value of d dot length So essentially this question is actually not that hard if you think about it They are trying to confuse you Okay, they are trying to confuse you with all this jargon here because technically you don't have to delete You don't actually have to you're not actually passing in an array of indices to delete They just want you to given a set of indices d such that after deletions It's an increasing order. So they want you to return. They just want to return the length of that set That after the deletions it's an increasing order. So now I'll tell you my solution and basically this is actually really easy so Because we don't actually have to We don't actually have to Delete these indices So technically all you have to do is just have an array or not array and a Counter called answer or whatever counter Just go through your Your array of strings go through every single character and just check if The value of the next one the next character Based on the row and column right based on the row and column if whatever value is greater than Current column is greater than the one next to it It's gonna add the value and then it's gonna return it Right. It's gonna add it. It's gonna break out of this loop and then it's gonna return the answer. So essentially this will basically get Essentially so let's go through the solution So if for each column check if it's sorted if it isn't it must be deleted So then we add one to the final answer. That's basically how you would do it So check if ever for every column just check if It's sorted if it's not if the column isn't sorted and it isn't the final answer That's essentially what we're doing here We're giving an array of the values and we're trying to make delete the columns to make it sorted So if it's not sorted it must be deleted. So in this case if it's greater than Whatever if the current column is greater than then the next column Add the values and then break out of this loop and go to the next column. That would basically just check if Your current value it would basically get all the values that are not sorted Okay, all the columns that are not sorted and That's basically how you do this because you're just trying to get The minimum possible length of the number of columns that are not sorted That's basically what it is after lesion this is that's what this is This is just really it's this is just trying to confuse you. But yeah Anyway, right calm subscribe. I hope this video made sense. I'm really really sick right now But I'm just trying to grind these videos out and then yeah We calm subscribe to you guys later