算法空间/Leetcode/二维数组中的查找:修订间差异
来自康健生活
无编辑摘要 |
|||
| 第19行: | 第19行: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== 暴力解法 === | |||
<syntaxhighlight lang="javascript"> | |||
const f = (matrix, target) => { | |||
let bool = false; | |||
matrix.map(arr => { | |||
let i = arr.findIndex(o => o === target); | |||
if (i !== -1) bool === true | |||
}); | |||
return bool; | |||
}</syntaxhighlight> | |||