My attempt:
Initial total M.E = PE of hanging part + PE of part of chain in the tube. I've considered the table as to be at zero of PE.
PE of hanging part = ##\frac{1}{2} \frac{m}{l}gh^{2}##.
PE of part in the tube = ##\frac{m}{l}(l - h)gh##.
Final ME = ##\frac{1}{2}\frac{m}{l}gh^{2}## + ##\frac{1}{2}\frac{m}{l}hv^{2}##.
Since Initial ME = Final ME. Therefore, ##\frac{1}{2}\frac{m}{l}hv^{2}## = ##\frac{m}{l}(l-h)gh##. Solving this gives: ## v = \sqrt{2g(l-h)}##. But the answer in the book...