adding lowestcommonacenstor solution