Number In Arithmetic Progression Problem

Given three integers X, C, and Y, where X is the first term of an arithmetic sequence with a common difference of C, determine if Y is part of this arithmetic sequence.

Example:

Input:
X = 6, C = 3
Output:
Sequence: 6, 9, 12, 15, 18, 21, 24...

Explanation:

Based on the above sequence, you need to check if the given Y lies within this set of numbers.

Constraints:

  • 1 <= T <= 105
  • -108 <= X, C, Y <= 108

Time Limit: 1 sec

Input:

T - number of test cases
X, Y, C - space-separated integers for each test case

Output:

For each test case, print "True" if Y belongs to the sequence; otherwise, print "False".

Note:

You are not required to print anything. Simply implement the function to return the answers.
AnswerBot
4mo

Determine if a given number is part of an arithmetic sequence with a specified first term and common difference.

  • Calculate the arithmetic sequence based on the given first term and common difference.

  • Ch...read more

Help your peers!
Select
Add answer anonymously...

Paytm Software Engineer interview questions & answers

A Software Engineer was asked 7mo agoQ. Given an m x n matrix, where each row and each column is sorted in ascending ord...read more
A Software Engineer was asked 9mo agoQ. Explain the internal workings of a hashmap.
A Software Engineer was asked 9mo agoQ. Given head, the head of a linked list, determine if the linked list has a cycle ...read more

Popular interview questions of Software Engineer

A Software Engineer was asked 7mo agoQ1. Given an m x n matrix, where each row and each column is sorted in ascending ord...read more
A Software Engineer was asked 9mo agoQ2. Explain the internal workings of a hashmap.
A Software Engineer was asked 9mo agoQ3. Given head, the head of a linked list, determine if the linked list has a cycle ...read more
Paytm Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits