Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The description clearly states the second example is a valid BST which it isn't or am I incorrect in that statement?
Furthermore,
' you will write a function that will validate that a given binary tree is a binary search tree. '
please provide a reference to a binary search tree definition that states a reverse order is a valid binary search tree.
Second Example is NOT A VALID BST! and the corresponding test is incorrect
by definition, valid BST's have the following properties :
Posting in case anybody else runs into the same issues or can point out where I did something wrong...
My logic was verified by logs that a reversed linked list was being created and returned.
what i tried (in JS):
A couple notes here to piggyback on the others' comments:
1st assertion of the "should be able to handle lists of length 3" is just wrong - assertion checks for equality with an unreversed list (1 -> 3 -> 8 against 1 -> 3 -> 8)
The rest of the assertions for lists of lengths > 1 don't seem to work unless we edit tests to reassign list as the evaluation of the test's call to reverse(). Then the assertion tests the evaluated result of our logic and my tests passed as expected.
This makes sense if returning a new reference in memory but should not matter if we're returning list... right? This hangup is probably due to yellowBirdy's comment below but in any case the instructs aren't explicit on whether to reverse in place or to not mutate the input list.
Hope this helps some of y'all!