If they looked for cocaine then it would be found up to 6 weeks after you had taken the drug. I'm not sure if it has a build up effect, sorry. However , urine tests look for stuff your body produces having taken cocaine, so a pee test would be positive for about 3-5 days.
So basically a proper lab test would find it for 30 to 42 days. Oh and drinking lots of water and detoxing wont get rid of the cocaine but it might help a urine test.