mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
15 lines
328 B
JavaScript
15 lines
328 B
JavaScript
const findLISLength = async (nums) => {
|
|
if (!nums?.length) {
|
|
return 0;
|
|
}
|
|
|
|
const { bisectLeft } = await import("https://cdn.jsdelivr.net/npm/d3-array@3");
|
|
|
|
const tails = nums.reduce((sub, num) => {
|
|
sub[bisectLeft(sub, num)] = num;
|
|
return sub;
|
|
}, []);
|
|
|
|
return tails.length;
|
|
};
|
|
export default findLISLength; |