You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subhajit Sahu edited this page May 3, 2023
·
1 revision
Find first index of an adjacent duplicate value.
functionsearchAdjacentDuplicateValue(x,fc,fm)// x: an array// fc: compare function (a, b)// fm: map function (v, i, x)
constxarray=require('extra-array');// Example for searchAdjacentDuplicateValuevarx=[1,2,3,4,5];xarray.searchAdjacentDuplicateValue(x);// → -1varx=[1,2,3,3,4,5];xarray.searchAdjacentDuplicateValue(x);// → 2