Wrong editorial Solution in java

interview-questions
amazon
Tags: #<Tag:0x00007f182496a6e8> #<Tag:0x00007f182496a558>

#1

The first editorial solution given in java fails for test case:
5.0.0.1
5

for code:
private int solve(final List l1, final List l2, final int i) {
if (i >= l1.size() && i >= l2.size())
return 0;
if (i >= l2.size())
return l1.get(i).compareTo(BigInteger.valueOf(0));
if (i >= l1.size())
return -l2.get(i).compareTo(BigInteger.valueOf(0));
final int res = l1.get(i).compareTo(l2.get(i));
if (res == 0)
return solve(l1, l2, i + 1);
return res;
}