Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c137930

Browse files
fix(book/hashmap): exercise example and add tests
1 parent 65b6edd commit c137930

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎book/content/part02/hash-map.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ function longestSubstring(s) {
486486
.Examples
487487
[source, javascript]
488488
----
489-
longestSubstring('abcdaefg'); // 4 ('abcd' or 'aefg')
489+
longestSubstring('abcdaefg'); // 7 ('bcdaefg')
490490
longestSubstring('abbaa'); // 2 ('ab')
491491
longestSubstring('abbadvdf') // 4 ('badv')
492492
----

‎book/interview-questions/longest-substring-without-repeating-characters.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,11 @@ const { lenLongestSubstring } = require('./longest-substring-without-repeating-c
2020
const expected = 5;
2121
expect(fn(actual)).toEqual(expected);
2222
});
23+
24+
it('should work with example', () => {
25+
const actual = 'abcdaefg';
26+
const expected = 7;
27+
expect(fn(actual)).toEqual(expected);
28+
});
2329
});
2430
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /