Help in a problem

I’m solving this problem from infytq. If someone is unable to see problem its in Day-7 > Practice problems > level-3 > problem-12, But I’m only getting 3 test cases pass out of 6. Can somebody help me in this? Its a fairly easy problem.

This is my solution in python-

def count_ways(n):

    if n==0:
        return 0
    totalwayspossible = 2**n
    buildingswithnospaces = int((n*(n-1))/2)
    buildingswithspaces = int(totalwayspossible - buildingswithnospaces)
    ans = buildingswithspaces**2
    return ans

n= 2
print("Number of possible ways in which buildings can be constructed is: ",count_ways(n))

Please help!

1 Like

please paste the question here

Probably this will help: :slight_smile: