Tip 1 : Be very clear with your project explaination.
Tip 2 : Also try to cover all the cs core subjects explaination clearly.
Tip 1 : Make it clean with appropriate knowledge.
Tip 2 : Provide true information and avoid telling lie in which You are not sure.
It was morning time and from 9:00 am . It happened via the google meet online process and it was very smooth onboarding . Interviewer was very friendly kind of nature .



Input:
'num1' : 1 -> 2 -> 3 -> NULL
'num2' : 4 -> 5 -> 6 -> NULL
Output: 5 -> 7 -> 9 -> NULL
Explanation: 'num1' represents the number 321 and 'num2' represents 654. Their sum is 975.
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;
}
};
It was again the morning session and the interviewer was very supportive in nature and gave me the hint too to think the approach and finally i came up the solution which he was expecting.



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));
}
It was late evening and happened in a very smooth way.
Ques: What is thread in OS?
Ans: Thread is a path of execution that is composed of a program counter, thread id, stack, and set of registers within the process. It is a basic unit of CPU utilization that makes communication more effective and efficient, enables utilization of multiprocessor architectures to a greater scale and greater efficiency, and reduces the time required in context switching. It simply provides a way to improve and increase the performance of applications through parallelism. Threads are sometimes called lightweight processes because they have their own stack but can access shared data.
Multiple threads running in a process share: Address space, Heap, Static data, Code segments, File descriptors, Global variables, Child processes, Pending alarms, Signals, and signal handlers.
Each thread has its own: Program counter, Registers, Stack, and State.
ques:What do you mean by FCFS?
Ans: FCFS (First Come First Serve) is a type of OS scheduling algorithm that executes processes in the same order in which processes arrive. In simple words, the process that arrives first will be executed first. It is non-preemptive in nature. FCFS scheduling may cause the problem of starvation if the burst time of the first process is the longest among all the jobs. Burst time here means the time that is required in milliseconds by the process for its execution. It is also considered the easiest and simplest OS scheduling algorithm as compared to others. Implementation of FCFS is generally managed with help of the FIFO (First In First Out) queue

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?