Tip 1: Be very clear when explaining your projects.
Tip 2: Ensure you cover all core Computer Science subjects thoroughly in your explanations.
Tip 1: Ensure your explanations are clear and demonstrate appropriate knowledge.
Tip 2: Provide truthful information and avoid discussing topics you are unsure about.
The interview took place in the morning via Google Meet starting from 10:00 am. The online process was smooth, and the interviewer was friendly.



Note: Since the number of ways can be very large, return the answer modulo 1000000007.
N=3

We can climb one step at a time i.e. {(0, 1) ,(1, 2),(2,3)} or we can climb the first two-step and then one step i.e. {(0,2),(1, 3)} or we can climb first one step and then two step i.e. {(0,1), (1,3)}.
int countWays(int n)
{
if(n == 1) return n;
int mod = 1000000000 + 7;
int prev = 2, prev2 = 1, curr = 0;
for(int i = 2 ; i < n ; i++){
curr = (prev + prev2) % mod;
prev2 = prev;
prev = curr;
}
return prev ;
}
It was again the morning session and the interviewer was very supportive and gave me the hint too to think about the approach finally I came up with the solution that he was expecting.



You are given ‘mat’ = [[1, 2, 2,], [3, 3, 4], [5, 6 ,7]]] and ‘K’ = 5, the elements of the matrix are [1, 2, 2, 3, 3, 4, 5, 6, 7], the 5th smallest element in the matrix is 3. Hence the answer is 3.
#include
using namespace std;
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str)
{
// Corner Case
if(str.length() == 0 || str[0] == 'N')
return NULL;
// Creating vector of strings from input
// string after spliting by space
vector ip;
istringstream iss(str);
for(string str; iss >> str; )
ip.push_back(str);
// Create the root of the tree
Node* root = new Node(stoi(ip[0]));
// Push the root to the queue
queue queue;
queue.push(root);
// Starting from the second element
int i = 1;
while(!queue.empty() && i < ip.size()) {
// Get and remove the front of the queue
Node* currNode = queue.front();
queue.pop();
// Get the current node's value from the string
string currVal = ip[i];
// If the left child is not null
if(currVal != "N") {
// Create the left child for the current node
currNode->left = new Node(stoi(currVal));
// Push it to the queue
queue.push(currNode->left);
}
// For the right child
i++;
if(i >= ip.size())
break;
currVal = ip[i];
// If the right child is not null
if(currVal != "N") {
// Create the right child for the current node
currNode->right = new Node(stoi(currVal));
// Push it to the queue
queue.push(currNode->right);
}
i++;
}
return root;
}
// } Driver Code Ends
/*The Node structure is defined as
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
*/
// return the Kth largest element in the given BST rooted at 'root'
class Solution
{public:
void solve(Node*root,int k,int&c,int &ans){
if(root==NULL||c>=k){
return ;
}
solve(root->right,k,c,ans);
c++;
if(c==k){
ans=root->data;
return;
}
solve(root->left,k,c,ans);
}
public:
int kthLargest(Node *root, int k)
{
int c=0;int ans;
solve(root,k,c,ans);
return ans;
}
};
// { Driver Code Starts.
int main()
{
int t;
cin>>t;
getchar();
while(t--)
{
string s;
getline(cin,s);
Node* head = buildTree(s);
int k;
cin>>k;
getchar();
Solution ob;
cout << ob.kthLargest( head, k ) << endl;
}
return 1;
} }
It was late evening and happened in a very smooth way.

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