Problem :
My function accepts the two arrays of integers and returns true if below conditions are met
1. Arrays have the same length and
2. Each m.element should be less than each n.element of the same index
All my test cases are passing except when int[] m = {1, 2, 3} and int[] n = {4, 5, 1}.
It is returning true even if m[2] > n[2]. Here digitDifference check is not working correctly but I am not getting any error.
Please find below my code:
public static boolean ArrayLess(int[] m, int[] n) {
int j = 0;
boolean sameLength = (m.length == n.length);
boolean digitDifference = (m[j] < n[j]);
for (j = 0; j <= m.length - 1; j++) {}
return (sameLength && digitDifference);
}