We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca93db3 commit b4507f1Copy full SHA for b4507f1
src/_DataStructures_/Trees/BST/Node.js src/_DataStructures_/Trees/BinarySearchTree/Node.js
src/_DataStructures_/Trees/BST/find-kth-max/index.js src/_DataStructures_/Trees/BinarySearchTree/find-kth-max/index.js
@@ -13,7 +13,7 @@ function inOrderTraversal(root) {
13
14
function findKthMax(rootNode, k) {
15
const arr = inOrderTraversal(rootNode);
16
- if (k < 0 || k > arr.lenth) {
+ if (k <= 0 || k > arr.lenth) {
17
throw new Error('Invalid value for K');
18
}
19
return arr[arr.length - k];
src/_DataStructures_/Trees/BST/find-kth-min/index.js src/_DataStructures_/Trees/BinarySearchTree/find-kth-min/index.js
@@ -14,7 +14,7 @@ function inOrderTraversal(root) {
function findKthMin(rootNode, k) {
20
return arr[k - 1];
src/_DataStructures_/Trees/BST/index.js src/_DataStructures_/Trees/BinarySearchTree/index.js
0 commit comments