Trying to find a elegant way of finding adjacent element in a 2d array in a multi-direction

前端 未结 0 356
谎友^
谎友^ 2021-01-05 00:46

I want to find the neighboring element that surrounds p.

I know we can use brute-force approach, like this: array[i-1][i]

array[i-1][i-1]

array[i][i-1]<

相关标签:
回答
  • 消灭零回复
提交回复
热议问题