We have to sort Lexicographically.
First we will sort based on 1st character of each string.
This will take O(nlogn) time as there are n Strings in total (thus ‘n’ number of 1st characters)
In the Worst Case i.e. the situation like abbcd, abbcf, abbcb , abbce, abbca
Here we have 5 strings of 5 characters each.
Each string has all first 4 characters same, therefore we have to sort based on last digit here
Now O(nlogn) was for 1st character of strings, Similarly we will sort 2, 3, 4, …. n times (here n is for sorting based on last digit)
So, n * O(nlogn) = O(n^2 logn)
Option B is correct.