You are no longer permitted to choose your own seat on the new campus of BRACU. You must…
- User
You are no longer permitted to choose your own seat on the new campus of BRACU. You must abide by the new regulations, which state that if you sit in the first row for the first week, you must shift to the second row for Week2, the third row for the week3, and so on. In your classroom, there are a total of 6 rows and 5 columns. Your friend “AA” wants to know from you that on the upcoming exam week in which row he will be in. Your task is to implement a function row_rotation(exam_week, seat_status) that takes the exam_week and a 2D array of current seat status as input and returns the row number in which your friend “AA” will be seated and print the seat status for that week.
Input: exam_week = 3 current_seat_status= A B C D E F G H I J K L M N O P Q R S T U V W X Y Z AA BB CC DD
Output: U V W X Y Z AA BB CC DD A B C D E F G H I J K L M N O P Q R S T
here,Your friend AA will be on row 2.
Explanation: exam is 3 week away from the current week Current seat status of above input is for this week.
Seat Status of Next week: Z AA BB CC DD A B C D E F G H I J K L M N O P Q R S T U V W X Y
Seat Status of Exam week:
U V W X Y Z AA BB CC DD A B C D E F G H I J K L M N O P Q R S T
here.in week 2 it will be
Row 0: Z AA BB CC DD Row 1: A B C D E Row 2: F G H I J Row 3: K L M N O Row 4: P Q R S T Row 5: U V W X Y
in week 3
Row 0: U V W X Y Row 1: Z AA BB CC DD Row 2: A B C D E Row 3: F G H I J Row 4: K L M N O Row 5: P Q R S T
- Assistant
To solve this problem, we need to simulate the rotation of rows for a given number of weeks up to the exam week. The key is understanding how the row rotation works and tracking where "AA" ends up after the specified number of weeks. Here's how we can implement the function
row_rotation(exam_week, seat_status):- Rotate the rows by moving the last row to the top.
- Repeat the above step for the number of weeks until the exam week.
- After completing the rotations, identify the row where "AA" is located.
- Return the desired row number and print the final seat arrangement for the exam week.