Tip 1 : Practice from coding platforms, solve medium level problems.
Tip 2 : Brush up computer fundamentals from subjects like OS, DBMS and CN.
Tip 3 : Have a good project or good internship experience and have in-depth knowledge regarding what you have done.
Tip 1 : Have some projects on resume.
Tip 2: Do not put false things on resume



1. The given graph may have self-loops and parallel edges.
Consider ‘N’ = 4, ‘EDGES’ = [[0, 1], [0, 3], [1, 2], [3, 2]], ‘SRC’ = 0 and ‘DEST’ = 2. The given directed graph is shown below.

Here, all the paths that start from node 0 are -:
1. 0->1->2
2. 0->3->2
Both of these paths eventually end at node ‘2’ i.e node ‘DEST’. Thus we should return True.
The idea is to do Depth First Traversal of given directed graph.
Start the DFS traversal from source.
Keep storing the visited vertices in an array or HashMap say ‘path[]’.
If the destination vertex is reached, print contents of path[].
The important thing is to mark current vertices in the path[] as visited also so that the traversal doesn’t go in a cycle.
I was given a wireframe of a dashboard and was asked to create a similar-looking dashboard using Angular and Node.js.
Tip 1 : Structure your code well.
Tip 2 : Be thorough with the whats and whys of the implementation.
Tip 3 : See that the project runs, and you can demo it.



PROGRAM:
class Solution
{
public:
//Function to add two numbers represented by linked list.
Node*reverse(struct Node*head){
Node*curr=head;
Node*prev=NULL;
Node*nxt;
while(curr!=NULL){
nxt=curr->next;
curr->next=prev;
prev=curr;
curr=nxt;
}
return prev;
}
public:
struct Node* addTwoLists(struct Node* first, struct Node* second)
{
// code here
first=reverse(first);
second=reverse(second);
int c=0;
int s=0;
Node*temp;
Node*cur;
Node*res=NULL;
while(first!=NULL||second!=NULL){
s=c+(first?first->data:0)+(second?second->data:0);
if(s>9){
c=1;
}
else{
c=0;
}
s=s%10;
temp=new Node(s);
if(res==NULL)res=temp;
else{
cur->next=temp;
}
cur=temp;
if(first)first=first->next;
if(second)second=second->next;
}
if(c!=0){
temp=new Node(c);
cur->next=temp;
cur=temp;
}
res=reverse(res);
return res;
}
};



Input: Given linked list is:

Output:
1 → 2 → 3 → 4 → 5 → 6 → 7 → 8 → 9 → 12 → 20 → null.
Explanation:
The returned linked list should be in a sorted order. All the elements in this returned linked list are connected by 'child' pointers and 'next' pointers point to null.
PROGRAM:
Node*merge(Node*a,Node*b){//a=root b=root ka right wala
if(a==NULL)return b;
if(b==NULL)return a;
Node*res;
if(a->datadata)
{
res=a;
res->bottom=merge(a->bottom,b);
}
else{
res=b;
res->bottom=merge(a,b->bottom);
}
res->next=NULL;
return res;
}
Node *flatten(Node *root)
{
if(root==NULL || root->next==NULL)return root;
return merge(root,flatten(root->next));
}



Sort each row of the array and pick the maximum element from each to get the maximum sum.



1. Constructor:
It initializes the data members(queues) as required.
2. push(data) :
This function should take one argument of type integer. It pushes the element into the stack and returns nothing.
3. pop() :
It pops the element from the top of the stack and, in turn, returns the element being popped or deleted. In case the stack is empty, it returns -1.
4. top :
It returns the element being kept at the top of the stack. In case the stack is empty, it returns -1.
5. size() :
It returns the size of the stack at any given instance of time.
6. isEmpty() :
It returns a boolean value indicating whether the stack is empty or not.
Query-1(Denoted by an integer 1): Pushes an integer data to the stack. (push function)
Query-2(Denoted by an integer 2): Pops the data kept at the top of the stack and returns it to the caller. (pop function)
Query-3(Denoted by an integer 3): Fetches and returns the data being kept at the top of the stack but doesn't remove it, unlike the pop function. (top function)
Query-4(Denoted by an integer 4): Returns the current size of the stack. (size function)
Query-5(Denoted by an integer 5): Returns a boolean value denoting whether the stack is empty or not. (isEmpty function)
Operations:
1 5
1 10
2
3
4
Enqueue operation 1 5: We insert 5 at the back of the queue.
Queue: [5]
Enqueue operation 1 10: We insert 10 at the back of the queue.
Queue: [5, 10]
Dequeue operation 2: We remove the element from the front of the queue, which is 5, and print it.
Output: 5
Queue: [10]
Peek operation 3: We return the element present at the front of the queue, which is 10, without removing it.
Output: 10
Queue: [10]
IsEmpty operation 4: We check if the queue is empty.
Output: False
Queue: [10]
Make sure that the newly entered element is always at the front of 'q1', so that the pop operation just dequeues from 'q1'. 'q2' is used to place every new element at the front of 'q1'.

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