Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==22018==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000000168 at pc 0x00000051bf35 bp 0x7ffed4941d20 sp 0x7ffed4941d18 READ of size 8 at 0x606000000168 thread T0 #0 0x51bf34 (/out/package/pre1+0x51bf34) #1 0x51c614 (/out/package/pre1+0x51c614) #2 0x51c62d (/out/package/pre1+0x51c62d) #3 0x51c5cc (/out/package/pre1+0x51c5cc) #4 0x52361d (/out/package/pre1+0x52361d) #5 0x7f5dac9b8b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #6 0x41f559 (/out/package/pre1+0x41f559) 0x606000000168 is located 40 bytes inside of 56-byte region [0x606000000140,0x606000000178) freed by thread T0 here: #0 0x518738 (/out/package/pre1+0x518738) #1 0x51c651 (/out/package/pre1+0x51c651) #2 0x51c62d (/out/package/pre1+0x51c62d) #3 0x51c5cc (/out/package/pre1+0x51c5cc) #4 0x5235ef (/out/package/pre1+0x5235ef) #5 0x7f5dac9b8b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) previously allocated by
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
Simple tree test. find path: 1 10 sum: 15 depth: 3 allPathSumGreater: 0 1 covered_by: 0 contained_by: 1 traversal: 6 3 3 1 2 3 312 1 12 2 3 1 2 3 6 copy: passed
JOJ Answer
Simple tree test. find path: 1 10 sum: 15 depth: 3 allPathSumGreater: 0 1 covered_by: 0 contained_by: 1 traversal: 6 3 3 1 2 3 312 1 12 2 3 1 2 3 6 copy: passed