Bridges problem
Fix bridges solution, optimize ugly numbers solution