# python 2+2 or 3+1->C34*C32*5*5*5+C42*5*5*5=1500+750=2250

• '''

``````def judgePoint24(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
def dd(a,b):

return [a+b,max(a-b,b-a),a*b,a/b if b!=0 else a,b/a if a!=0 else b]
def ddd(x):
a=x[0]
b=x[2]
c=x[1]
return [j for i in dd(a,b)for j in dd(c,i)]+[j for i in dd(a,c)for j in dd(b,i)]+[j for i in dd(c,b)for j in dd(a,i)]
def ha31():
for  i in range(4):
for k in ddd(nums[0:i]+nums[i+1:4]):
for m in dd(k,nums[i]):
yield m
def ha22():
f=[]
for i in range(3):
for j in range(i+1,4):
for k in dd(nums[i],nums[j]):
c=nums[:]
c.pop(i)
c.pop(j-1)
for m in dd(c[0],c[1]):
for p in dd(k,m):
yield p
for i in ha22():
if i==24:
return True

for i in ha31():
if i==24:
return True
return False
``````

'''

• This post is deleted!

• This post is deleted!

• so smart! I can hardly understand u. NBNB follow u.

• It's not quite correct. For `[3, 3, 8, 8]` it returns `False`, but that case does have a solution.

Your last seven lines btw can be written just like this:

``    return 24 in ha22() or 24 in ha31()``

• @StefanPochmann thanks for giving advice.But I find 24=8/(3-8/3),and my Solution returns True,So it's quite correct still now.

• @1120131418 No, it's not correct. When you say it returns True for that case, you mean in Python 2, right? But there it's wrong for other cases. You shouldn't even be testing it with Python 2, since it's clearly not meant for that.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.