Chargement de l'exercice…
Binary notation writes a number using only 0 and 1, which is how data is ultimately stored and processed by computers. Write a function to_binary that converts a non-negative integer n into a binary string with no leading zeros. For 0, return the string 0.
0"0"1"1"5"101"def to_binary(n: int) -> str:
Connectez-vous pour voir l'historique des soumissions
Se connecterConnectez-vous pour utiliser le Mentor IA
Se connecter0"0"1"1"5"101"10"1010"255"11111111"256"100000000"