Move parent so children align with other obj!

This is probably an easy task, but i just cant find a way to achieve this.*

Simple, i want to move a parent object to a point where it aligns his children and another external object transform on the y axis

<-Parent Children.position → —> Other Obj.position

A gif as illustrated example!
Where light blue is the parent, dark blue is the children, and green is the other object i need to align to.

*Am using a 2d example here because i only need to align one Axis, but this is entirely on 3D
**Using c#
Thanks!

Ok so i found a solution, i needed to align the parent to the target and then substract the localposition of the children.

	public Transform target;
	public Transform children;

	
	void Start () {

		transform.position = new Vector3(transform.position.x, target.position.y - children.localPosition.y, transform.position.z);

	}