getStoryIndex function
Implementation
int getStoryIndex(List<int> listLengths, int index) {
index = index + 1;
int temp = 0;
int val = 0;
for (int i = 0; i < listLengths.length; i++) {
if (listLengths[i] >= index) break;
if (temp != listLengths[i]) val += 1;
temp = listLengths[i];
}
return val;
}