Company: Myntra Ramp up SDE intern_15april
Difficulty: medium
Problem Statement During a vibrant festival, a fun game has everyone lining up to receive numbers assigned in a unique pattern that depends on a mysterious parameter k. The process starts with the first k people, who are given numbers from 1 to k in increasing order. Immediately following, the next [unclear] people receive numbers in a descending order, starting [unclear] k-1 down to 2. This alternating pattern—ascending [unclear] numbers and descending [unclear] numbers—repeats [unclear] along the line. Rohan, one of the enthusiastic participants, finds himself puzzled because he has forgotten the value of k. However, he distinctly remembers both his position in the line and the specific number he was given. Your challenge is to determine how many different k values could be consistent with the details that Rohan remembers. Note that the game only works when k > 1. Input [unclear] The single line containing two space-separated integers N and X denoting the Rohan's position in line and