Bullet Program Questions Sheet
Bullet Program Questions Sheet
https://docs.google.
com/document/d/1gWPhVxxQhRqnN
DaRFGIvbh3Q2TyIyckx76wM58BhS https://github.com/priyanshu-
RESOURCES: co/edit?usp=sharing arya/GU_Training
Batch 1 Batch 2 Problem Title Difficulty Problem Type Efficiency Notes
Given an array of integers and queries.
Tree + Recursion + DFS (A common HackWithInfy question Convert a binary tree to a string and then back to a tree structure.
Do it on your Own Do it on your Own 297. Serialize and Deserialize Binary TreeMedium
prompting depth-first traversal logic across rounds) Must handle edge cases like null children.
Lowest Common Ancestor (LCA) in Given two nodes in a binary tree, find their LCA without assuming
Do it on your Own Do it on your Own Medium Tree + Recursion + DFS (Frequently seen in HWI practice sets and outlined in their sample PDF)
Binary Tree BST structure.
Find the max sum of any non-empty path (which need not pass
Do it on your Own Do it on your Own Maximum Path Sum in Binary Tree Hard Tree + DFS + DP
through the root).
Tree + Euler Tour + Subtree Intersection
In a graph of two rooted trees, "beauty" of a node is the size of the
Do it on your Own Do it on your Own Beauty of Node in Dual-Rooted Trees Hard (Matches complex HackWithInfy graph/tree hybrid
intersection of its subtrees. Compute beauty for all nodes.
problems.)
Discussed Icebox Implement Trie (LeetCode #208) Medium Trie Support insert, search, startsWith operations on lowercase words.
Design Add & Search Words Data Build a word dictionary supporting wildcard character . matching
Do it on your Own Do it on your Own Medium Trie + Backtracking
Structure any single letter.
Word Break with Dictionary (Trie- Given a string and a word list, determine if it can be segmented. Use
Do it on your Own Do it on your Own Medium Trie + DP
Accelerated) a trie to optimize lookup.
Given a large document and a stop-word list, find the most frequent
Trie + HashMap
Do it on your Own Do it on your Own Most Frequent Word in Dictionary Hard non-stop word using trie for word tracking.
Subtract 1.
Reduce Army to One with Min
Icebox Icebox Easy Greedy / Dynamic Programming
Operations
Subtract half (floor division).
Icebox Icebox Invasion Spread on a Grid Easy BFS / Matrix Traversal At each second, E adjacent to A becomes A.
Divide Employees to Maximize Expert Expert value of a subarray = smallest non-negative integer not
Icebox Icebox Medium Greedy / HashSet / Sliding Window
Number present.
Queries:
Icebox Icebox Probability of Good & Great Chains Medium Combinatorics, Probability, Modular Arithmetic Reversed chain must swap colors.
Icebox Icebox Max Amazingness of Partitioned Array Medium Bit Manipulation, DP / Divide & Conquer Beauty of a subarray = max XOR of any subset.
Subtree of U rooted at A.
Icebox Icebox Beauty of Node in Dual Rooted Trees Hard Tree Traversal, Euler Tour, Subtree Intersection
Subtree of V rooted at B.
Given a graph of cities with roads (weighted edges), and each city
Icebox Icebox Max Funds (Graph + Greedy) Hard Graph + Greedy + Shortest/Max Path gives a certain fund, maximize funds collected from a source to
destination while keeping the total cost ≤ budget.
Description: Given integers N, X, and D, count all pairs (A, B) where 1
≤ A, B ≤ N such that:
Icebox Icebox Count Valid XOR Pairs Hard Combinatorics + Bitwise + Modular Arithmetic A ^ B ≤ X,
(A + B) % D == 0.
Return result modulo 10⁹+7.
Guests have happiness values C[i]; serving them at minute x yields
unhappiness |C[i] – x|. Rearrange serving order to minimize total
Icebox Icebox Minimize Unhappiness of Guests Hard Greedy + Sorting + Absolute Difference Minimization
unhappiness.
Icebox Icebox Triplet Matching in an Array Hard Greedy + Frequency HashMap All 3 are equal (like [3, 3, 3]) or