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) {
1313
1414function 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 ] ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ function inOrderTraversal(root) {
1414
1515function 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 ] ;
File renamed without changes.
You can’t perform that action at this time.
0 commit comments