Program Specialist Interview Questions

1,810 program specialist interview questions shared by candidates

There were normal questions regarding data types, variables and arrays. They were also asking about some DSA questions, with some personality questions and my future goals and objectives. More importance was given to the tricky question.
avatar

Specialist Programmer

Interviewed at Infosys

3.6
Jul 24, 2025

There were normal questions regarding data types, variables and arrays. They were also asking about some DSA questions, with some personality questions and my future goals and objectives. More importance was given to the tricky question.

You are given an integer array g of length n, where g[i] (1 ≤ i ≤ n) represents the next station you must go to from station i. There are n stations, numbered from 1 to n. It is guaranteed that every station eventually reaches station 1. Define the cost of a station i as the number of steps required to reach station 1 starting from station i (cost[1] = 0, and for i > 1, cost[i] = 1 + cost[g[i]]). Return the sum of the costs of all stations. Example 1: Input: g = [1,1,2,3] Output: 6 Explanation: Station 1 → cost 0, Station 2 → cost 1, Station 3 → cost 2, Station 4 → cost 3. Total = 6. Example 2: Input: g = [3,1,2] Output: 3 Explanation: Station 1 → cost 0, Station 2 → cost 1, Station 3 → cost 2. Total = 3. Example 3: Input: g = [2,1,1] Output: 2 Explanation: Station 1 → cost 0, Station 2 → cost 1, Station 3 → cost 1. Total = 2.
avatar

Specialist (Power Programmer)

Interviewed at Infosys

3.6
Oct 10, 2025

You are given an integer array g of length n, where g[i] (1 ≤ i ≤ n) represents the next station you must go to from station i. There are n stations, numbered from 1 to n. It is guaranteed that every station eventually reaches station 1. Define the cost of a station i as the number of steps required to reach station 1 starting from station i (cost[1] = 0, and for i > 1, cost[i] = 1 + cost[g[i]]). Return the sum of the costs of all stations. Example 1: Input: g = [1,1,2,3] Output: 6 Explanation: Station 1 → cost 0, Station 2 → cost 1, Station 3 → cost 2, Station 4 → cost 3. Total = 6. Example 2: Input: g = [3,1,2] Output: 3 Explanation: Station 1 → cost 0, Station 2 → cost 1, Station 3 → cost 2. Total = 3. Example 3: Input: g = [2,1,1] Output: 2 Explanation: Station 1 → cost 0, Station 2 → cost 1, Station 3 → cost 1. Total = 2.

Viewing 561 - 570 interview questions

See Interview Questions for Similar Jobs

Glassdoor has 1,810 interview questions and reports from Program specialist interviews. Prepare for your interview. Get hired. Love your job.