Hack With Infy Zero to Hero Practice Roadmap
A structured practice roadmap. Solve foundational logic, algorithms, math, graph, and tree problems from Hack With Infy.
Keep going! Master these to reach hero status.
Hack With Infy - Easy(1-5)
Easy level problems from Hack With Infy.
Array Queries
ActiveYou are given an array `A` of `N` integers and `Q` queries. There are two types of queries: 1. `(1, L, R)`: Replace `A[i]` with `(i-L+1) * A[L]` for all `L <= i <= R`. 2. `(2, L, R)`: Calculate the sum of elements in `A` from index `L` to `R` inclusive. Return the sum of the answers of all queries of type 2 modulo `10^9 + 7`. **Constraints:** - `1 <= N, Q <= 10^5` - `1 <= A[i] <= 10^9`
Good Subarray
ActiveGiven an array `A` of length `N` and an integer `K`. A subarray is considered **good** if the number of distinct elements doesn't exceed `K`. An empty subarray is also good and its sum is `0`. Find the maximum sum of a good subarray. **Constraints:** - `1 <= N <= 10^5` - `1 <= K <= N` - `-10^9 <= A[i] <= 10^9`
Oil Tank
ActiveThere is a tank with capacity `C` and `N` people arriving sequentially. If `A[i] = 1`, the person sells 1L. If `A[i] = -1`, the person buys 1L. If the tank overflows or underflows, it causes 1 'disturbance'. Minimize the total number of disturbances by choosing the optimal initial oil amount `X` (`0 <= X <= C`). **Constraints:** - `1 <= N <= 10^5` - `1 <= C <= 10^5`
General Ali Strategic Game
ActiveReduce `N` soldiers to `1` in minimum moves. Moves available: 1. Reduce by 1. 2. Reduce by half (rounding down). 3. Reduce by two-thirds (rounding down). The resulting number of soldiers must always be an integer > 0. **Constraints:** - `1 <= N <= 10^18`
Enemy Grid
Active`N x M` grid. `*` is block, `A` is invaded, `E` is enemy. At each second, any `E` adjacent to `A` gets invaded and becomes `A`. Find minimum time to invade all `E`s, or `-1` if impossible. **Constraints:** - `1 <= N, M <= 1000`
Hack With Infy - Medium(6-10)
Medium level problems from Hack With Infy.
Infosys Hard Q6
ActiveProblem description for Q6. Solve this problem efficiently within the time limits.
Infosys Hard Q7
ActiveProblem description for Q7. Solve this problem efficiently within the time limits.
Infosys Hard Q8
ActiveProblem description for Q8. Solve this problem efficiently within the time limits.
Infosys Hard Q9
ActiveProblem description for Q9. Solve this problem efficiently within the time limits.
Infosys Hard Q10
ActiveProblem description for Q10. Solve this problem efficiently within the time limits.
Hack With Infy - Hard(11-14)
Hard level problems from Hack With Infy.
Infosys Hard Q11
ActiveProblem description for Q11. Solve this problem efficiently within the time limits.
Infosys Hard Q12
ActiveProblem description for Q12. Solve this problem efficiently within the time limits.
Infosys Hard Q13
ActiveProblem description for Q13. Solve this problem efficiently within the time limits.
Infosys Hard Q14
ActiveProblem description for Q14. Solve this problem efficiently within the time limits.