Biggest Digit Product

Imagine a long string of digits as a tape with a window of length k moving across it. For each window, multiply all digits inside it and look for the largest product. Write a function largest_series_product that returns the maximum product among all groups of k consecutive digits in digits.

Примеры

Ввод
"12345", 2
Вывод
20
Ввод
"1027839564", 3
Вывод
270
Ввод
"73167176531330624919225119674426574742355349194934", 6
Вывод
23520

Нужно реализовать

def largest_series_product(digits: str, k: int) -> int:

Теги

stringssliding-window
PostgreSQLv16

Tukaj bo rezultat izvajanja kode

Visible tests
1
Input
"12345", 2
Expected20
2
Input
"1027839564", 3
Expected270
3
Input
"73167176531330624919225119674426574742355349194934", 6
Expected23520
4
Input
"99099", 2
Expected81
5
Input
"00000", 3
Expected0
6
Input
"123", 3
Expected6
Focus radio
Paused · SomaFM · Fluid