Flipkart GRID 8.0 OA questions Shift 11 am 18th July
Anonymous User
281
Jul 18, 2026
Formatted with GPT.
Total 4 questions, 2 dsa + 1 sql + 1 data frame coding(only py allowed)
Problem 1: Cookie Packing Structure
You are given N cookies, each having a specific weight. The cookies must be packed into a nested box structure following a specific rule.
Packing Rules
-
Each box consists of three portions:
- Left: contains one cookie
- Center: contains another box (recursive structure)
- Right: contains one cookie
-
The cookies must be arranged such that:
- The center box contains the smallest weights
- The left portion contains medium weights
- The right portion contains the largest weights
This effectively forms a recursive nested structure similar to a tree.
Tasks
-
Construct the packing structure.
-
Represent the structure using bracket notation:
- Format:
[left [center] right]
- Format:
-
Given a target cookie weight, determine the box level (depth) at which it is placed:
- The outermost box is at level 1.
Input
- Integer
N - Array of
Nintegers representing weights - Integer
target(weight to search)
Output
- String representing the packing structure
- Integer representing the box level of the target cookie
Example
Input
N = 5
weights = [76, 62, 99, 21, 39]
target = 99Output
Structure: [76[62[21]39]99]
Box level of 99: 3Problem 2: Custom Power Function
You are given a list of integers. Each integer represents a number encoded in a special format.
Definition of f(x)
For a number x:
- The last digit of
xrepresentsk, the number of digits to be used as the exponent. - The remaining leading digits form the base.
Let:
base = first (len(x) - k digits)exponent = last k digits
Then:
f(x) = base ^ exponentTask
Compute the sum of f(x) for all numbers in the list.
Input
- List of integers
Output
- Integer representing the sum
Example
Input
[4122, 2021]Explanation
- 4122 → last digit = 2 → exponent = 12, base = 4 → 4^12
- 2021 → last digit = 1 → exponent = 2, base = 20 → 20^2
Output
4^12 + 20^2 = 16777216 + 400 = 16777616Comments (3)


