Accenture Interview Question

Logic for Bubble search