c++ - An interview question -


T Looking at the link list size, first 2n nodes Select and delete the n nodes before them; Then do it for the next 2 n nodes and similarly ...

For example, we consider the 7 link list of sizes:

  `1- & gt; 2- & gt; 3-> 4-> 5-> 6> 7`  

If n = 2 , the desired output is:

  `1-> 2-> 5-> 6> 7`  

I did not understand whether this problem is actually indicating. Can anyone help me understand this problem?

Edit: Add the C and C ++ tags so that it can reach more eye balls, and of course, only two languages ​​are allowed in their interview.

It actually looks like it should say:

T Looking at a link list of sizes, first select the 2n node and delete the last n nodes of them; Then do this for the next 2n nodes and similarly ...

or:

Given a link list of T, the first 2n Select the node and keep the first nodes from it; Then do it for the next 2n nodes and on this ...

This means that select 1,2,3,4 then remove 3,4 (or keep it 1.22 That same thing). Then select 5,6,7,8, do not stop.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -