1
// in this i have iterated for every column and then for every string2
// i have used array arr[101] in order to store wich indices are valid and which3
// are not i have taken an array of positions(vector) done[101] to find at which4
// previous locations i found this particular (jth index string ) to be smaller9
int arr[101] = {0}; // arr is to check which columns are valid(0) and invalid(-1)10
vector<int> done[101]; // where u found string j was greater than string j+111
// ,u put it into vector13
// below is a helper function in order to check all the locations (at which14
// string j has been classified as done ) are still present or not15
bool check(vector<int> &a) {23
int minDeletionSize(vector<string> &strs) {25
// for iterating columns26
for (int i = 0; i < strs[0].size(); i++) {27
// for iterating the strings28
for (int j = 0; j < strs.size() - 1; j++) {29
if ((done[j].size() == 0 || check(done[j]) == 0) && strs[j][i] > strs[j + 1][i]) {31
arr[i] = -1; // make the column invalid34
if (strs[j][i] < strs[j + 1][i]) {35
done[j].push_back(i); // here we are storing at which index (i) said string j is ok