# Help needed in Binary Matrix CF 884F

Hello, I am facing WA in test 7 in problem Binary Matrix. Here’s my submission. Can anyone tell me what is wrong in my solution, or provide helpful test cases?

1 Like

@taran_1407

ur code gives output 4 for this test case : :

3 16

9CFD

E9A7

9BAF

hope this helps , as i don’t know java so i cant figure out the bug …

1 Like

10 4
B
9
D
5
D
B
9
D
5
7

1011
1001
1101
0101
1101
1011
1001
1101
0101
0111

### Expected Output: 1

You have logical error probably…

1 Like

Can Anyone help??

anyone??

will reply error soon… I guess its related to conflicting roots or something of that type… let me check it thoroughly…

try this one too ::

10 24

174094

882455

171152

761423

221685

761892

795431

233411

387427

793198

1 Like

#### GOT ERROR

check set after
2 4
D
5

i.e.
1101
0101

so after D
set[0-3] becomes :
0012

and then you will assign
4567 to set[4-7] for 5

now for union query
union(set,3,7)

You will do find(3)
set[3]=find(set[3)) = find(2)
find(2)
set[2]=find(set[2))= find(0)
set[0]=0

so basically all will point to zero i.e set[0-3]=0000 … which was not intended… it should remain 0012 no matter what you do…

1 Like

as I said earlier it’s about conflicting and wrong assignment of value to root… Due to uniq function…

Thanks a lot for test case, let me try debugging. Will ping here if can’t debug.

1 Like

Thanks for test cases, man.

sure… welcome