Check if X can be converted to Y by converting to 3 * (X / 2) or X – 1 in each operation

Check if X can be converted to Y by converting to 3 * (X / 2) or X – 1 in each operation
Given two positive integers X and Y, the task is to check if X can be converted to Y or not by repeatedly changing the value of X to (3 * X / 2) (if X is even) or (X – 1). If it is possible to convert X into Y, then print “Yes”. Otherwise, print “No”.
Examples:

Input: X = 6, Y = 8Output: YesExplanation:Operation 1: Convert X(= 6) to 3*X/2 ( = 3 * (6 / 2) = 9).Operation 2: Convert X(= 9) to (X – 1) (= 8).Therefore, the total number of operations required is 2.
Input: X = 3, Y = 6Output: No

Approach: The given problem can be solved based on the following observations:If the value of X is at least Y, then X can always be converted to Y using the second operation, i.e. reducing X by 1.
If X is even, then it can be converted to (3 * (X / 2)), which is greater than X for all even numbers greater than 0.
If the value of X is odd, then X can be converted to (X – 1), which can be converted into (3 * (X – 1)/2), which is greater than X.
Therefore, from the above observations, the conversion of X into Y is always possible for X > 3.
Following base cases are required to be considered:
X = 1: Conversion possible only if Y = 1.
X = 2 or X = 3: Conversion possible only if Y ≤ 3.
In all the other cases, conversion is not possible.

Follow the steps below to solve the problem:
If the value X is greater than 4, then print “Yes”.
If the value X is 1 and Y is 1, then print “Yes”.
If the value X is 2 or 3 and Y is less than 4, then print “Yes”.
Otherwise, print “No” for all the other cases.
Below is the implementation of above approach:

C++

#include
using namespace std;
  

void check(int X, int Y)
{
    
    if (X > 3) {
        cout