Cisco interview question

Stair Case Problem, Binary Search String regex related coding