Tip 1: Practice as many questions as needed until you gain enough confidence in yourself.
Tip 2: Try to practice the hardest questions you can.
Tip 1: Include some projects on your resume.
Tip 2: Do not include false information on your resume.


If the array given is 'TRIANGLE' = [[1], [2,3], [3,6,7], [8,9,6,1]] the triangle array will look like:
1
2,3
3,6,7
8,9,6,10
For the given triangle array the minimum sum path would be 1->2->3->8. Hence the answer would be 14.
The problem can be solved using a dynamic programming approach, where we update each cell in the triangle by adding the minimum possible path sum from the previous row.
1. Start from the second row and update each element based on the minimum path sum from the row above.
2. The first and last elements of each row can only come from one direction (left or right diagonal).
3. For other elements, take the minimum sum from the two possible previous positions.
4. After updating the triangle, the minimum value in the last row gives the answer.

Let 'N' = 4, 'A' = [3, 5, 1, 2] and 'M' = 20.
Let's check if a subsequence of length k = 2 is possible. To minimize the score, we choose the elements that have the smallest contribution ( i * k + A[i-1] ).
The contributions for k = 2 are:
For index 1 (value 3): 1 * 2 + 3 = 5
For index 2 (value 5): 2 * 2 + 5 = 9
For index 3 (value 1): 3 * 2 + 1 = 7
For index 4 (value 2): 4 * 2 + 2 = 10
The two smallest contributions are 5 and 7. The minimum score for a subsequence of length 2 is 5 + 7 = 12.
Since 12 <= 20, a subsequence of length 2 is possible.
Let's check for k = 3. The contributions would be ( i * 3 + A[i-1] ). The sum of the three smallest contributions is (1*3+3) + (3*3+1) + (2*3+5) = 6 + 10 + 11 = 27.
Since 27 > 20, a subsequence of length 3 is not possible.
Therefore, the answer is 2.
It is just a simple binary search. If we have the value of k = mid, just select the k-smallest i * k + a[i] and calculate the sum.


1. Both the strings are non-empty and are of the same length.
2. You can apply the above operations any number of times on ‘S’.
3. The operations can only be applied on the string ‘S’.
4. ‘S’ and 'R' consist of lowercase letters only.
In order to solve this problem, we are using the Divide and Conquer approach.
Given two strings of equal length (say n+1), S1[0…n] and S2[0…n]. If S2 is a scrambled form of S1, then there must exist an index i such that at least one of the following conditions is true:
1. S2[0…i] is a scrambled string of S1[0…i] and S2[i+1…n] is a scrambled string of S1[i+1…n].
2. S2[0…i] is a scrambled string of S1[n-i…n] and S2[i+1…n] is a scrambled string of S1[0…n-i-1].
Design a data structure for LRU Cache.
The idea is to use an array to store nodes, where each node holds a key-value pair. The primary operations, get and put, have a time complexity of O(n) due to the need to search through the array. The size of the array will be equal to the given capacity of the cache.
It's a standard problem—you can search for it on the internet and find a detailed solution and approach.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?