-
Notifications
You must be signed in to change notification settings - Fork 5
searchAdjacentDuplicateValue
Subhajit Sahu edited this page May 3, 2023
·
1 revision
Find first index of an adjacent duplicate value.
function searchAdjacentDuplicateValue(x, fc, fm)
// x: an array
// fc: compare function (a, b)
// fm: map function (v, i, x)
const xarray = require('extra-array');
// Example for searchAdjacentDuplicateValue
var x = [1, 2, 3, 4, 5];
xarray.searchAdjacentDuplicateValue(x);
// → -1
var x = [1, 2, 3, 3, 4, 5];
xarray.searchAdjacentDuplicateValue(x);
// → 2