# Tolexo Interview Experience for SDE-1

I was having an on-campus round of Tolexo.com

**Round 1: Written pen-paper Test **

Q1) Write a program to print the matrix of n * n into a spiral form

1 2 3 4 5 14 15 16 17 6 13 20 19 18 7 12 11 10 9 8 Output : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

somewhat similar to this but not exactly

https://www.geeksforgeeks.org/print-a-given-matrix-in-spiral-form/

Q2) Write a program to find the number of trailing zeroes in n factorial

Example: 5

Output : 1 ( 5! = 120)

https://www.geeksforgeeks.org/count-trailing-zeroes-factorial-number/.

Q3) Write a program to print the longest palindromic substring in a string.

Example: aabaac

Output: aabaa

https://www.geeksforgeeks.org/longest-palindrome-substring-set-1/

https://www.geeksforgeeks.org/longest-palindromic-substring-set-2/

Q4) Write a program to print first k and last k elements of the link list in **reverse order**.

Where k = (n/3); n is the size of the list

Example :

Input : 1 -> 2 – > 3 – > 4 -> 5 -> 6 ; (k = 2 (6/3))

Output : 2 -> 1 -> 3 -> 4 -> 6 -> 5 ;

https://www.geeksforgeeks.org/print-the-last-k-nodes-of-the-linked-list-in-reverse-order/

Q5) Write a program to print the pairs in an array which has sum X.

For example : sum = 15

Input : 6 7 8 9 1 14 5

Pairs which has sum = 15

( **6, 9 ** ) , **(7,8**) , (**1,14**)

https://www.geeksforgeeks.org/count-pairs-with-given-sum/

Solved all the problems and was pretty sure to get through it.

**Round 2: I think it was my toughest round**

SQL queries: To find the second-largest salary in the employee table.Was asked to various SQL commands like ALTER TABLE COMMAND, ADD, To display the name, date from id = 1 to 10 without using where commands.

Many syntaxes I wasn’t able to tell them. But my approach was always right.

They looked into CV now asked again something about PL-SQL queries and their applications what was the difference and advantages of using the user-defined library and so on.

I have told them the advantages of a user-defined library and how we can improve the complexity of the code. How to prime number code can be improved using Sieve of Erasthonesis ( Sieve of Atkin) rather than using the inbuilt library and so on.

What is the difference between interfaces and abstract classes?

Q) To find the next big number of n which comprises of digits of n only.

For example** “ 123” Output: “132”.**

Remarks: “ After some bit of discussion easily told them “ – it was from geeks for geeks and solved it long back.

https://www.geeksforgeeks.org/find-next-greater-number-set-digits/

Q2) Asked about the quiz: There are three boxes having labels R& B, B, R and it is confirmed that all are incorrectly labeled. Find that minimum trials in which the correct label could be detected.

**Round 3 :**

They look into my resume and asked about my major projects: – I told them about the use of SVM (Support Vector Machines ) techniques in sentimental analysis

Q) They asked me to code matrix multiplications. Of m *n and n*p.

Coded it Then they ask me an approach to optimize. Then I tell me about Strassen’s algorithm and it’s the approach.

https://www.geeksforgeeks.org/strassens-matrix-multiplication/

Q) Then they look into my paper ( in which I had previously solved the questions) and asked me to optimize the longest palindromic substring which I did use the brute force approach.

: It took me a little while to understand the question s and then told m**e about Manchester’s algorithms used to optimize using dynamic programming.**

You have to buy a stock and sell it on another day ( in the coming days so you can’t go back in the previous day).

Example : 10 20 30 50 100

Suppose you buy the stock on day 1 and sell it on day 5.

So the maximum profit would be: 90

https://www.geeksforgeeks.org/stock-buy-sell/

**Round 4: was interviewed at Tolexo office**

I was interviewed by the Director of Tolexo.

Sir looked into my resume and asked me about elastic search and college projects and not so much convinced by me.

Asked me about the binary tree. Asked to find the minimum number of nodes we need to traverse to reach the leaf node.

https://www.geeksforgeeks.org/minimum-iterations-pass-information-nodes-tree/

He asked me to optimize the solution of written paper question 4 which based on the link list to print the first k and last k elements in reverse order.

** Result: Selected!!!.**