Well I encountered this problem when I was practicing my DSA, so here I will share how its stored in my mind. In this article, we will look at how to compute the index using pointers returned by STL functions. It will be explained in such a way that even a 4th grader would get it.
Table of contents
IntroductionProblem statementReason for this behaviorHow to solve this issue?
4.1 Solution 1 (Subtracting the starting iterator)
4.2 Solution 2 (Using std::distance())Implementing the solutionsT...
Published on December 11, 2022 07:21