mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 16:47:55 +00:00
15 lines
323 B
JavaScript
15 lines
323 B
JavaScript
async function findLISLength(nums) {
|
|
if (!nums?.length) return 0;
|
|
|
|
const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array');
|
|
|
|
const tails = [];
|
|
|
|
for (const num of nums) {
|
|
const pos = bisectLeft(tails, num);
|
|
tails[pos] = num;
|
|
}
|
|
|
|
return tails.length;
|
|
}
|
|
export default findLISLength; |