Tip 1 : Solve medium level of LeetCode and GFG
Tip 2 : Good understanding of your project
Tip 3 : Mention only that thing in resume in which you are confident
Tip 1 : Mention good projects and highlights your skill
Tip 2 : Mention your codeforce/codechef rating



If two or more such subarrays exist, return any subarray.
Traverse the array from start to end.
From every index start another loop from i to the end of the array to get all subarrays starting from i, and keep a variable currentSum to calculate the sum of every subarray.
For every index in inner loop update currentSum = currentSum + arr[j]
If the currentSum is equal to the given sum then print the subarray.



Input: Let the binary tree be:

Output: [10, 4, 2, 1, 3, 6]
Explanation: Consider the vertical lines in the figure. The top view contains the topmost node from each vertical line.
This approach is based on the level order traversal. We’ll keep a record of the current max so far left, right horizontal distances from the root.
And if we found less distance (or greater in magnitude) then max left so far distance then update it and also push data on this node to a stack (stack is used because in level order traversal the left nodes will appear in reverse order), or if we found greater distance then max right so far distance then update it and also push data on this node to a vector.



1. If ‘k’ is not present in the array, then the first and the last occurrence will be -1.
2. 'arr' may contain duplicate elements.
Input: 'arr' = [0,1,1,5] , 'k' = 1
Output: 1 2
Explanation:
If 'arr' = [0, 1, 1, 5] and 'k' = 1, then the first and last occurrence of 1 will be 1(0 - indexed) and 2.



Input: 'a' = [2, 4, 6] and 'b' = [1, 3, 5]
Output: 3.5
Explanation: The array after merging 'a' and 'b' will be { 1, 2, 3, 4, 5, 6 }. Here two medians are 3 and 4. So the median will be the average of 3 and 4, which is 3.5.
The given arrays are sorted, so merge the sorted arrays in an efficient way and keep the count of elements inserted in the output array or printed form. So when the elements in the output array are half the original size of the given array print the element as a median element. There are two cases:
Case 1: m+n is odd, the median is at (m+n)/2 th index in the array obtained after merging both the arrays.
Case 2: m+n is even, the median will be the average of elements at index ((m+n)/2 – 1) and (m+n)/2 in the array obtained after merging both the arrays



You don’t have to multiply the matrices, you only have to find the minimum number of multiplication operations.
ARR = {2, 4, 3, 2}
Here, we have three matrices with dimensions {2X4, 4X3, 3X2} which can be multiplied in the following ways:
a. If the order of multiplication is (2X4, 4X3)(3X2), then the total number of multiplication operations that need to be performed are: (2*4*3) + (2*3*2) = 36
b. If the order of multiplication is (2X4)(4X3, 3X2), then the total number of multiplication operations that need to be performed are (2*4*2) + (4*3*2) = 40
Create a recursive function that takes i and j as parameters that determines the range of a group.
Iterate from k = i to j to partition the given range into two groups.
Call the recursive function for these groups.
Return the minimum value among all the partitions as the required minimum number of multiplications to multiply all the matrices of this group.
The minimum value returned for the range 0 to N-1 is the required answer.




The idea is to write a recursive function isMirror() that takes two trees as an argument and returns true if trees are the mirror and false if trees are not mirrored. The isMirror() function recursively checks two roots and subtrees under the root.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?