Skip to content

Commit cc8bede

Browse files
committed
Added test coverage for edge cases
1 parent 32a8777 commit cc8bede

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

medium/binary_tree_lca.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ describe('binaryTreeLca()', () => {
2121
).toBe(12);
2222
});
2323

24+
test('returns -1 for no common ancestor', () => {
25+
expect(binaryTreeLca(['[#, 3, 8]', '3', '8'])).toBe(-1);
26+
});
27+
28+
test('returns -1 for specifying a non-existent node', () => {
29+
expect(binaryTreeLca(['[#, 3, 8]', '1', '8'])).toBe(-1);
30+
});
31+
2432
test('passes Coderbyte.com tests', () => {
2533
expect(
2634
binaryTreeLca([

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy