Skip to content

Commit 49cd99f

Browse files
authored
Merge pull request #448 from sir-gon/develop
Develop
2 parents 3f3e4ab + dbc3ebd commit 49cd99f

File tree

56 files changed

+129
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+129
-103
lines changed

.eslintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"eslint:recommended",
1414
"plugin:@typescript-eslint/eslint-recommended",
1515
"plugin:@typescript-eslint/recommended",
16-
// "plugin:@typescript-eslint/recommended-type-checked",
17-
// "plugin:@typescript-eslint/stylistic-type-checked"
16+
"plugin:@typescript-eslint/recommended-type-checked",
17+
"plugin:@typescript-eslint/stylistic-type-checked",
1818
"airbnb-base",
1919
"prettier",
2020
"plugin:import/recommended",

src/constants/datetime.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ export const __OCTOBER__ = 9;
1919
export const __NOVEMBER__ = 10;
2020
export const __DECEMBER__ = 11;
2121

22-
interface MonthNames {
23-
[key: string]: number;
24-
}
22+
type MonthNames = Record<string, number>;
2523

2624
export const daysInMonth: MonthNames = {
2725
JANUARY: 31,
@@ -38,9 +36,7 @@ export const daysInMonth: MonthNames = {
3836
DECEMBER: 31
3937
};
4038

41-
export interface MonthNumbers {
42-
[key: string]: number;
43-
}
39+
export type MonthNumbers = Record<string, number>;
4440

4541
export const daysInMonthNumber: MonthNumbers = {
4642
1: 31,

src/hackerrank/implementation/betweenTwoSets.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ describe('betweenTwoSets', () => {
1111
const solutionFound = 0;
1212

1313
const calculatedA = getTotalX([], input);
14-
console.log(`Between Two Sets getTotalX([], ${input}): ${calculatedA}`);
14+
console.log(
15+
`Between Two Sets getTotalX([], ${input.toString()}): ${calculatedA}`
16+
);
1517

1618
expect(calculatedA).toBe(solutionFound);
1719

1820
const calculatedB = getTotalX(input, []);
19-
console.log(`Between Two Sets getTotalX(${input}, []): ${calculatedB}`);
21+
console.log(
22+
`Between Two Sets getTotalX(${input.toString()}, []): ${calculatedB}`
23+
);
2024

2125
expect(calculatedB).toBe(solutionFound);
2226

src/hackerrank/implementation/birthday.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { logger as console } from '../../logger';
66

77
export function birthday(s: number[], d: number, m: number): number {
88
let result = 0;
9-
console.debug(`s: ${s}`);
9+
console.debug(`s: ${s.toString()}`);
1010

1111
for (let i = 0; i <= s.length - m; i++) {
1212
let sum = 0;

src/hackerrank/implementation/breakingRecords.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ describe('breakingRecords', () => {
2020

2121
const calculated = breakingRecords(input);
2222

23-
console.log(`breakingRecords(${input}) Test case 0: ${calculated}`);
23+
console.log(
24+
`breakingRecords(${input.toString()}) Test case 0: ${calculated.toString()}`
25+
);
2426

2527
expect(calculated).toStrictEqual(solutionFound);
2628
});
@@ -33,7 +35,9 @@ describe('breakingRecords', () => {
3335

3436
const calculated = breakingRecords(input);
3537

36-
console.log(`breakingRecords(${input}) Test case 1: ${calculated}`);
38+
console.log(
39+
`breakingRecords(${input.toString()}) Test case 1: ${calculated.toString()}`
40+
);
3741

3842
expect(calculated).toStrictEqual(solutionFound);
3943
});

src/hackerrank/implementation/countApplesAndOranges.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ describe('countApplesAndOranges', () => {
77
it('countApplesAndOranges test case 0', () => {
88
expect.assertions(1);
99

10-
const s: number = 7;
11-
const t: number = 11;
12-
const a: number = 5;
13-
const b: number = 15;
10+
const s = 7;
11+
const t = 11;
12+
const a = 5;
13+
const b = 15;
1414
const apples: number[] = [-2, 2, 1];
1515
const oranges: number[] = [5, -6];
1616
const solutionFound = [1, 1].join('\n');

src/hackerrank/implementation/gradingStudents.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('gradingStudents', () => {
1212

1313
const calculated = gradingStudents(input);
1414

15-
console.log(`gradingStudents Test case 0: ${calculated}`);
15+
console.log(`gradingStudents Test case 0: ${calculated.toString()}`);
1616

1717
expect(calculated).toStrictEqual(solutionFound);
1818
});

src/hackerrank/implementation/migratoryBirds.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
import { logger as console } from '../../logger';
66

7-
interface Birds {
8-
[name: string]: number;
9-
}
7+
type Birds = Record<string, number>;
108

119
export function migratoryBirds(arr: number[]): number {
1210
if (arr.length === 0) {
@@ -32,7 +30,7 @@ export function migratoryBirds(arr: number[]): number {
3230
max = bird;
3331
}
3432

35-
console.debug(`map: ${map}`);
33+
console.debug(`map: ${JSON.stringify(map)}`);
3634

3735
return max;
3836
}

src/hackerrank/implementation/minimumAbsoluteDifference.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function minimumAbsoluteDifference(arr: number[]): number {
1010
}
1111

1212
const sortedNums = [...arr].sort((a: number, b: number) => a - b);
13-
console.log(`sortedNums: ${sortedNums}`);
13+
console.log(`sortedNums: ${sortedNums.toString()}`);
1414

1515
let result: number = Math.abs(sortedNums[0] - sortedNums[1]);
1616

src/hackerrank/implementation/sockMerchant.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import { logger as console } from '../../logger';
77
export function sockMerchant(n: number, ar: number[]): number {
88
let result = 0;
99

10-
interface Matches {
11-
[key: string]: number;
12-
}
10+
type Matches = Record<string, number>;
1311

1412
const matches: Matches = {};
1513

0 commit comments

Comments
 (0)