Tip 1: Be consistent.
Tip 2: Try to do a variety of questions.
Tip 1: Have at least 1 project on your resume.
Tip 2: Ensure your resume is strictly one page only.
Tip 3: Include achievements, such as achieving a good rank in a coding contest, to help you stand out
It was at 2 pm in the afternoon time.



Input:
4 5
0 1 5
0 2 8
1 2 9
1 3 2
2 3 6

In the given input, the number of vertices is 4, and the number of edges is 5.
In the input, following the number of vertices and edges, three numbers are given. The first number denotes node ‘X’, the second number denotes node ‘Y’ and the third number denotes the distance between node ‘X’ and ‘Y’.
As per the input, there is an edge between node 0 and node 1 and the distance between them is 5.
The vertices 0 and 2 have an edge between them and the distance between them is 8.
The vertices 1 and 2 have an edge between them and the distance between them is 9.
The vertices 1 and 3 have an edge between them and the distance between them is 2.
The vertices 2 and 3 have an edge between them and the distance between them is 6.
1. There are no self-loops(an edge connecting the vertex to itself) in the given graph.
2. There can be parallel edges i.e. two vertices can be directly connected by more than 1 edge.
Follow the steps below to solve the problem:
Create a set sptSet (shortest path tree set) that keeps track of vertices included in the shortest-path tree, i.e., whose minimum distance from the source is calculated and finalized. Initially, this set is empty.
Assign a distance value to all vertices in the input graph. Initialize all distance values as INFINITE. Assign the distance value as 0 for the source vertex so that it is picked first.
While sptSet doesn’t include all vertices
Pick a vertex u which is not there in sptSet and has a minimum distance value.
Include u to sptSet.
Then update distance value of all adjacent vertices of u.
To update the distance values, iterate through all adjacent vertices.
For every adjacent vertex v, if the sum of the distance value of u (from source) and weight of edge u-v, is less than the distance value of v, then update the distance value of v.
Note: We use a boolean array sptSet[] to represent the set of vertices included in SPT. If a value sptSet[v] is true, then vertex v is included in SPT, otherwise not. Array dist[] is used to store the shortest distance values of all vertices.


Input: ‘N’ = 5, ‘K’ = 4, ‘NUMS’ = [ 1, 2, 1, 0, 1 ]
Output: 4
There are two subarrays with sum = 4, [1, 2, 1] and [2, 1, 0, 1]. Hence the length of the longest subarray with sum = 4 is 4.
An efficient solution is while traversing the array, storing sum so far in currsum. Also, maintain the count of different values of currsum in a map. If the value of currsum is equal to the desired sum at any instance increment count of subarrays by one.
The value of currsum exceeds the desired sum by currsum – sum. If this value is removed from currsum then the desired sum can be obtained. From the map, find the number of subarrays previously found having sum equal to currsum-sum. Excluding all those subarrays from the current subarray, gives new subarrays having the desired sum.
So increase count by the number of such subarrays. Note that when currsum is equal to the desired sum then also check the number of subarrays previously having a sum equal to 0. Excluding those subarrays from the current subarray gives new subarrays having the desired sum. Increase the count by the number of subarrays having sum 0 in that case.
After the OA, the results were declared shortly, and I was informed that my interview would be at 5 pm, so I was ready. The interviewer has 3 years of experience. They asked about my internship experience, then presented 2 dynamic programming questions to solve on HackerRank CodePair. Afterward, they inquired about my hobbies.



1234 is represented as (1 -> 2 -> 3 -> 4) and adding 1 to it should change it to (1 -> 2 -> 3 -> 5).
The input Linked list does not have any trailing zeros.
We can recursively reach the last node and forward the carry to previous nodes. A recursive solution doesn’t require reversing the linked list. Alternatively, we can use a stack in place of recursion to temporarily hold nodes.



Create a Deque, Qi, with capacity K, that stores only the useful elements of the current window of size K. An element is considered useful if it is in the current window and is greater than all other elements to its right within the window. Process all array elements one by one and maintain Qi to contain the useful elements of the current window, sorted in ascending order. The element at the front of Qi is the largest, and the element at the rear/back of Qi is the smallest of the current window.
The interview was conducted by an experienced individual with 7 years of experience. He introduced himself and then asked me to do the same. He inquired about some object-oriented programming concepts and then asked about my internship experience. Following that, he questioned why I didn't receive a PPO offer from my previous company and asked about my overall experience there. He also asked about my corporate experience.
Later, he presented a coding question. After I attempted to solve it, he asked me to design a URL shortener. Since I lacked knowledge in system design, this question was completely new and challenging for me. I tried to provide a solution, but it wasn't satisfactory, as I didn't have enough knowledge in the area.



class BinaryTreeNode {
int data; // Value of the node.
BinaryTreeNode *left; // Pointer to left child node.
BinaryTreeNode *right; // Pointer to right child node.
BinaryTreeNode *next; // Pointer to next right node at same level.
}
Consider the figure shown below. The left part represents the initial binary tree and right part represents the binary tree after connecting adjacent nodes at the same level.

In the tree shown in the picture above -:
The ‘next’ pointer of the node having value 2 is connected to the node having value 3.
The ‘next’ pointer of the node having value 4 is connected to the node having value 5.
The ‘next’ pointer of the node having value 5 is connected to the node having value 6.
The ‘next’ pointer of nodes having value 1, 3, 6 will have a value NULL as there are no next right nodes in their cases.
1. The structure of the ‘Node’ of a binary tree is already defined. You should not change it.
2. The root of the binary tree is known to you.
3. There is at least one node in the given binary tree.
4. You may only use constant extra space.
Follow the below steps to Implement the idea:
1.Initialize a node pointer Prev to NULL and a queue of node pointer Q.
2.Traverse the tree in Breadth-first search order starting from the root.
3.Calculate the size sz of the Q and run a for loop from 0 to sz – 1.
4.If prev is Null then set prev to the current node.
5.Else set prev’s next to the current node and prev to the current node.
6.Set prev’s next to Null and prev to Null.
7.If the current node’s left is not null push it into the queue.
8.If the current node’s right is not null push it into the queue.
Design a URL shortener capable of handling a large load
Tell me which data structures you would use and why.
How can you optimize it.

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