Skip to content

Commit e54c64a

Browse files
committed
code cleanup
1 parent 5c2634f commit e54c64a

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/ts/others/balanced-symbols.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function parenthesesChecker(symbols: string) {
1010
let top: string;
1111

1212
while (index < symbols.length && balanced) {
13-
symbol = symbols.charAt(index);
13+
symbol = symbols[index];
1414
if (opens.indexOf(symbol) >= 0) {
1515
stack.push(symbol);
1616
// console.log(`open symbol - stacking ${symbol}`);
@@ -36,8 +36,5 @@ export function parenthesesChecker(symbols: string) {
3636
}
3737
index++;
3838
}
39-
if (balanced && stack.isEmpty()) {
40-
return true;
41-
}
42-
return false;
39+
return balanced && stack.isEmpty();
4340
}

src/ts/others/fibonacci.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function fibonacciMemoization(n: number) {
2222
if (n < 1) { return 0; }
2323
const memo = [0, 1];
2424
const fibonacciMem = (num: number): number => {
25-
if (memo[num] != null) { return memo[num]; }
25+
// if (memo[num] != null) { return memo[num]; }
2626
return (memo[num] = fibonacciMem(num - 1) + fibonacciMem(num - 2));
2727
};
2828
return fibonacciMem(n);

src/ts/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function biggerEquals<T>(a: T, b: T, compareFn: ICompareFunction<T>) {
2424

2525
export function defaultCompare<T>(a: T, b: T): number {
2626
if (a === b) {
27-
return 0;
27+
return Compare.EQUALS;
2828
}
2929
return a < b ? Compare.LESS_THAN : Compare.BIGGER_THAN;
3030
}

0 commit comments

Comments
 (0)