In Infosys' technical interview, a candidate is asked to find the longest palindromic substring in a given string. Which approach would be most optimal?
ABrute force (O(n³))
BExpand around centers (O(n²))
CDynamic Programming (O(n²))
DBoth B and C are equally optimal
Correct Answer:
D. Both B and C are equally optimal
Explanation:
Both Expand Around Centers and Dynamic Programming offer O(n²) time complexity, which is considered optimal for this problem in interview settings.
A candidate in Infosys placement gets selected in both the coding round and technical round. What is the approximate probability they will be rejected in the HR round, based on historical data?
ALess than 5%
B5-10%
C10-15%
D15-20%
Correct Answer:
A. Less than 5%
Explanation:
Historically, candidates who clear both coding and technical rounds have a high success rate in HR rounds at Infosys (>95%), as the company focuses on fit and communication at this stage.
A candidate is solving a problem on dynamic programming for the Infosys coding round. The problem involves overlapping subproblems and optimal substructure. What is the minimum number of steps to solve such problems?
A1 step - direct solution
B2 steps - define subproblems and find recurrence
C3 steps - define subproblems, find recurrence, implement with memoization/tabulation
D4 steps - analyze, define, find recurrence, and optimize further
Correct Answer:
C. 3 steps - define subproblems, find recurrence, implement with memoization/tabulation
Explanation:
Dynamic programming requires defining subproblems, establishing recurrence relations, and implementing solutions using memoization or tabulation for optimization.