Solving the Cisco Coding Round Questions

It's 12:02 midnight, I am thinking of taking the coding problems of Cisco as I wanted to take these since before the End Sems but had postponed it for later,

I will be seeing the coding problems and then as soon as I finish each, will write the review of that problem.

1)

The first one of "students standing outside for interview" is like a read and do type of question,

 as soon as I finished reading the question, there was no confusion at all, it's just based on the left numbers optimization thing, we just gotta know the values at the left of the current value whose count we are gonna find. Normal O(n) approach, although people may go for the O(n^2) approach and get to see Time Limit Exceeded. That's catchy.

It's 12:13.

2)

The second one of "psychic prediction" is an observation problem, just had to see that what no. we gotta start with and that can be understood from whenever we get a negative number, then just gotta check that what is the max negative number that we can reach in consecution, 

ex: 2,3,-5,3,-6 ---> here after 3 we get a -3 and thus we know that we gotta start with a 3, 

suppose another ex: 2,3,-4,1,-3,-4,4,5,-10 ---> so I'm gonna take -5 + -1, that's abs(-6) in start.

Starting with 6 shows us how the process is working, this problem was like 16 mins of code with 10 mins of thinking max.

It's 12:30.  

3)

The third one of "getting the unique names of folders" is a problem just made to be solved in python,

this would be really easy with Python than going for C++, with cpp these types of operations are tough and thus I like to go with python for string manipulations.

Just gotta use a dict to get the names of the folders, if any repeats, just keep updating it's respective integer value and keep modifying the names.

12:41 now,

4)

will go for the rest 3 tomorrow.

Comments

Popular Posts