class Finder { public: int findString(vector<string> str, int n, string x) { // write code here int start =0; int end = n-1; while (start <=end) { int mid = (start +end) /2; if(str[mid] == x) return mid; if(str[mid].empty()){ int mid1=mid,mid2=mid; while (str[mid1].empty() && mid1 >= start) { --mid1; } while (str[mid2].empty() && mid2 <=end) { ++mid2; } if(str[mid1] == x){ return mid1; } if(str[mid2] == x) { return mid2; } if (str[mid1] >x ){ end = mid1-1; continue; } if(str[mid2] <x){ start = mid2 +1; continue; } continue; } if(str[mid]> x) { end = mid -1; continue; } if(str[mid] <x){ start = mid+1; continue; } } return -1; } };