"Tip 1: Graphs should be at your fingertips.
Tip 2: While explaining the solution to the interviewer, don't just hop onto the most optimal solution. Start with the brute force approach, discuss its cons, and then go step by step until you reach the optimal solution.
Tip 3: Improve your communication skills as well.
Tip 1: Mention only what is required for your profile; for example, do not stress too much on your co-curricular activities. Rather, try explaining more of your technical skills that are relevant to the job.
Tip 2: Keep it limited to one page, and make sure it is a PDF and not an image.
The interviewer asked me two coding questions. First, I have given the brute force approach and optimized each approach.



In the given linked list, there is a cycle, hence we return true.

You are given a Singly Linked List of integers. Return true, if it has a cycle, else return false.
A cycle occurs when a node's next points back to a previous node in the list.



You are given an array 'arr' of length 'n', consisting of integers.
A subarray is a contiguous segment of an array. In other words, a subarray can be formed by removing 0 or more integers from the beginning and 0 or more integers from the end of an array.
Find the sum of the subarray (including empty subarray) having maximum sum among all subarrays.
The sum of an empty subarray is 0.



The Linked Lists, where a1, a2, c1, c2, c3 is the first linked list and b1, b2, b3, c1, c2, c3 is the second linked list, merging at node c1.

First, I suggested the brute force approach in which we check each element of the first linked list with each element of another linked list and then moved on to the better-optimized solution using linked list traversal based on the difference of lengths of both linked lists.



The solution involved concepts like Hash Maps & arrays. I was asked to write down the complete code after discussing the approach with the interviewer. She read the complete code, ran through a test case and it worked on pen and paper.



Each pair should be sorted i.e the first value should be less than or equals to the second value.
Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
The basic approach to solve this problem is by nested traversal.
Traverse the array using a loop
For each element:
Check if there exists another in the array with sum as x
Return true if yes, else continue
If no such pair is found, return false



We can simply take square root of ‘a’ and square root of ‘b’ and count the perfect squares between them using
floor(sqrt(b)) - ceil(sqrt(a)) + 1
We take floor of sqrt(b) because we need to consider
numbers before b.
We take ceil of sqrt(a) because we need to consider
numbers after a.
For example, let b = 24, a = 8. floor(sqrt(b)) = 4,
ceil(sqrt(a)) = 3. And number of squares is 4 - 3 + 1
= 2. The two numbers are 9 and 16.

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