Explorar el Código

Speed up day 20

Taddeus Kroes hace 7 años
padre
commit
6ed92c05d9
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      20_regex.py

+ 1 - 1
20_regex.py

@@ -32,7 +32,7 @@ def shortest_paths(graph, source):
     dist[source] = 0
 
     while Q:
-        u = min(Q, key=lambda x: dist[x])
+        u = min(Q, key=dist.__getitem__)
         Q.remove(u)
         for v in graph[u]:
             if v in Q: