You are viewing a single comment's thread. Return to all comments →
PYTHON CODE At first i thought it'll be hard but it tourned out to be very simple
#!/bin/python3 import math import os import random import re import sys def count_substring(string): wynik = 0 wynik2 = 0 for i in string: if i == '1': wynik += 1 if wynik > wynik2: wynik2 = wynik else: wynik = 0 return wynik2 if __name__ == '__main__': n = int(input().strip()) liczba = str(bin(n)) print(count_substring(str(liczba)))
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
PYTHON CODE At first i thought it'll be hard but it tourned out to be very simple