A block $m_1$ strikes another stationary block $m_3$ inelastically . Another block $m_2$ is kept on $m_3$.Neglect the friction Between all contacting surfaces. Since $m_2$ is kept on $m_3$ and all the surfaces in contact are smooth and impact between m1 and $m_3$ is inelastic ,$m_1$ and $m_3$ will move together toward right and $m_2$ will not move toward right. But at the time of impact $m_2$ will also affect speed because to its mass is added ,should I include mass of $m_2$ to find final combined speed of $m_1$ and $m_3$.
Consider an impulse of J acting on blocks m1 and m3, the impulse does not act on m2 because there is no friction between any surfaces nor is there any other direct contact force.
Hence by Applying Low of Conservation of Momentum,i.e
where vf is the final velocity of the system, We can calculate the final velocity.