This January’s Microsoft 26 NG OA was once again hosted on HackerRank, featuring two coding problems. The overall style was medium to hard, with solid fundamentals and details that truly make or break the solution. I managed to AC both problems in one go, so I’m sharing the original questions and my thought process while it’s still fresh—hoping it helps you pass in one shot as well. Both were original questions, and I finished with two ACs in under half an hour.
Microsoft 2026 NG OA Real Questions (January – Latest)
Problem 1
Given a string s, enumerate all of its contiguous substrings and sort them in lexicographical (alphabetical) order, then return the substring that appears last (i.e., the lexicographically largest). Note that the comparison is based on lexicographical order rather than length—longer substrings are not necessarily larger. In essence, the task is to find the maximum substring under lexicographical comparison. Since lexicographical order is determined from the first character onward, the answer must start with the lexicographically largest character in the string, and among all substrings starting at those positions, choose the largest one.
Ideas:All substrings’ lexicographical maximum is equivalent to the lexicographical maximum among all suffixes, because any substring is a prefix of some suffix. Use a two-pointer method to compare two suffixes and eliminate the smaller starting index while scanning from left to right; the remaining starting index is the start of the lexicographically largest suffix.
Coding
def maxSubstring(s):
n = len(s)
i = 0
j = 1
k = 0
while j + k < n:
if s[i + k] == s[j + k]:
k += 1
elif s[i + k] < s[j + k]:
i = j
j = i + 1
k = 0
else:
j = j + k + 1
k = 0
if j == i:
j += 1
return s[i:]
Problem 2
Given a permutation array p of length n, determine for each integer k (1 ≤ k ≤ n) whether it is balanced: k is balanced if there exists a contiguous subarray p[l..r] whose elements form a permutation of {1,2,…,k} (i.e., the subarray has length k, minimum value 1, maximum value k, and no duplicates). You need to output the result for every k, returning a binary string of length n where the k-th character is '1' if k is balanced, otherwise '0'. Equivalently, this checks whether the positions of the values 1..k in the permutation can fit within a single continuous interval.
:Approach: First, record the position of each number using an array pos[val] = index, so we can locate the index of value k in O(1). Then scan k from 1 upward, maintaining the minimum index l and maximum index r among the positions of the values 1..k. If the current interval length r - l + 1 equals k, it means these k values appear in a contiguous block and thus form a permutation, so we append 1; otherwise we append 0.
Coding
def countBalancedNumbers(p):
n = len(p)
pos = [0] * (n + 1)
for i, val in enumerate(p):
pos[val] = i
l = pos[1]
r = pos[1]
ans = []
for k in range(1, n + 1):
if k > 1:
idx = pos[k]
if idx < l:
l = idx
if idx > r:
r = idx
if r - l + 1 == k:
ans.append('1')
else:
ans.append('0')
return ''.join(ans)
How difficult are the two problems in the Microsoft OA?
Microsoft OA style has always been relatively stable:
- The routine is not tricky, but it pays great attention to "code quality + complexity + boundary processing".
- When writing code on the spot, you usually don’t have much time to debug, so you need to be very skilled in writing O(n) methods.
- The second question is a common Microsoft permutation reasoning question, which tests the logical rigor.
If you don't train enough, you will feel like "you have it in your head but you can't write it smoothly" for this type of question; but as long as you do it in the right direction, the code will not be complicated.
ProgramHelp Microsoft 2026 NG OA dedicated assistance.
This year's Microsoft 2026 NG OA is obviously more "volumey". Although the two Hackerrank questions are not over the top, they have detailed logic, many pitfalls, and tight time. This is also the reason why many students dropped points. We have accumulated real-scenario replays from multiple batches of students, including the latest version of question type changes in December, common stuck points, and boundary situations that are most likely to be misjudged.
If you want more stability, we can provide:
- Real-time voice assistance: during the problem-solving process, you receive real-time hints, code, solution ideas, and dry-run walkthroughs.
- Zero-trace OA assistance: The whole process is safe, does not trigger platform detection, and uses our stable and verified technical solution.