python Programming Glossary: bcamel
How to improve performance of this code? http://stackoverflow.com/questions/4295799/how-to-improve-performance-of-this-code sys 0m0.020s Here's the code import Queue fCamel 'F' bCamel 'B' gap 'G' def solution formation return len i for i in formation.. len i for i in formation formation.index fCamel 1 if i bCamel 0 def heuristic formation fCamels score 0 0 for i in formation.. score 0 0 for i in formation if i fCamel fCamels 1 elif i bCamel score fCamels else pass return score def getneighbors formation..
|