Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
This round had 2 coding questions where in I was first asked to explain my approach and then code the solution . After that , I was asked some more questions on OOPS and Java.



We cannot use the element at a given index twice.
Try to do this problem in O(N) time complexity.
Approach :
1) We can store the frequency of every element in the array in a hashmap.
2) We will loop over every index i, and check the frequency of (Target - ARR[i]) is the hashmap:
2.1) If (Target - ARR[i]) is equal to ARR[i], we will check if frequency of ARR[i] . If it is greater than 1 then we will decrease the frequency of ARR[i] by 2 and add a pair (ARR[i] , ARR[i]) to our answer.
2.2) Else, if the frequency of ARR[i] and Target - ARR[i] is greater than equal to 1 then we add pair (ARR[i], Target - ARR[i]) to our answer and decrease the frequency of both by 1.
3) If no valid pairs exist, we will return [[-1,-1]].
TC : O(N) , where N = size of the array
SC : O(N)



The Linked Lists, where a1, a2, c1, c2, c3 is the first linked list and b1, b2, b3, c1, c2, c3 is the second linked list, merging at node c1.

Approach :
1) Calculate the length of both the lists, say len1 and len2
2) Get the absolute difference of the lengths, diff = |len1 – len2|
3) Now traverse the long list from the first node till ‘diff’ nodes so that from there onwards both the lists have equal number of nodes
4) Then traverse both the lists in parallel and check whether a common node is reached (Note that getting a common node is done by comparing the address of the nodes, not the data)
4.1) If yes, return that node’s data
4.2) If no, return -1
TC : O(N) , where N = max length of the linked list
SC : O(1)
When can you use super keyword?
The super keyword is used to access hidden fields and overridden methods or attributes of the parent class.
Following are the cases when this keyword can be used :
1) Accessing data members of parent class when the member names of the class and its child subclasses are same.
2) To call the default and parameterized constructor of the parent class inside the child class.
3) Accessing the parent class methods when the child classes have overridden them.
What do you mean by data encapsulation?
1) Data Encapsulation is an Object-Oriented Programming concept of hiding the data attributes and their behaviors in a single unit.
2) It helps developers to follow modularity while developing software by ensuring that each object is independent of other objects by having its own methods, attributes, and functionalities.
3) It is used for the security of the private properties of an object and hence serves the purpose of data hiding.
What do you know about JIT compiler?
JIT Compiler :
1) JIT stands for Just-In-Time and it is used for improving the performance during run time. It does the task of compiling parts of byte code having similar functionality at the same time thereby reducing the amount of compilation time for the code to run.
2) The compiler is nothing but a translator of source code to machine-executable code.
Working of JIT Compiler :
1) First, the Java source code (.java) conversion to byte code (.class) occurs with the help of the javac compiler.
2) Then, the .class files are loaded at run time by JVM and with the help of an interpreter, these are converted to machine understandable code.
3) JIT compiler is a part of JVM. When the JIT compiler is enabled, the JVM analyzes the method calls in the .class files and compiles them to get more efficient and native code. It also ensures that the prioritized method calls are optimized.
4) Once the above step is done, the JVM executes the optimized code directly instead of interpreting the code again. This increases the performance and speed of the execution.
Explain the use of final keyword in variable, method and class.
In Java, the final keyword is used as defining something as constant /final and represents the non-access modifier.
1) final variable :
1.1) When a variable is declared as final in Java, the value can’t be modified once it has been assigned.
1.2) If any value has not been assigned to that variable, then it can be assigned only by the constructor of the class.
2) final method :
2.1) A method declared as final cannot be overridden by its children's classes.
2.2) A constructor cannot be marked as final because whenever a class is inherited, the constructors are not inherited. Hence, marking it final doesn't make sense. Java throws compilation error saying - modifier final not allowed here
3) final class :
3.1) No classes can be inherited from the class declared as final. But that final class can extend other classes for its usage.
This round had 1 coding question related to Backtracking followed by some more questions from DBMS and SQL.



Here, sorted paths mean that the expected output should be in alphabetical order.
Given a square matrix of size 4*4 (i.e. here 'N' = 4):
1 0 0 0
1 1 0 0
1 1 0 0
0 1 1 1
Expected Output:
DDRDRR DRDDRR
i.e. Path-1: DDRDRR and Path-2: DRDDRR
The rat can reach the destination at (3, 3) from (0, 0) by two paths, i.e. DRDDRR and DDRDRR when printed in sorted order, we get DDRDRR DRDDRR.
Approach :
1) Take the starting position of the rat as (0, 0) and start traversing the valid cells (which are unblocked, i.e. with value 1) through adjacent cells in the following order Down -> Left -> Right -> Up so that we can automatically get sorted paths in alphabetical order.
2) Create another matrix/grid called ‘VISITED’ to keep track of all visited and unvisited cells
3) Recursively look for the valid set of paths possible from the starting cell until we reach the destination or an invalid cell. We keep setting the respective ‘VISITED’ matrix/grid value of the cell to true. I.e.:-
4) If the move is possible, then move to that cell while storing the character corresponding to the move, i.e. either (D, L, R, U) and recursively start looking for a valid move until the destination (i.e. (n - 1, n - 1)) is reached by the rat.
5) Keep marking the cells as visited. When all the paths possible are traversed from that cell, unmark that cell for other different paths and remove the character from the path formed.
6) As soon as the last index of the grid(bottom right), our destination is reached, we store the traversed path information in a vector/list.
TC : O(3^(N^2)), where N is the dimension of the square matrix.
SC : O(N^2)
Explain the concept of ACID properties in DBMS?
ACID properties is the combination of Atomicity, Consistency, Isolation, and Durability properties. These properties are very helpful in allowing a safe and secure way of sharing the data among multiple users.
1) Atomicity: This is based on the concept of “either all or nothing” which basically means that if any update occurs inside the database then that update should either be available to all the others beyond user and application program or it should not be available to anyone beyond the user and application program.
2) Consistency: This ensures that the consistency is maintained in the database before or after any transaction that takes place inside the database.
3) Isolation: As the name itself suggests, this property states that each transaction that occurs is in isolation with others i.e. a transaction which has started but not yet completed should be in isolation with others so that the other transaction does not get impacted with this transaction.
4) Durability: This property states that the data should always be in a durable state i.e. any data which is in the committed state should be available in the same state even if any failure or restart occurs in the system.
What are different types of joins in SQL?
There are 4 types of SQL Joins:
1) Inner Join: This type of join is used to fetch the data among the tables which are common in both the tables.
2) Left Join: This returns all the rows from the table which is on the left side of the join but only the matching rows from the table which is on the right side of the join.
3) Right Join: This returns all the rows from the table which is on the right side of the join but only the matching rows from the table which is on the left side of the join.
4) Full Join: This returns the rows from all the tables on which the join condition has put and the rows which do not match hold null values.
What are Constraints in SQL?
Constraints are used to specify the rules concerning data in the table. It can be applied for single or multiple fields in
an SQL table during the creation of the table or after creating using the ALTER TABLE command. The constraints are :
1) NOT NULL - Restricts NULL value from being inserted into a column.
2) CHECK - Verifies that all values in a field satisfy a condition.
3) DEFAULT - Automatically assigns a default value if no value has been specified for the field.
4) UNIQUE - Ensures unique values to be inserted into the field.
5) INDEX - Indexes a field providing faster retrieval of records.
6) PRIMARY KEY - Uniquely identifies each record in a table.
7) FOREIGN KEY - Ensures referential integrity for a record in another table.
Write a query that joins two tables A and B having common attribute ID and selects records(ID_NAME) that have
matching ID values in both tables .
SELECT A.ID_Name, B.ID_Name
FROM A
INNER JOIN B ON A.ID=B.ID;
Given an Employee Table, find the Nth highest salary from it.
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
DECLARE M INT;
SET M=N-1;
RETURN (
SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT M, 1
);
END
This was a typical HR round with some standard Behavioral questions.
Tell me something about yourself?
Tip 1 : Prepare the points that you will speak in your introduction prior to the interview.
Tip 2 : Tell about your current cgpa, achievements and authenticated certification
Tip 3 : I told about my role in current internship and what all I do
Why should we hire you ?
Tip 1 : The cross questioning can go intense some time, think before you speak.
Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.
Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round,
like what are the projects currently the company is investing, which team you are mentoring. How all is the work
environment etc.
Tip 4 : Since everybody in the interview panel is from tech background, here too you can expect some technical
questions. No coding in most of the cases but some discussions over the design can surely happen.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is the output of print(type("Python"))?