3 ms·
Actually your C++ solutions is O(N log N) since you are using `std::map`. If you need to remove that extra log factor what you need to use is `std::unordered_m
by dottomato 6y ago
Actually your C++ solutions is O(N log N) since you are using `std::map`. If you need to remove that extra log factor what you need to use is `std::unordered_map`
std::map::find - http://www.cplusplus.com/reference/map/map/find/ http://www.cplusplus.com/reference/map/map/find/
std::unordered_map::find - http://www.cplusplus.com/reference/unordered_map/unordered_map/find/ http://www.cplusplus.com/reference/unordered_map/unordered_m...
Your Golang soln is O(N) still, since maps in Go lang are hashmaps.
dottomato