I\'m posting this although much has already been posted about this question. I didn\'t want to post as an answer since it\'s not working. The answer to this post (Finding th
If we use mathematics, the complexity will come down and will be able to find rank quicker. This will be particularly helpful for large strings.
(more details can be found here)
Suggest to programmatically define the approach shown here (screenshot attached below) given below)