Tip 1 : Strong fundamentals of Data Structures and Algorithms in any programming language (JAVA preferred).
Tip 2 : Practice Logical Reasoning and Quantitative Aptitude in basic problems.
Tip 3 : Make sure you practice your communication skills before the Interview and also your English Proficiency
Tip 1: Make sure your mentioned skills are justified by either projects or any internship experience.
Tip 2: Follow an ATS-friendly format and always add sections like extracurricular and positions of responsibility.



1. Push(num): Push the given number in the stack if the stack is not full.
2. Pop: Remove and print the top element from the stack if present, else print -1.
3. Top: Print the top element of the stack if present, else print -1.
4. isEmpty: Print 1 if the stack is empty, else print 0.
5. isFull: Print 1 if the stack is full, else print 0.
We perform the following operations on an empty stack which has capacity 2:
When operation 1 1 is performed, we insert 1 in the stack.
When operation 1 2 is performed, we insert 2 in the stack.
When operation 2 is performed, we remove the top element from the stack and print 2.
When operation 3 is performed, we print the top element of the stack, i.e., 3.
When operation 4 is performed, we print 0 because the stack is not empty.
When operation 5 is performed, we print 0 because the stack is size 1, which is not equal to its capacity.
Declare an array of particular size.
Define a variable “Top” and initialize it as -1.
push(x): insert element in the array by increasing top by one.
pop(): check whether top is not equal to -1 if it is so, return top and decrease its value by one.
size(): return top+1.



Consider the array 'ARR' = { "ab", "aa" } and the string 'S' = "aabab".
The substring "ab" is present at index 1 and index 3 of the String 'S' and the substring "aa" is present at index 0 of the String S.
Brute force: We will use 2 nested loops, the outer loop will iterate through a text string and the inner loop will iterate through the pattern string. If we find a match, we will print the index and move on to find further patterns, whether they are present in the text or not. We will slide the pattern string over the text string one by one. If we get a match, we will print the index and slide by 1 to check the remaining string.
Worked fine as constraints were small but it can be solved using the Rabin-Karp Algorithm.



For the given binary search tree and k = 3

The 3rd smallest node is highlighted in yellow colour.
Here, we first take the input array and insert all elements of the array into a BST.
After that, we take a variable K.
Then, I have to find the Kth largest and smallest element in the BST.
So, I created two functions: one is kthlargest and the other is kthsmallest.
The first function gives us the Kth largest element of that BST, and the second function gives us the Kth smallest element of that BST.
Both functions have two arguments: one is root and another is K. In the kthlargest element function, I call that function in reverse inorder traversal. That means, first right subtree, then the root, and lastly the left subtree. I decrement K by 1 in each function because the maximum value of that BST is the right-most subtree value. Thus, we decrement K by 1 in each function. If at any instance we find K equal to 0, then we simply return the root (which is our desired value). The question is why we reduce K by 1? Because we traverse like reverse inorder traversal, so if we construct an array by traversal, the 0 indexed value will be the rightmost value and the next value will be the next function which terminated after that.
Now, for the kthsmallest element, it's the same as the kthlargest element except for one change: here we follow inorder traversal because we will get the element in sorted order. Therefore, we call the left subtree first, then the root, and then the right subtree. We decrement K by 1 in each function. If at any instance we find K equal to 0, then we return the root. If any function finds that root is equal to NULL, then return NULL.
The round began with greetings with the interviewer and an ID check, which was an Aadhar Card. Then the interview began with an introduction in which I briefed him on my schooling background, current education field, technical skills, projects I had made, hackathons and technical events I participated in, and extra-curricular activities. I ended the introduction with a description of my hobbies. Then the interviewer asked me some technical questions on data structures, like what an array, stack, etc., is. I answered them all correctly. After that, he shared a link to an online code editor, and then came the coding questions.
Implement Email verification function in javascript. (Learn)
Just write simple javascript function which return true or false and within it check things such as length of email and it contains @ and . extension or not.
Write a program in JAVA to calculate the Simple Interest of a given Principal, Rate and Time. (Learn)
Given the weight of a bag of rice, you want to divide it between two families such that each family gets 50% of the total rice and each member gets 20%. Find the total number of members and rice obtained by them. Assume all rice is distributed.
Tip 1: Total weight is 20kg, so 50% will be 10kg. Each family gets 10kg.
Tip 2: Each member gets 20% of 10kg, which means 2kg each. Assuming all rice is distributed, 10/2 = 5.
Tip 3: Each family had five members.
Basic HR Round
The interviewer asked me about my projects and the challenges while working on them. The interviewer asked me about my strengths and weaknesses.
Why do you want to join Cognizant?
I am okay with relocating across PAN India.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
To make an AI less repetitive in a long paragraph, you should increase: