Co-authored-by: Mikael CAPELLE <mikael.capelle@thalesaleniaspace.com> Co-authored-by: Mikaël Capelle <capelle.mikael@gmail.com> Reviewed-on: #3
13 lines
294 B
Python
13 lines
294 B
Python
from typing import Any, Iterator
|
|
|
|
from ..base import BaseSolver
|
|
|
|
|
|
class Solver(BaseSolver):
|
|
def solve(self, input: str) -> Iterator[Any]:
|
|
floor = 0
|
|
floors = [(floor := floor + (1 if c == "(" else -1)) for c in input]
|
|
|
|
yield floors[-1]
|
|
yield floors.index(-1)
|