This is a write-up of the Flipkart Grid SDE Intern 2026 Online Assessment. The assessment consisted of 3 coding questions to be solved in 90 minutes.
Format
- 3 Programming Questions
- Total Duration: 90 Minutes
Problem 1: Good Numbers
You are given two integers:
- n – number of digits in the number (**n ≤ 9**)
- k – divisor (**k ≤ 100**)
Find the sum of all n-digit numbers that are divisible by k.
Example 1
Input
n = 2
k = 5
Valid Numbers
10, 15, 20, 25, ..., 95
Output
995
Example 2
Input
n = 1
k = 3
Valid Numbers
3, 6, 9
Output
18
Example 3
Input
n = 3
k = 100
Valid Numbers
100, 200, 300, ..., 900
Output
4500
Approach
The brute-force solution iterates over all n-digit numbers, checks whether each number is divisible by k, and adds the valid numbers. This approach was sufficient for the OA constraints.
A more optimal solution observes that all valid numbers form an Arithmetic Progression (AP).
- Find the first n-digit multiple of k.
- Find the last n-digit multiple of k.
- Compute the number of terms.
- Use the AP sum formula to calculate the answer.
Problem 2: Tree Level
You are given an array representing the level-order traversal of a complete binary tree.
Print the last node of every level, i.e., the rightmost node of each level.
Example 1
Input
1 2 3 4 5 6 7
Tree
1
/ \
2 3
/ \ / \
4 5 6 7
Output
1
3
7
Example 2
Input
5 8 9 1 2 7
Tree
5
/ \
8 9
/ \ /
1 2 7
Output
5
9
7
Example 3
Input
10 20 30 40 50 60 70 80 90
Tree
10
/ \
20 30
/ \ / \
40 50 60 70
/ \
80 90
Output
10
30
70
90
Approach
Since the array is already given in level-order traversal, there is no need to construct the binary tree.
Each level contains 2ˡ nodes. Starting from index 0, process one level at a time and print the last element of that level.
Problem 3: 2048 Game
You are given a fixed 4 × 4 grid containing 0 or powers of 2, along with one of the four directions:
- Left
- Right
- Up
- Down
Print the resulting grid after performing the move.
The game follows the standard 2048 rules, except that a tile formed after a merge cannot merge again during the same move.
After every move, all non-zero tiles shift towards the given direction, while zeroes are pushed towards the opposite direction.
Example 1
Direction
LEFT
Input
2 2 4 8
0 0 0 0
0 0 0 0
0 0 0 0
Output
4 4 8 0
0 0 0 0
0 0 0 0
0 0 0 0
Explanation
The first two 2s merge into 4. The remaining tiles simply shift left, and the zero is pushed to the right.
Example 2
Direction
LEFT
Input
2 0 2 2
0 0 0 0
0 0 0 0
0 0 0 0
Output
4 2 0 0
0 0 0 0
0 0 0 0
0 0 0 0
Explanation
Ignoring zeroes, the row becomes 2 2 2. The first pair merges into 4, while the remaining 2 cannot merge again during the same move.
Example 3
Direction
UP
Input
2 0 0 0
2 0 0 0
4 0 0 0
8 0 0 0
Output
4 0 0 0
4 0 0 0
8 0 0 0
0 0 0 0
Explanation
The first two 2s merge into 4. The remaining 4 and 8 move upwards without merging again. Since the movement is UP, all zeroes are shifted in the opposite direction (DOWN).
Approach
This is a simulation problem.
For every row or column (depending on the direction):
- Extract all non-zero values.
- Merge adjacent equal values once.
- A tile created after a merge cannot merge again in the same move.
- Shift all resulting non-zero values towards the movement direction.
- Fill the remaining positions with zeroes on the opposite side.
Since the grid size is fixed (**4 × 4**), the simulation runs in constant time.
Time Complexity: O(1)
Space Complexity: O(1)
Summary
- Q1 was an Easy number theory problem. A brute-force solution passed, while an arithmetic progression observation yields an optimal O(1) solution.
- Q2 was an Easy implementation problem. Since the input was already in level-order, the answer could be obtained by directly processing the array without constructing the tree.
- Q3 was a Medium simulation problem based on the 2048 game, requiring careful handling of movement, merging rules, and zero shifting.
Overall, the OA was implementation-oriented, with the focus on correctly simulating the required behavior rather than using advanced data structures or algorithms.



