Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you handle target - num = num case #102

Open
Werror opened this issue Apr 16, 2016 · 1 comment
Open

How do you handle target - num = num case #102

Werror opened this issue Apr 16, 2016 · 1 comment

Comments

@Werror
Copy link

Werror commented Apr 16, 2016

If we have [1 10 50 90] and we trying to find 100.
Wouldn't map find return the 50 which have just inserted already?

Thanks,
Werror

@Demisemyth
Copy link

In a map, each element is associated with a key-value pair, and it allows efficient retrieval of values based on their keys.

If you have a std::map with keys [1, 10, 50, 90], and you are trying to find the element associated with the key 100, the map::find function would return an iterator pointing to the end of the map (i.e., map.end()). It wouldn't modify the map or insert any new element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants