class Solution{ public: int searchBST(Node* root, int target, int ans = -1){ if(!root){ return ans; } if(root->data <= target){ ans = root->data; return searchBST(root->right,target, ans); } return searchBST(root->left, target, ans); } int floor(Node* root, int x) { // Code here if(!root ) return -1; return searchBST(root, x); } };