← Back to topics
Topic

Z-Passwd

A
Al3kSaNdaR
I think that i need to use binary search to solve this problem because of the time limit. Can someone explain to me binary search?

[ Moze i na srpskom. :) ]
b
boba5551
This should help
http://en.wikipedia.org/wiki/Binary_search
T
Tavo92
You can use a STL container that implements a binary search (Or containes of other the lenguague you use). The examples are a set and a map.
p
pr0ton
i used a set and put elements into the set for first half, in second half u check if the elements are there, really fast.

u can also use the inbuilt binary search in <algorithm> header. :D
A
Al3kSaNdaR
I've solved it finaly. :)

Little hint : If array A is [ aleksandar, ivanovic ] and array B is [ aleksandar, aleksandar ] you should output 2 instead of 1. :)