Heres pseudocode for arrays:
input data in array
find x with for to match first column (legalForBlack[i][0])
if x matches legalForBlack[i][0] check if legalForBlack[i][1] matches y
if not continueyes, else quitcount forit
But there is a better way, when you just want to check if they are in array. Create object Pair
with variable x
and y
, create equals()
and hashCode()
functions to have unique for each pair (like get hashCode
from string xy
), place all inputs in Set
and then check if given Pair(x,y)
is in Set
.