File tree Expand file tree Collapse file tree 4 files changed +2
-2
lines changed
src/_DataStructures_/Trees/BinarySearchTree Expand file tree Collapse file tree 4 files changed +2
-2
lines changed File renamed without changes.
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function inOrderTraversal(root) {
13
13
14
14
function findKthMax ( rootNode , k ) {
15
15
const arr = inOrderTraversal ( rootNode ) ;
16
- if ( k < 0 || k > arr . lenth ) {
16
+ if ( k <= 0 || k > arr . lenth ) {
17
17
throw new Error ( 'Invalid value for K' ) ;
18
18
}
19
19
return arr [ arr . length - k ] ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ function inOrderTraversal(root) {
14
14
15
15
function findKthMin ( rootNode , k ) {
16
16
const arr = inOrderTraversal ( rootNode ) ;
17
- if ( k < 0 || k > arr . lenth ) {
17
+ if ( k <= 0 || k > arr . lenth ) {
18
18
throw new Error ( 'Invalid value for K' ) ;
19
19
}
20
20
return arr [ k - 1 ] ;
File renamed without changes.
You canβt perform that action at this time.
0 commit comments