Goto OA (India – Bengaluru) | 3 DSA + 1 SQL | 90 mins | On-Campus
Anonymous User
400

📝 Goto OA Experience (India – Bengaluru)

Format: 90 minutes | 3 DSA + 1 SQL


🔹 SQL Question

We had a table with columns:

(product_id, department, cost, product_name)

Task:
Print product_name, department, max(cost) for each department.

Example:
Input table:

product_id | department | cost | product_name
---------------------------------------------
1          | Toys       | 200  | Car
2          | Toys       | 300  | Doll
3          | Electronics| 800  | Phone
4          | Electronics| 1200 | Laptop

Output:

product_name | department  | max_cost
-------------------------------------
Doll         | Toys        | 300
Laptop       | Electronics | 1200

🔹 DSA Questions

1. Edit Distance Variation

  • You are given a main string S and a vector of strings.
  • Task: Return the string which has the minimum edit distance from S.

Example:

S = "apple"
words = ["aple", "maple", "apply", "orange"]

Minimum distance → "aple"

2. Gold Mine Problem (DP on Grid)

  • You are given a grid of gold values.
  • You can start from any cell in the first column.
  • Allowed moves: Right, Right+Up, Right+Down.
  • Goal: Find the maximum gold you can collect when reaching the last column.

Example:

Grid =
1 3 3
2 1 4
0 6 4

Max gold = 12 (path: 264)

3. Subarray Counting Problem

  • Given an array of numbers, count subarrays where at least one element appears ≥ K times.

Example:

arr = [1, 2, 1, 2, 1], K = 2
Valid subarrays count = (many subarrays like [1,2,1], [1,2,1,2], [2,1,2])

✅ Hope this helps anyone preparing for Goto OA!

Comments (2)