Implement the solution using Prim's algorithm. Start with point . Expand the MST by adding the nearest point at each step. Test the solution on the sample inputs. Make sure you compute Manhattan distance correctly.
Check that the total cost matches the expected output. If you prefer Kruskal, you can generate all edges and sort them. Both approaches work, but Prim is more space-efficient for this problem.