Tip 1 : Data structures and algorithms are the most fundamental and important thing to prepare.
Tip 2 : Don't ignore OOPS.
Tip 3 : Solve DSA questions regularly.
Tip 1 : Avoid unnecessary details like hobbies, date of birth, parent's name, photo, etc., and keep it one-pager.
Tip 2 : Add a link to your GitHub, LinkedIn, website, phone number, etc.
I solved almost all the MCQs correctly and passed all the test cases for both the questions.
For example:
If the given array is {1, 5, 2, 3, 4}, the output will be 2 (which is GCD of 2 and 4, all other pairs have a GCD of 1)
Let’s assume, we have 5 buckets each having 10, 40, 30, and 20 fruits respectively. And, Kevin wants to eat at least 30 fruits.
Now, if we set our marker at 20 then Kevin can eat: (10 - 20) = -10 => 0 (fruit’s count can’t be negative) fruits from 1st bucket, (40 - 20) = 20 fruits from 2nd bucket, (30 - 20) = 10 fruits from the third bucket, and (20 - 20) = 0 fruits from the last bucket.
So, he can eat 0 + 20 + 10 + 0 = 30 fruits in total.
Each bucket may not have the same amount of fruits. It is guaranteed that the sum of all fruits (including all the buckets) will be greater than M. Kevin can only eat fruits from a particular bucket if and only if the bucket has more fruits than the marker.
If S = (pq)()
Then the output will be 1 1 2 2. First pair of opening and closing brackets will get the same number and so does the 2nd pair.
You have to return the deepest node which has both x, y as its descendants.
There may be cases where one of u or v is not present in the tree. In those cases, the reference provided to u or v will be NULL.
Threading, Process, Semaphore, Deadlock, hashmap implementation, time complexity. (Learn)
I solved it using heaps.
We can use a max heap on the left side to represent elements that are less than the effective median, and a min-heap on the right side to represent elements that are greater than the effective median.
After processing an incoming element, the number of elements in heaps differs utmost by 1 element. When both heaps contain the same number of elements, we pick the average of heaps root data as the effective median. When the heaps are not balanced, we select an effective median from the root of the heap containing more elements.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which SQL keyword removes duplicate records from a result set?