Hi everyone! 👋
Today, I appeared for the Flipkart Grid 7.0 Online Assessment. My slot was at 3:00 PM. I'm sharing the problems that were asked in my test. Note that I've removed the unnecessary storylines and boiled the questions down to their core logic. There were 3 coding problems, and I was able to solve the first two. The last one was tricky, and I ran out of time.
You are given a grid as an array of strings of size n x n, and a target word. You need to find the total number of times this word appears in the grid in the following directions:
📌 Note: Palindromes should be counted twice (since they look the same in both directions).
3
CAT
TAC
CAT
CAT
5
I used a brute-force method checking for all 8 directions from every cell which matched the first letter of word. It worked well for the given constraints (n ≥ 3). The only inconvenience was that the editor didn't support copy-paste, which cost me a lot of time while writing from scratch.
You're given an undirected graph represented as an adjacency matrix of size n x n. A "most important node" is one whose removal increases the number of connected components (i.e., articulation point).
Your task is to list all "second most important nodes", defined as immediate neighbors of all articulation points, sorted in ascending order.
First line: Integer n (number of nodes)
Next n lines: n space-separated 0/1 values indicating adjacency
7
0 1 0 1 0 0 0
1 0 1 1 0 0 0
0 1 0 1 1 1 1
0 0 1 0 0 1 0
0 0 1 0 1 0 1
0 0 1 0 0 1 0
1 3 4 5 6
I used Tarjan's Algorithm to find articulation points in the undirected graph. Once found, it was straightforward to collect their direct neighbors and sort them.
You are given a grid of size N x N where each cell contains a non-negative integer. You're also given K rectangular slabs, and each slab can cover 2 adjacent (horizontal or vertical) cells. The slabs must not overlap.
Your goal is to place the slabs optimally to minimize the sum of the uncovered cells.
1 <= N <= 10001 <= K <= 8>= 0First line: Two integers N and K
Next N lines: Each line has N space-separated integers
2 1
6 4
8 7
10
You have 1 slab, and best placement is to cover the bottom row (8, 7). So, uncovered sum = 6 + 4 = 10.
I couldn't solve this one. If you know how to solve this, do tell the solution. Also suggest me what type of questions to practice for such domino(tiling) type.