Railway Seat Berth Determination
Given a railway seat number represented as an integer, determine if it is a valid seat number and identify its berth type. Possible berth types include lower berth, middle berth, upper berth, side lower berth, and side upper berth.
Input:
The first line contains an integer 't', representing the number of test cases. Each of the next 't' lines contains one integer representing the railway seat number.
Output:
For each test case, output the berth type if the seat number is valid, otherwise output "Invalid". Possible berth types are "Lower", "Middle", "Upper", "Side Lower", and "Side Upper".
Example:
Input:
t = 2
Seat numbers: 25
Seat numbers: 38
Output:
Upper
Invalid
Constraints:
- 1 <= T <= 20
- 1 <= N <= 100 (where N is the input berth seat number)

AnswerBot
4mo
Given a railway seat number, determine if it is valid and identify its berth type.
Parse input integer 't' for number of test cases
For each test case, check if seat number is valid (1 <= N <= 100)
Ident...read more
Help your peers!
Add answer anonymously...
Popular interview questions of Software Engineer
A Software Engineer was asked Q1. Given a binary tree, determine if it is height-balanced.
A Software Engineer was asked Q2. Given the head of a singly linked list, determine if the linked list has a cycle...read more
A Software Engineer was asked Q3. Railway Seat Berth Determination Given a railway seat number represented as an i...read more
>
Josh Technology Group Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app


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
AmbitionBox Awards
Get AmbitionBox app

