We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
len(K) tells us how many characters there are in K.
We subtract 1 because indices in Python start from 0, so the last index of the match will be match.start() + len(K) - 1.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Re.start() & Re.end()
You are viewing a single comment's thread. Return to all comments →
match.start() + len(K) - 1
len(K) tells us how many characters there are in K. We subtract 1 because indices in Python start from 0, so the last index of the match will be match.start() + len(K) - 1.