Infosys SP OA

Posted
10 Feb 2026
588 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.

How it went

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

Questions asked (4)

  1. 01

    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. 02

    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. 03

    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. 04

    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.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Infosys recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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