HackTheRounds Interview Experiences

IBM Software Engineer OA Interview Experience (2026) - Longest Subarray Divisible by K & Palindrome Rearrangement

IBM 2026 SWE OA walkthrough: coding (longest subarray with sum divisible by K via prefix sum remainder map, palindrome rearrangement by odd count check), logic

By Anonymous ยท 2026-03-21

Background

IBM's OA is the first real filter in the 2026 new-grad pipeline, and the reputation around it on Blind is misleading. People say it is easy because the coding questions are in the LeetCode easy-to-medium band. They skip over the fact that the exam also bundles a logic-and-math block and a situational-judgment block, and the total time pressure is what takes people out. I am a senior CS student with a prior internship at a mid-size software firm, and I took the IBM OA in March for a Software Engineer role in the Hybrid Cloud org. Here is what the coding half actually asked and how I approached it.

Timeline

Total so far: 3.5 weeks.

OA Format (90-100 min total)

Three sections, back to back on a proctored third-party platform:

No personality questionnaire. No video recording, just screen-recording and browser lockdown.

Problem 1: Longest Subarray with Sum Divisible by K

Problem: You are given an array of integers and a positive integer k . Return the length of the longest contiguous subarray whose sum is divisible by k . The array can contain negative numbers.

Prefix-sum-with-remainders plus a hash map. Compute a running prefix sum, track its remainder modulo k , and store the first index at which each remainder value appeared. If the same remainder shows up again at a later index, the subarray in between has sum divisible by k . The longest such span over the full scan is the answer. O(n) time, O(k) space.

Two edge cases matter. First, the empty prefix has remainder 0 at index -1, which is how a subarray starting at index 0 gets counted correctly. Seed the map with {0: -1} . Second, the remainder of a negative prefix sum in Python is already normalized to the [0, k) range, but in Java or C++ you need to add k and mod again. I used Python and did not have to worry, but I made sure the interviewer would see that I knew the cross-language gotcha.

I wrote the brute force first on scratch paper to confirm the approach on a 6-element example, then coded the prefix-sum version. O(n^2) passes the visible test cases but TLEs on the hidden ones. Do not ship the brute force.

This question is coming soon to HackTheRounds.

This question is coming soon to HackTheRounds.

Problem 2: Palindrome Rearrangement Check

Problem: Given a string of lowercase letters, return true if the characters can be rearranged to form a palindrome, and false otherwise.

Character frequency check. A string can be rearranged into a palindrome if and only if at most one character has an odd count (the center of an odd-length palindrome). Count character frequencies, count how many of them are odd, and return whether that count is 0 or 1. O(n) time, O(26) space for the lowercase-alphabet counter.

I used collections.Counter in Python and then a generator expression summing odd counts. Clean three-liner. The interviewer-facing follow-up the test writer probably wants is "what changes if case matters" (26 becomes 52, logic identical) and "what changes if we need to return all palindromic rearrangements" (that becomes a permutation-generation problem with symmetry, harder).

This question is coming soon to HackTheRounds.

This question is coming soon to HackTheRounds.

Logic and Math Block

Ten or so questions across:

  • Numerical series completion (find the next term in a pattern).
  • Percentage word problems, IBM loves these.
  • Simple probability (single event, conditional event with small sample space).
  • 2D spatial reasoning (rotate this figure 90 degrees, which option matches).
  • Pattern recognition on alphanumeric sequences.

The timing is what kills candidates. Roughly 20 minutes for 10 questions means 2 minutes per question, and IBM gives you no partial-credit signal during the block. I set a hard 90-second timer per question, and if I did not see the answer I guessed and moved on. The block grades on volume more than accuracy.

Situational Judgment

Scenarios about workplace conflict, prioritization, and accountability. For each scenario you pick the most appropriate and least appropriate response from four or five options. IBM is specifically looking for candidates who:

  • Collaborate rather than go it alone.
  • Escalate appropriately without passing the buck.
  • Respect chain of authority (flag issues to your manager, not around them).
  • Own the outcome of their own work while supporting the team's success.

The failure mode is picking the "I would handle it all myself without asking for help" response. That looks ambitious but signals a teamwork-anti-pattern to IBM's reviewers.

Result

Submitted with 7 minutes remaining across the whole session. Coding section passed both problems on the visible test cases. Recruiter sent the technical VO invite six business days later, which is roughly the standard IBM turnaround.

Tips

  1. Seed the prefix-sum remainder map with `{0: -1}`. For Problem 1, missing this seed is the reason candidates fail the test cases where the answer is a prefix of the whole array. The remainder-0-at-index-negative-one trick is the specific piece most candidates leave out.
  2. For the palindrome check, count odd frequencies rather than comparing to reversed. `s == s[::-1]` checks whether the given string is already a palindrome, not whether it can be rearranged to one. That is the trap.
  3. Treat the logic/math block as a timed sprint, not a puzzle. 2 minutes per question average. If you are stuck at 90 seconds, guess and move. IBM grades the block on throughput more than depth.
  4. On SJT, choose the collaborative-and-accountable response, not the lone-hero response. IBM filters specifically for "flags issues up, works across teams, owns outcomes." The option that sounds the most ambitious is often the wrong answer.
  5. Do not practice OAs on a fancy IDE. IBM's proctored platform has zero autocomplete, no linter, no run-in-shell feature. Practicing in the HackerRank or LeetCode in-browser editor matches the environment much better than VS Code.
  6. Run a scratch example for each coding problem before writing code. Five-element array, `k = 3`. Walk the prefix sums. Verify the remainder map fires when expected. This costs 60 seconds and catches the class of off-by-one bugs that IBM's hidden test cases love.

This question is coming soon to HackTheRounds.