Skip to content

Commit 67dbda8

Browse files
committed
[REFACTOR] [Hacker Rank] Interview Preparation Kit: Dictionaries and Hashmaps: Two Strings.
* Adjusted the interface to match what hackerrank expects.
1 parent 12bc714 commit 67dbda8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/two_strings.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from '@jest/globals';
22
import { logger as console } from '../../../logger';
33

4-
import { twoStrings } from './two_strings';
4+
import twoStrings from './two_strings';
55

66
import TEST_CASES from './two_strings.testcases.json';
77

@@ -11,7 +11,7 @@ describe('two_strings', () => {
1111

1212
TEST_CASES.forEach((testCase) => {
1313
testCase?.test.forEach((test) => {
14-
const answer = twoStrings(test.s1, test.s2);
14+
const answer = twoStrings.twoStrings(test.s1, test.s2);
1515

1616
console.debug(
1717
`twoStrings(${test.s1}, ${test.s2}) solution found: ${answer}`

src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/two_strings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const __YES__ = 'YES';
66
const __NO__ = 'NO';
77

8-
export function twoStringsCompute(s1: string, s2: string): boolean {
8+
function twoStringsCompute(s1: string, s2: string): boolean {
99
for (const char of s1) {
1010
if (s2.includes(char)) {
1111
return true;
@@ -14,7 +14,7 @@ export function twoStringsCompute(s1: string, s2: string): boolean {
1414
return false;
1515
}
1616

17-
export function twoStrings(s1: string, s2: string): string {
17+
function twoStrings(s1: string, s2: string): string {
1818
return twoStringsCompute(s1, s2) ? __YES__ : __NO__;
1919
}
2020

0 commit comments

Comments
 (0)