0 out of 464 challenges solved

Decimal to Binary Conversion

Write a function `decimal_to_binary(n)` that takes an integer `n` as input and returns its binary equivalent as a string without leading zeros. The function should handle non-negative integers only.

#### Example Usage
```python [main.nopy]
print(decimal_to_binary(8))  # Output: '1000'
print(decimal_to_binary(18)) # Output: '10010'
print(decimal_to_binary(7))  # Output: '111'
```

#### Constraints
- The input `n` will be a non-negative integer.
- The output should be a string representing the binary equivalent of the input number.
def decimal_to_binary(n):
    """
    Convert a decimal number to its binary equivalent as a string.

    Args:
    n (int): A non-negative integer.

    Returns:
    str: The binary representation of the number without leading zeros.
    """
    # Replace the following line with your implementation
    pass