Tip 1: Find a good course, and first clear all your fundamentals and implementation of every data structure. You should be thorough with their time as well as space complexities.
Tip 2: Upon clearing the fundamentals, select a platform where you have a large no of questions, also whose test cases are good. eg. LeetCode, InterviewBit or Codezen. Go and complete 300-400 questions.
Tip 3: Also whenever you're not able to solve the problem, check out the editorial and then re-attempt it again. Also, check the discussion if there is some good solution to the same problem.
Tip 4: Most important : Compete with people on some online coding platform such as Codechef, codeforces or leetcode. It would help you in gaining a lot of interesting concepts and also improve your thinking skills.
Tip 5: Object-oriented programming is a must. One should study this as interview always asks from this domain.
Tip 6: Practicing and minimizing complexities after every solution will help you in gaining better understanding towards the question.
Tip 1: 1-2 page resume is good for a fresher.
Tip 2: Resume should contain facts, numbers, and data comparison.
Tip 3: Concise description of the projects attracts the interviewer.
Tip 4: Technical achievements in the field you're applying to, would be good.
Tip 5: DO NOT FAKE THINGS, the interviewer is smart enough.
Test took place in the afternoon and the environment was so terrifying. Obviously, it would be because it was a subjective coding test. The test had it's webcam on, we were not allowed to go out of the frame. 3 coding questions were there - 1 easy, 1 medium and 1 hard.
The series is 1-based indexed.
I just minimized the time complexities using just 2 variables and then worked in dp approach. O(N) had all test cases passed. I could have done using matrix exponentiation but it was not required.
Two numbers are coprime if their greatest common divisor(GCD) is 1.
Here, 1 is considered to be coprime to any number.
If the given integer is 9, then the answer would be 6 Because there are six numbers between 1 and 9 both inclusive which are coprime to 9 i.e 1, 2, 4, 5, 7, and 8.
It had the formula phi(n) = n(1-1/p1)(1-1/p2)....(1-1/pk), where p are distinct prime factors of n.
I stored all the prime factors of n by looping on it. and then formulating the answer.
As the answer can be large, return your answer modulo 10^9 + 7.
Can you solve this using not more than O(S) extra space?
Naive approach would be to look at every combination that sums to X but this didn't pass the test case. I used memoization that too didn't work. Afterwards I worked on 2D do.
for(i, 1..no of dices)
for(j, i...sum)
dp[i][j] = dp[i][j-1] + dp[i-1][j-1];
if(j-d-1>=0) dp[i][j] -= dp[i-1][j-d-1] // these are calculated extra times so removing it
Answer is in dp[d][X]; d = no of total dices, X = sum
Had a face 2 face call with the interviewer.
He asked me about singleton class and asked details about linked list.
The given linked list is 1 -> 2 -> 3 -> 2-> 1-> NULL.
It is a palindrome linked list because the given linked list has the same order of elements when traversed forwards and backward.
Can you solve the problem in O(N) time complexity and O(1) space complexity iteratively?
So he asked me about the basic concept of palindrome and linked list's basic. Then for the same question I needed a middle node so that I can traverse and check for the palindrome.
Through hare and tortoise method I made him understood how to find the middle node in both even and odd lengthed linked list.
After finding the middle node, I just reversed the second half and checked whether it is a palindrome or not.
He asked a lot about to minimize the complexity. He asked me reverse the linked list in both iterative and recursive way and their time complexities. I considered the recursion stack and memory of the pointers even. He asked my better ways, I told him the best way and that worked.
TIming was around 4PM and I was very stressed. The interviewer was good.
Example: String "aabbbcdcdcd" will be encrypted as "a2b3cd3".
Input string will always be lowercase characters without any spaces.
If the count of a substring is 1 then also it will be followed by Integer '1'.
Example: "aabcdee" will be Encrypted as "a2bcd1e2"
This means it's guaranteed that each substring is followed by some Integer.
Also, the frequency of encrypted substring can be of more than one digit. For example, in "ab12c3", ab is repeated 12 times. No leading 0 is present in the frequency of substring.
The frequency of a repeated substring can also be in parts.
Example: "aaaabbbb" can also have "a2a2b3b1" as Encrypted String.
It was late around 11:45 PM and I was all tired but excited as I was in the last round. The interviewer looked tired.
Tip 1: Go through your resume, and make sure you know everything written in resume.
Tip 2: Be humble and listen to every question carefully and also inculcate knowledge of the cores subjects with answers
Tip 3: Always talk on the real-world problems and tell them how will you be able to contribute to the company.
Tip 4: Involve him in the conversation.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you create a function in JavaScript?