Tip 1: Practise leetcode questions as much as possible.
Tip 2: Try to come up with Optimised solution always.
Tip 3: Try using c++ for the online assessments.
Tip 1: Keep it to one side
Tip 2: Only add the things necessary for the role that you're applying for.
Tip 3: Don't lie in the resume and add projects related to the role.
Tip 4: Add any volunteering work that you did.
It was an online assessment. I was given 2 questions to complete.
Can you solve each query in O(logN) ?
Step 1: int right(0) initializing right as zero and left(0) initializing left as zero
taking sum of all the element and assigning it to right
Step 2: running a loop through the whole array from left to right (i=0 --> n-1)
Step 3: at every step to find the if right sum = left sum we subtract current element from the array i.e. nums[i]
hence right-=nums[i]
Step 4: by implementing step 3 we check if right is equal to left now or not
if(left == right) return i;
Step 5: and if nothing is returned this step will be executed. the subtracted element from right is added to left
left += nums[i] loop is closed here
Step 6: return -1 out of loop implying no pivot found
by implementing these step we are trying to see at which element right sum becomes equal to left sum and we return index of that element.
Using HashMap
First we will create map for counting frequencies of each element in the array.
Now we have 2 cases over here as
-->a) if k == 0 it means we need to count frequency of the same element by using map.get(i) method.
-->b) we need to take counter approach for every element by adding k everytime and check whether that element is present in map or not.
Instead of iterating through array, we will iterate through map.keySet() for getting unique elements.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is 3 + 2 * 4 based on operator precedence?