Question: Virtusa OA Coding Questions with Answers 2025 | Virtusa Round 2 Coding | Queue Simulation & Array Distribution Logic
0
Entering edit mode

Question 1: Maze of People

Problem Statement: You are standing in a long line to enter the Maze of Trials. The line is endless, and only two people can enter the maze every second. The process follows these rules:

  • Every second, the 1st and 3rd people in the line enter the maze.
  • The person who was 2nd before, they will move to the 1st position.
  • This keeps happening every second, with the 1st and 3rd people always entering and leaving.

At the start, you are at the Nth position in the line. Your task is to find and return an integer value representing how many seconds it will take for you to enter the maze.

Input Specification:

  • input1: An integer value N, representing your position in the line.

Output Specification:

  • Return an integer value representing how many seconds it will take for you to enter the maze.

Example 1: Input: 5 Output: (Solve for your position relative to the 1st/3rd exit rule per second).

 


Question 2: 5 Days Challenge

Problem Statement: Alice is undertaking a 5-day challenge to read N books, each book containing A pages. Alice must complete the books by distributing the pages as evenly as possible. Your task is to find and return an integer value representing the minimum number of pages she must read in a day to finish all the books in exactly 5 days.

Input Specification:

  • input1: An integer value N, representing the number of books.
  • input2: An integer array A, representing the number of pages in each book.

Output Specification:

  • Return an integer value representing the minimum number of pages she must read in a day to finish all the books in exactly 5 days.

Example 1: Input: input1: 5 input2: {4, 10, 20, 30, 40} Output: 21

(Explanation: Total pages = 104. To finish in 5 days as evenly as possible, the minimum pages per day would be ceiling(104/5) = 21).

 

Login before adding your answer.

Similar Posts
Loading Similar Posts