Skip to content

Commit b4507f1

Browse files
committed
update: rename folder and fix condition for K
1 parent ca93db3 commit b4507f1

File tree

4 files changed

+2
-2
lines changed

4 files changed

+2
-2
lines changed

src/_DataStructures_/Trees/BST/find-kth-max/index.js src/_DataStructures_/Trees/BinarySearchTree/find-kth-max/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function inOrderTraversal(root) {
1313

1414
function findKthMax(rootNode, k) {
1515
const arr = inOrderTraversal(rootNode);
16-
if (k < 0 || k > arr.lenth) {
16+
if (k <= 0 || k > arr.lenth) {
1717
throw new Error('Invalid value for K');
1818
}
1919
return arr[arr.length - k];

src/_DataStructures_/Trees/BST/find-kth-min/index.js src/_DataStructures_/Trees/BinarySearchTree/find-kth-min/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function inOrderTraversal(root) {
1414

1515
function findKthMin(rootNode, k) {
1616
const arr = inOrderTraversal(rootNode);
17-
if (k < 0 || k > arr.lenth) {
17+
if (k <= 0 || k > arr.lenth) {
1818
throw new Error('Invalid value for K');
1919
}
2020
return arr[k - 1];

0 commit comments

Comments
 (0)