fixes
This commit is contained in:
parent
bd7ba9e200
commit
3147fbeb94
|
|
@ -20,10 +20,13 @@ export function findRepeatedSubsequences(s: string[]): { sequence: string[]; cou
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
const arraysEqual = (a1: string[], a2: string[]) => {
|
const arraysEqual = (a1: string[], a2: string[]) => {
|
||||||
if (a1.length !== a2.length) return false;
|
if (a1.length !== a2.length)
|
||||||
|
return false;
|
||||||
for (let j = 0; j < a1.length; j++) {
|
for (let j = 0; j < a1.length; j++) {
|
||||||
if (a1[j] !== a2[j]) return false;
|
if (a1[j] !== a2[j])
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -41,9 +44,9 @@ export function findRepeatedSubsequences(s: string[]): { sequence: string[]; cou
|
||||||
while (
|
while (
|
||||||
i + p * k <= n &&
|
i + p * k <= n &&
|
||||||
arraysEqual(s.slice(i + p * (k - 1), i + p * k), substr)
|
arraysEqual(s.slice(i + p * (k - 1), i + p * k), substr)
|
||||||
) {
|
)
|
||||||
k += 1;
|
k += 1;
|
||||||
}
|
|
||||||
k -= 1; // Adjust k since it increments one extra time in the loop
|
k -= 1; // Adjust k since it increments one extra time in the loop
|
||||||
|
|
||||||
// Update the maximal repeating substring if necessary
|
// Update the maximal repeating substring if necessary
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { parseStackTraceLine } from '../utilsBundle';
|
import { parseStackTraceLine } from '../utilsBundle';
|
||||||
import { isUnderTest } from './';
|
|
||||||
import type { StackFrame } from '@protocol/channels';
|
import type { StackFrame } from '@protocol/channels';
|
||||||
import { colors } from '../utilsBundle';
|
import { colors } from '../utilsBundle';
|
||||||
import { findRepeatedSubsequences } from './sequence';
|
import { findRepeatedSubsequences } from './sequence';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue