Infosys SP OA

infosys logo
infosys
February 10, 2026 · 4 reads

Summary

I participated in an Online Assessment for Infosys, which included four distinct coding questions covering a range of difficulties from easy to hard, focusing on array manipulation, score maximization, number theory conditions, and complex graph traversal with adjacency matrix shifts.

Full Experience

4 questions:

  1. Easy : given array with n elements merge adjacent elements in any order if the sum is less than k, return length of array after performing all valid merges.
  2. Medium : Given array maximise score, note returned score should be even.
  • score : sum of selected elements.
  • if u choose an element at index i then u have to move to i + (arr[i] % 2) index
  1. Hard : Given n, m, g, l Return the number of arrays of size n that can be formed with integers from 1 to m such that
  • for odd index i gcd(arr[i], arr[i+1]) > g
  • for even index i lcm(arr[i], arr[i+1]) < l
  1. Complex: Given graph of n nodes with adjaceny list
  • Find all the paths from node 1 to n whose path length is K
  • For every move from one node to another the adjaceny matrix makes a right cyclical shift on its rows

Interview Questions (4)

1.

Merge Adjacent Elements with Sum Threshold

Data Structures & Algorithms·Easy

Given an array with n elements, merge adjacent elements in any order if their sum is less than k. Return the length of the array after performing all valid merges.

2.

Maximize Even Score with Index Jumps

Data Structures & Algorithms·Medium

Given an array, maximize the score such that the returned score is even. The score is the sum of selected elements. If you choose an element at index i, you have to move to index i + (arr[i] % 2).

3.

Count Arrays with GCD/LCM Conditions

Data Structures & Algorithms·Hard

Given n, m, g, l. Return the number of arrays of size n that can be formed with integers from 1 to m such that:

  • For odd index i, gcd(arr[i], arr[i+1]) > g
  • For even index i, lcm(arr[i], arr[i+1]) < l
4.

Paths of Length K with Shifting Adjacency Matrix

Data Structures & Algorithms

Given a graph of n nodes with an adjacency list:

  • Find all the paths from node 1 to n whose path length is K.
  • For every move from one node to another, the adjacency matrix makes a right cyclical shift on its rows.
Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!