This simulation effectively demystifies the transition from service-based roles to top-tier product standards by emphasizing the elegance of linear-time complexity. It serves as a pragmatic guide for engineers to master the structured thinking required in high-stakes technical interviews.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
DSA Mock Interview | Amazon SDE Interviews a TCS Software Engineer
Added:Yeah. Hi. Good evening.
>> Good evening, ma'am.
>> How are you?
>> Fine, ma'am.
>> Great. Okay. So, uh the recording of this mock interview will be shared over the YouTube. Do you have any concerns on it?
>> No, ma'am.
>> Okay. Uh can you please introduce yourself?
>> Yeah. Actually my name is Jam Mali and I have done my BTE from Krishna Engineering College Gazyabad and during my college uh I have I had given uh NQ exam thesis and exam and I had cleared that exam in a digital and then after I have joined TCS in a nontechnical project due to because uh they mapped forly to that project. After that uh I have joined uh AI team in medical uh team where I have done many uh PC's that is proof of proof of concepts. I have made laboratory uh agents. Currently I'm working on LLM parsers where we are uh making parsers for uh laboratories uh results.
>> Yeah.
>> Okay. So uh can you share your screen so I can start sharing the questions?
>> Okay.
Uh >> year 2020 uh Your graduate year is >> okay four from where I can share my screen. Okay.
>> At the bottom you have an option.
>> Oh yeah.
>> Okay. Uh you can open some ID.
>> Okay. Is my screen share now?
>> Yes. Yes. It's visible to me.
>> Okay.
I think >> yeah, >> you can check the chat of the zoom.
>> Okay.
Uh I'll read the question.
>> Have you open some ID?
>> Yes, it is.
>> It's not visible to me actually.
>> Yeah, I share the screen.
>> You have to share the entire screen.
Yeah, I've shared on some >> Can you go to some ID?
>> Okay. Okay.
>> Is it visible now?
>> Not yet.
We're not sharing it properly. One second. Allow.
>> Um there is a allow share screen and there is allow to share window.
>> Yes, there is a option for the entire screen. Right. when you have shared there is option first option >> is it now available >> yes I'm able to see me can you go to some ID now ah it's visible now >> okay great okay okay so okay in the Okay.
So there's a proper constraint.
Yes.
Can I uh write my uh for example some part on my uh copy or I should write on here?
>> You can write here only it >> only. Yes.
>> Okay. Okay. Okay.
>> [clears throat] >> So for example if there is an array that is unsorted we have given already 10.
Okay.
Okay. So before this constraint if we go a simple method. Okay. A simple method.
So there will be we sort an array 4 5 7 and 10. we will go sequentially and we will check if the past element is equals to that partic uh one uh minus. So it will be like uh nums of i nums of i equals to nums of i -1 + 1. If it is then I will do count ++ or else I will count equals to zero. Okay.
So it is a simple method I think and it will be time complexity of a big of n login for sorting plus big of n on a loop and sc will be big of one.
Yeah, but we need to solve it in a gig of n and would be big of one.
Okay.
Okay.
So I think uh if there is a uh number that is uh not unique so it will not be a problem because you want a length of only a unique number sequence I think.
So >> it's not unique number sequence. It's majorly consecutive elements. Right?
>> Uh consecutive elements. For example, if there is a four, five, five, six. Okay.
But you want a consecutive elements. For example, four, five, six. I think you want this type of sequence. And for example, length. You want a length. So it will return three. we go with this above example.
>> So you can assume that you will not have the duplicates for this question.
>> Okay. Okay. Okay. Okay. Okay. Since we have a no duplicate here and for example this is the sequence. Now what we will do here is H.
Okay.
100.
One How to get this going?
What?
You can use some data structure to store it.
Yeah.
So what Don't for What I'm thinking here is uh all those And don't think in the terms of hashing.
No no no no I'm >> you can try to think in the terms of hash set something like this >> yeah this uh that's why I mark this as a hashet but I'm we will not be able to do a uh sorting stuff so uh I'm thinking of You can speak whatever you're thinking.
Oh actually I have uh think in in a headset stuff for example if there is a number one and I will go with uh till y loop till y loop for example till y loop >> until I don't find u this uh for example this is element okay so there is a element one until I don't find an element plus one >> then I will go count count >> and if I if I uh over out if I don't find any condition element + one then I will be breaking that stuff and storing that max and go further but now I'm stuck here because While checking the element plus one, do you not think so that you need to store an hash set also? So the next time when you are coming with the same element, so you should know that you have already calculated the length of that part.
>> Yeah.
But but if you think about storing uh like series of for example four comes one first.
Okay.
48 2 1 Okay. 4 5 6 7 Okay.
Uh I'm thinking Okay. Okay. Okay. Okay.
I got a solution. I think for example, if there is a four, for example, we had to store in a for example, this is a headset. It is not sorted. It is unsorted form. Okay. The element come that is four. Okay. Four came. I will loop till minus minus one one time minus one. Why loop minus one - 1 - 1 I will got a count here. Okay. For example, count ++ count ++ for example 4 3 2 1 sorry 3 2 1. So I will got a count that is three. Okay. I will go another loop that is count plus oh sorry plus one till I got a condition fail. Okay. So there is a count uh ++ again. Okay. So there is will be count plus+ there is a count ++ again for for example there is a 5 6 7 also. Okay. So 5 six will also be taken out. Okay. and I will out from this headset.
Okay. So next time for example one games and I check in headset if it is not present I will not go with that loop this loop. So this is a count three and there is a 5 six not there. So there is a count no found here but still there is a three here. Okay. So at last there is a four also. So I will manage to have a here is max equals to max count max. Oh sorry it's a count + one.
I think this algorithm will work here.
>> No.
Can you do the dry on one more example?
Okay.
Okay. For example, this is a question.
Okay.
>> H >> you had said there is no unique number.
There is a unique number only. So for example there is 0 three for example it is a half set. Okay.
No. Oh, okay.
>> You can remove one zero from this.
>> I will I will I will I will loop uh no issue. No issue. I will loop through it.
There is a Okay. So, I will loop through it.
I will loop through the array because if we remove het then it will be a indexing problem. Okay. So, we'll loop through array.
>> Okay. So, let's suppose you have add all the elements into hashet. Okay. Till now we are done. Let's come to our next part.
>> Yeah. Till now we are done. Okay. Okay.
Okay. So we found a element that is zero. Okay.
>> Okay. So we will loop while while this uh element zero. Okay. This over here while this will be le one. This will be le let take le. Okay. No issue by the limit.
Fine.
>> And there is a count.
>> Okay. There's a count. Okay.
>> So until until uh we could not find minus minus le. We could find minus minus le. We will loop through it. We will loop through it. We will count. We will count. Okay. And at the same time we will remove that element. For example minus count count plus count count. Oh sorry minus minus le plus.
Can you talk in the terms of numbers rather than plus+ and minus minus >> because you're doing the dry run writing I'm not asking you to write the pseudo code I'm just asking you to do the dry run >> okay okay ma'am okay so there is a zero okay >> okay >> zero came >> zero asked is there uh minus minus min - zero of is minus one okay so we will not found minus 1. Okay, no issues but count is zero now. Okay, next time we have we pass the same zero to next loop but for the positive conditions. For example, there is no minus one. There is no minus one. Okay, is there any one? Yes, bro. I had found a one. So I will delete this one here and I will count ++ and hash set h dot remove that le++ at the same time. I will remove that one.
>> If you okay then I will again go with it two.
Okay bro I had found a two bro delete it. I will I will go with one step more.
Okay, bro. I found a three.
Okay, bro. I found a four. Okay. Oh, sorry. Yeah, bro. Delete it.
I delete.
So, delete it. Okay, bro. Bro, I found a five. Okay, bro. Delete it.
As it is 6 7 and 6 7 8 We'll delete.
And at last we got a for example counter.
I think it's seven. Okay. But till now we had not delete a zero. So we will delete zero. We will uh maximum we will do a maximum with count + one because zero is deleted now. So we had done this for in that way. And for example, for example, you got you got a three year.
Okay.
>> You can you can start writing the code.
>> I got it.
>> Okay.
Okay.
So we will take an H set of integer.
You can take a variable as Thank you.
Now we will loop through this length and uh we will take element that is nons of i And uh first what we will do here is we will uh loop this while uh and first we will check if this particular element is present in a heter or not. If not then we will continue.
If Sorry this not only continue.
Okay.
If so if we found any + 1 while L + 1 is present we will look through it. Okay. So it will be like count + count equals to zero max is max length and uh pound ++ uh unique value dot remove and uh [clears throat] uh we will count we will okay I've done it and uh again we will assign this variable to this because for minus loop because I ++ and L minus one value of content elements very first. Okay.
Count and uh at last we'll do max equals to math dot max of count + 1 comma max. And at last we will do remove the nons also because we are done with it maximum it is maximum variable.
Okay.
Okay.
And if we are talking about the time complexity of this, it will be looping through each element.
But if you see a many of the student fails during that there is a two loops but it is only looping each element once because there it is also removing that stuff. So it is it will be a time complexity of big of n and space is space complex sc of big of n because we had taken a head and if we uh go with the length I think and after each time we need to put count equals to zero.
Yeah, >> if you're done, you can run this code.
>> Yeah.
Or this three.
Oh, see ++ L + 1 and nums are again minus one pound plus and we are rem but it is zero.
There is l + one need value contains.
1 2 3 4 5 6 7 8 9 but zero on It's okay.
Oh my Still you can do the dry run on your code. You will get it where you're wrong.
Yeah.
I'm giving you five more minutes. You can do the dry run on your code and fix it.
Then we can move to next question.
Just listen.
Okay.
Okay.
0 1 Okay.
Yeah.
Okay. Uh let's move to question number two.
>> Sure.
You can you can copy paste the input and output also.
>> Okay.
>> Above also you have example one two block in front of you with four circular beads. Each wheel has a 10 slots.
element of 0 to 9.
Okay.
Okay. Uh what we desert in or constraints >> sharing it.
>> Okay.
>> You can also copy paste the other examples as well.
>> Okay. Sorry.
>> [clears throat] >> Okay, this it will be easier or just if it will be an asset. So we can check posly but before that we need to >> can you speak loud?
>> I can.
>> Yeah. Uh actually I'm thinking of putting this dead ends in a hasset so that it will be fast to check but before that we need to see. Yeah. So for this uh dead ends we can make any so move three times.
>> You can go through the input and output if you haven't yet.
>> Yeah.
0 1 2 0.
Okay.
I'm thinking of one thing >> for example if we because it is a for example step first search approach like something because at each time we have a four options and we can think of any chain for example if you want to do it as a one if you want to do it as a one or next time to make it a true.
But uh DFS be like how DFS will work here.
Actually I'm thinking of moving it each lock one time up and down. But uh it can be a very high time complexity.
But uh >> because if you will move let's suppose from we'll take it as a 0 0 you can move to 1 0 0 0 then 2 0 0 0 then it will go right.
>> Yeah. For example, if we go, >> for example, this like 1 122. So it this one >> will go back to zero.
>> But making that stuff can can be a problem. So DFS can be with a high time complexity of that. So I'm not agree with that first thinking about that. But after seeing this example, so it can be a problem.
>> And also uh DFS can't guarantee that the first path is the shortest path, right?
>> Yeah. Shortest path will be like >> cuz you need to find the minimum moves.
>> Ah minimum notes. Oh yeah, minimum moves. So >> and you also have the dead ends. If you reach there, you can't move forward.
>> You can think of a BFS type.
>> Yeah.
>> Yeah. Yeah. You can think of BFS.
>> I can think of a BFS type.
If there is 0 0, we can do any one of a step to a minus one. I'm thinking of a this approach VFS approach uh for example as a shortest part we had think about so + one + one + one + one >> but uh okay every time it go for example it is a 9 0 0 0 and 0 9 0 0 and just like this eight stops H >> each time in a queue.
>> Do you think that we need to move all the ones at once like all the zeros to one in one occurrence? Do you think so?
Or do we need to take it one by one?
Like let's suppose we have 0 0 0 right and then we are moving to 1 0 0 0. This would be your next occurrence. You can't move all the zeros to one.
Am I audible? Right.
Hello.
You're not audible.
Not yet.
Now audible.
>> Yes. Now audible.
>> Yeah. So uh what I'm thinking here is uh but so if we don't take this what actually I'm taking this eight stuff because we at each loop we need to go to we might go to minus one also. So for example this 1 12 02 we might go to 020 also. So that's why I'm thinking about this eight eligible criterias on each Q stuff Q.
>> Let's do the dry run and see if it works or not.
Uh so dry run will can be a very huge for this for example >> we can start something 0 0 >> 0 0 okay then for example I'm going through this only okay stuff for example at e at next step I got a 1 0 0 because I add + one here add a single this okay at another time stamp at a next time stamp I am adding + one to this stuff.
So it will be like 1 1 0 0.
>> Okay. And then again to this second and the third time third third time step I'm rotating this second lock. So 1 2 0 0 at another time step I'm moving for example there is eight uh stops okay 1 2 0 1 and >> tell me one thing one thing >> okay >> first you are moving first lock this is fine then you move another lock like the basically indexing w actually at each uh for example time stamp at each time stamp I will loop this eight For example, this is -1 -1 -1. So this is -1 - 1 - 1 uh and add in a q. For example, it is 0 0 0. Okay. So it will be 9 0 9 0 0 0. And it will be add in a q for the next time stamp. Okay. And for example, if we are here, so it will be like 1 0 0 0. it will be added to a same time stamp but with a different uh in a in a same queue but in a same time stamp. For example, it is 9 0 0 0. uh next time it will be 0 9 0 0 and for this eight step I think it will be a fifth or sixth step it will be like uh 1 0 0 0 and and at each time I am putting it in a hash set so that if something coming again it will not add in the particular queue.
What would be the time and space complexity for this?
So it will be a all the numbers between 0000 to 99999 between all the numbers because we are having a hashet and it will storing all the values that is only unique and it is also uh uh checking a visited stuff that if something coming again if some value is coming again for example it is like 1 12 0 0 is coming again then it we will not put it in a que.
>> Okay. So you will mark something as a visited like that.
>> Yeah. We will take an visited array. For example, it is 0 0 0. At the next time we will go with 1 0 0. In 1 0 0 0 there is a minus one back loop also for this one log. So if it is coming back but we had said that it is a already visited and if there is a deadlock we will not uh go for this eight loops we will continue that particular stuff. For example it is a something like 00002 is a deadlock. So we will not go for that eight loops because it is a deadlock.
You can you can't move a lock >> minus one plus one.
So I think uh of that stuff.
>> Okay. So you can start writing the code now. I >> I think I'm good with it.
>> Okay.
>> So okay.
Okay. So okay we can write a code now.
>> Okay.
So we will take a Q of integer Q equals to should be a link test.
Okay.
So and also we want a hset to check deadlocks asset of integer deadlock new asset O and I N. Okay I not put in that log here.
So we will have a catalog here log.
So for that add dot add this I don't know why this error is occurring here.
Okay. So we will add a cube that is with a 0 0 0.
Uh okay. But uh the issue is how we will decrease that stuff.
See put a string put a string here.
But I think Sorry for the auto partition data log less than length I ++ uh the reds of I do is empty.
Okay.
So there will be a because we want and enter time to zero and uh in size we'll have a dot size.
We loop through it for J = to0. J is less than size.
J ++ and at each time we will uh adding a we will remove remove equals to remove element that is Q dot remove it is a string.
Yeah.
Uh for this we'll have a visited array boolean as set of boolean that will handle the visited stuff string string.
We remove a element.
We will go through a group of minus1 and + one.
So next of 0 0 0 but 4 in = to 0.
Okay.
What's zero is less than 4 I ++.
So at this time we will add we will change that particular character in a string. So we will take a care at CH equals to if position.
>> So we will have a remove le dot care at I.
Okay. So we will add a stuff. So I think uh adding care will be like uh care. Next uh will be like ch uh but I think it will do me int of ch + one.
Uh I think it would be a care uh end of care actually I'm confusing at that part uh but yeah uh if we got then we will uh Q dot header Uh uh string will be changed here is string change will be remove dot uh replace but I think there can be a less like think uh I think instead of going into care if you can take a array that would be easier for you >> to writing a code >> anyways it's up to you but just a suggestion >> okay no issues I think That would be a great idea to split an string to an array and then adding stuff. Okay, >> that would be easier for you to write the code.
Yeah, I think so array and uh we can have a remove le dot split split.
Um it's fine. I think I'm good with it because we are out of time now.
>> Okay.
>> It will take I think 10 more minutes. So let's come back to your feedback. Now you can stop sharing your screen if you want.
Okay. So there are few things which I have note down. First is you can u concise your introduction like you should know what you are speaking. So your introduction should be fixed. like let's suppose if you have some project so you should know okay this is what I need to highlight or this is what might be not required so you can little bit work on your intro part second thing is uh whenever you start reading the question you are good with your technical skills there is no doubt but the thing is key you need to speak loud >> so other person should know okay what you're thinking right >> I think apart from these two things you can third thing is the time management you're already good with it but if it is possible you can just have a timer and whenever you are trying the questions so you can just manage it okay I don't want to give more than 20 minutes because in interview you need to explain also you need to dry dry also so that also take 5 to 7 minutes >> so writing a code won't take more than 7 to 8 minutes you can have 20 to 25 minutes like 20 minutes per question I think that is more than sufficient which you can give while practicing apart from this I think you're good with acting.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23

Bitcoin Social Interest: Dozens of us Left
benjaminjcowen
12K views•2026-07-23

Tesla Profits Plunge & SpaceX Stock Continues Fall
TheJohnJohnstonLounge
6K views•2026-07-23