Created
August 4, 2017 02:34
-
-
Save hamannjames/34e019d8890adada558a80f938d57a12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function kthLargestInBST(t, k) { | |
var check = function (value) { | |
k--; | |
if (k === 0) {return value;} | |
else {return false;} | |
} | |
var loop = function (node) { | |
if (!node) {return false} | |
return loop(node.left) || check(node.value) || loop(node.right) | |
} | |
return loop(t); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment