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 was a proctured online coding test where we had 2 questions to solve under 60 minutes. Both the questions were of Easy to Medium level of difficulty and can be solved if one has a decent command over Data Structures and Algorithms.



Can you solve this using not more than O(S) extra space, where S is the sum of all elements of the given array?
Approach :
1) Find the 'SUM' of all elements of array say 'TOTALSUM'.
2) If 'TOTALSUM' is not divisible by 2 return false, as array cant be partitioned into two equal subsets.
3) Create a new auxiliary array 'DP' of length 'N' * 'TOTALSUM' / 2.
4) Iterate the given array, now for each index 'I' we run a loop from 0 to 'TOTALSUM' / 2 then at each index 'J' we have two choices:
4.1) Exclude the number. In this case, we will see if we can get 'J' from the subset excluding this number: 'DP'[i-1]['J']
4.2) Include the number if its value is not more than 'J'. In this case, we will see if we can find a subset to get the remaining 'SUM': 'DP'['I' - 1]['J' - 'NUMS'['I']]
5) If either of the two above choices is true then we can find a subset of numbers with 'SUM' 'J'.
6) At last, return 'DP'['N']['TOTALSUM' / 2].
TC : O(N * S), where ‘N’ is the size of the array, and ‘S’ is the sum of all elements in the given array.
SC : O(N * S)



As this value might be large, print it modulo 10^9 + 7
Approach :
1) Store the frequency of each element in a hashmap (say, ‘FREQ’).
2) Maintain a variable ‘RESULT’ which stores the final answer.
3) For each element present in the hashmap,
3.1) Calculate the value of (2^eleCount - 1) % MOD, ‘eleCount’ is frequency of current element.
3.2) Add the above value to ‘RESULT’
4) The final answer is the value of ‘RESULT’ after we are done iterating over all the elements of the hashmap.
TC : O(N), where N=size of the array
SC : O(N)
This round had 2 questions from DSA of Easy to Medium level in which I first had to explain my approach and then I had to code . After that, I was asked some questions from DBMS and SQL to check basic understanding of the subject.



Approach (Using Min Heap) :
1) Create an output array ‘ANS’.
2) Create a min-heap of size K and insert the first element of all the arrays, along with its indices, into the heap.
3) The heap is ordered by the element of the array/list.
4) While the min-heap is not empty, we will keep doing the following operations :
4.1) Remove the minimum element from the min-heap (the minimum element is always at the root) and store it in the output array.
4.2) Insert the next element from the array for which the current element is extracted. If the array doesn’t have any more elements i.e. if the index of the above-removed component is equal to ‘LENGTH-1’ of the array from which the element is extracted, then do nothing.
5) After the above process, 'ANS' will contain all the elements of ‘K’ arrays in ascending order.
6) Return the output array i.e. ‘ANS’.
TC : O((N * K) * log(K)), where ‘K’ is the number of arrays and ‘N’ is the average number of elements in every array.
SC : O(N*K)




Approach :
1) We will maintain ‘MIN_VAL’ and ‘MAX_VAL’ (initialized to minimum and maximum possible value, respectively) to set a range for every node.
2) We will also maintain ‘PRE_ORDER_INDEX’to keep track of the index in the ‘PRE_ORDER_INDEX’ array.
3) We initialize ‘CURR_VAL’ to ‘PREORDER’[‘PRE_ORDER_INDEX’].
3.1) If ‘CURR_VAL’ doesn’t fall in the range [‘MIN_VAL’: ‘MAX_VAL’ ], we return NULL.
3.2) Else, we construct ‘NODE’ initialized to ‘CURR_VAL’ and increment ‘PRE_ORDER_INDEX’.
4) We will then set the range for the left subtree ([‘MIN_VAL’ : ‘CURR_VAL’ + ‘1’) and the right subtree (['CURR_VAL' +1 : ‘MAX_VAL’]) and recursively construct them.
TC : O(N), where N=number of nodes in the BST
SC : O(N)
Explain the difference between the DELETE and TRUNCATE command in a DBMS.
DELETE command : This command is needed to delete rows from a table based on the condition provided by the WHERE clause.
1) It deletes only the rows which are specified by the WHERE clause.
2) It can be rolled back if required.
3) It maintains a log to lock the row of the table before deleting it and hence it’s slow.
TRUNCATE command : this command is needed to remove complete data from a table in a database. It is like a DELETE command which has no WHERE clause.
1) It removes complete data from a table in a database.
2) It can be rolled back even if required. ( truncate can be rolled back in some databases depending on their version but it can be tricky and can lead to data loss).
3) It doesn’t maintain a log and deletes the whole table at once and hence it’s fast.
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.
This round also had 2 questions from DS and Algo where I had to first explain my approach and then write the pseudo code in Google Docs. This was followed by some questions from DBMS and SQL . I was also asked to execute a SQL query at the end.


If the given matrix is:
[ [1, 2, 5],
[3, 4, 9],
[6, 7, 10]]
We have to find the position of 4. We will return {1,1} since A[1][1] = 4.
Approach :
1) Start your search from the top-right corner of the matrix.
2) There can be three cases:
2.1) The current element is equal to target: return this position
2.2) The current element is greater than the target: This means that any element on the current column is also greater, thus we move to the previous column
2.3) The current element is smaller than the target: This means that any element on the current row is also smaller, thus we move to the next row
3) If we go out of the matrix, it means element is not found. So, return {-1, -1}.
TC : O(N), where N=number of rows or columns in the matrix
SC : O(1)



'S' = "{}()".
There is always an opening brace before a closing brace i.e. '{' before '}', '(' before ').
So the 'S' is Balanced.
Approach :
1) Declare a character stack.
2) Now traverse the expression string
2.1) If the current character is a starting bracket ( ‘(‘ or ‘{‘ or ‘[‘ ) then push it to stack .
2.2) If the current character is a closing bracket ( ‘)’ or ‘}’ or ‘]’ ) then pop from stack and if the popped
character is the matching starting bracket then fine else parenthesis are not balanced.
3) After complete traversal, if there is some starting bracket left in the stack then “not balanced”.
4) Otherwise, the string is balanced.
TC : O(N), where N=length of the string
SC : O(N)
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
What is the difference between Clustered and Non-clustered index?
1) Clustered index modifies the way records are stored in a database based on the indexed column. A non-clustered index creates a separate entity within the table which references the original table.
2) Clustered index is used for easy and speedy retrieval of data from the database, whereas, fetching records from the non-clustered index is relatively slower.
3) In SQL, a table can have a single clustered index whereas it can have multiple non-clustered indexes.
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 you want to be a part of Oracle?
Tip 1 : Oracle technologies are modern, cutting edge and built for enterprise requirements (think world class security, availability, performance, scalability, integrated ML/AI and so forth). Oracle Database is #1 worldwide.
Tip 2 : Since it’s inception, Oracle has become a market leader when it comes to database. Oracle has its own all possible solution for it’s clients whether it is into IT or Banking.
Tip 3 : Oracle gives your job sustainability with better career growth - in terms of job profile and package both.

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?