The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 4 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Andromeda has a deep interest in stars, galaxies and the universe since childhood. She has taken several picture of the night sky and based on that, she has noted down the co-ordinates of all the stars in 3D space (the coordinate values are in light years). The coordinates of two stars may not be distinct due to human error. She considers two stars to be in same galaxy if euclidiean distance between them is atmost d light years. Three stars A, B, C such that euclidiean distance between A and B is less than or equal to d and euclidiean distance between B and C is less than or equal to d, then they all will be in same galaxy even if euclidiean distance between A and C is greater than d.
Â
Andromeda wants to know the number of galaxies and for that she needs your help. You are given coordinates of N stars and the value of d. You have to tell her the number of galaxies.
Â
Â
Â
Â
Â
Â
Â
Â
Â
Â
Â
Input: 1 3 5 0 0 1 0 0 3 0 0 10 Output: 2
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll