 New update is available. Click here to update. Close
Topic list
Odd Even
EASY
10 mins 1 upvotes
Other topics
Problem solved
Skill meter Strings
-
- Matrices (2D Arrays)
-
- -
- Sorting
-
- Binary Search
-
- Stacks & Queues
-
- Trees
-
- Graph
-
- Dynamic Programming
-
- Greedy
-
- Tries
-
- Arrays
-
- SQL
-
- Binary Search Trees
-
- Heap
-
- Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Odd Even

Contributed by
Sachin_f78a
Easy 0/40
Avg time to solve 10 mins
Success Rate 86 % Share 1 upvotes

## Problem Statement

#### Note: Assume 1-based indexing.

##### For example:
``````Let 'X' = 3 and 'Y' = 6, Alice adds 1 to 'X' since 'X' is odd. Now 'X' will become 4. Then, Alice will add 2 to 'X', since 'X' is even, and it will become 6. 'X' becomes equal to 'Y'. Hence we will return 1 as the answer.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images ) ##### Sample Input 1:-
``````2
4 8
1 1
``````
##### Sample Output 1:-
``````1
1
``````
##### Explanation of sample input 1:-
``````First test case:-
In 1st operation, Alice will add 2 to 'X' as 'X' is even. Now, 'X' is 6. Again, in the 2nd operation, Alice will add 2 to 'X'. Now 'X' is 8, which is equal to 'Y'. So, the answer is 1.

Second test case:-
``````
##### Sample Input 2:-
``````2
4 9
7 8
``````
##### Sample Output 2:-
``````0
1
``````  Auto Console