# I think it's a bug, if you run the code in Run code mode, the result is 3, but you submit the solution, the output is 4?

• python solution, same code, different result

``````class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None

class Solution(object):
def copy(self, ary):
rs = []
for item in ary:
rs.append(item)

return rs

def __init__(self):
self.content = []
self.content2 = []

def collect2(self, node, ary = []):
ary.append(node.val)
self.content.append(self.copy(ary))
ary0 = [node.val]

if ary != ary0:
self.content.append(ary0)

if node.left is not None and node.right is None:
self.collect2(node.left, self.copy(ary));
if ary != ary0:
self.collect2(node.left, self.copy(ary0));

if node.right is not None and node.left is None:
self.collect2(node.right, self.copy(ary));
if ary != ary0:
self.collect2(node.right, self.copy(ary0));

if node.right is not None and node.left is not None:
self.collect2(node.left, self.copy(ary));
self.collect2(node.right, self.copy(ary));

if ary != ary0:
self.collect2(node.left, self.copy(ary0));
self.collect2(node.right, self.copy(ary0));

def uniq2(self):
dict = {}

for i in self.content:
if len(i) > 1:
self.content2.append(i)
else:
dict[i[0]] = 1

for key in dict:
self.content2.append([key])

def pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: int
"""
if root is None:
return 0

self.collect2(root)
self.uniq2()

count = 0
print self.content
for s in self.content:
s2 = 0
for i in s:
s2 += i

if s2 == sum:
count += 1
print s

return count
``````

below is my test code, you can also run the code in run code mode
input
[5,4,8,11,null,13,4,7,2,null,null,5,1]
22

``````n60 = TreeNode(5)
n61 = TreeNode(4)
n62 = TreeNode(8)
n63 = TreeNode(11)
n64 = TreeNode(13)
n65 = TreeNode(4)
n66 = TreeNode(5)
n67 = TreeNode(7)
n68 = TreeNode(2)
n69 = TreeNode(5)
n70 = TreeNode(1)

n60.left = n61
n60.right = n62
n61.left = n63
n63.left = n67
n63.right = n68
n62.left = n64
n62.right = n65
n65.left = n69
n65.right = n70

solution = Solution()
print solution.pathSum(n60, 22)
``````

In my computer and leecode run code mode, the result is 3, but if you submit, the result is 4? I think it's a bug

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