SlideShare a Scribd company logo
1 of 2
Download to read offline
Google Code Jam Practice Problems

A - Big City Skyline

You've just moved to the Big City so you could start work at the newest Google office, Google BC, and the
one thing that interests you most is the beautiful skyline. You're sitting on a hillside ten miles away, looking
at the big rectangular buildings that make up the city, and you think back to your childhood.

When you were a child, you used to make toy cities out of rectangular blocks. Each building could be made
from multiple blocks, and each block could be part of multiple buildings. Looking at the skyline, you wonder:
what is the biggest possible block that could be part of the Big City's skyline?

Write a program that takes the description of the skyline as an input, and gives the area of the maximum-
area rectangle as output. This program should take less than 4 minutes to run on a 2GHz computer with
512MB of RAM, even for the biggest input size we specify.

Input:

The city is made out of rectangular buildings, all next to each other. The input will consist of an integer N,
the number of buildings, followed by a series of N number pairs wi hi, indicating the width and height of each
building in order from left to right. The buildings' heights will be less than 100,000,000, and their widths will
be less than 1000.

Easy: 0 < N < 1,000
Hard: 0 < N < 10,000,000

Output:
A single number: the area of the largest possible block. (Here’s the beautiful skyline of the Big City.)




Sample Input                          Sample Output                         Explanation
                                      51
5                                                                           The biggest block is shaded black
5 7 1 20 3 5 6 3 2 10                                                       in the figure above.


                                                                          Google Code Jam Practice Problems
                                                                             © Google Inc. - September 2007
                                                                                                        p. 1
B - Universal Search

You've just started your job at Google Moon, and you've been assigned to the universal search
project: that is, of course, the functionality that lets people search for anything in the
universe. Your starter project seems simple: find a flight path for the GCrawler (Galaxy Crawler)
that will gather stock prices from all of the galactic stock exchanges, traveling between planets
using Hyperspace Jumpgates.

The known universe contains k stock exchanges and p inhabited planets. Each planet deals with
one stock exchange, and every planet has a record of the stock prices for its exchange. Given a
list of stock exchanges, their planets, and planet<->planet jumpgate connections, find a path for
the GCrawler that contains the smallest number of jumpgates, but still passes through at least
one planet from each stock exchange before returning home.

Input:

The input will start with p, the number of planets. Next will follow p lines of the form:
planet_name stock_exchange connection1 connection2 ... connectionN

If planet A connects to planet B, then planet B also connects to planet A. Planet and stock
exchange names will contain only alphabetic characters [A-Za-z]. One of the planets will be
named GoogleMoon; that is the start and end location for the GCrawler.
Easy: 0 < p < 50, 0 < k < 5.
Hard: 0 < p < 500, 0 < k < 16.

Output:

A series of planet names, separated by spaces, describing the path the GCrawler should take.

Sample Input
5
GoogleMoon TheInternet Mars Earth
Mars EarthStocks GoogleMoon AlphaCentauriII AlphaCetiV
Earth EarthStocks GoogleMoon
AlphaCentauriII AlphaStocks Mars AlphaCetiV
AlphaCetiV AlphaStocks Mars AlphaCentauriII
Sample Output
GoogleMoon Mars AlphaCetiV Mars GoogleMoon
Explanation
The GCrawler has three stock exchanges to visit: TheInternet,
EarthStocks and AlphaStocks. It starts on GoogleMoon, which
deals with TheInternet; it then travels to Mars, which trades in
EarthStocks, then to AlphaCetiV, which deals in AlphaStocks.
Now it needs to get back home; the shortest route goes
through Mars.




                                                                    Google Code Jam Practice Problems
                                                                       © Google Inc. - September 2007
                                                                                                  p. 2

More Related Content

Viewers also liked

PresentacióN
PresentacióNPresentacióN
PresentacióNlakathy07
 
formula
formulaformula
formulaayyoub
 
Kiest u er voor om te delen?
Kiest u er voor om te delen?Kiest u er voor om te delen?
Kiest u er voor om te delen?Pierre Gorissen
 
A Todos Vosotros
A Todos VosotrosA Todos Vosotros
A Todos Vosotrosguestc513e8
 
formula mesura
formula mesuraformula mesura
formula mesuraayyoub
 
Lectie De Viata
Lectie De ViataLectie De Viata
Lectie De Viatavoxvocis
 
Landbruk På Utsira 220906
Landbruk På  Utsira 220906Landbruk På  Utsira 220906
Landbruk På Utsira 220906Atle Grimsby
 

Viewers also liked (9)

PresentacióN
PresentacióNPresentacióN
PresentacióN
 
formula
formulaformula
formula
 
Kiest u er voor om te delen?
Kiest u er voor om te delen?Kiest u er voor om te delen?
Kiest u er voor om te delen?
 
A Todos Vosotros
A Todos VosotrosA Todos Vosotros
A Todos Vosotros
 
formula mesura
formula mesuraformula mesura
formula mesura
 
HiNes IT-seksjon
HiNes IT-seksjonHiNes IT-seksjon
HiNes IT-seksjon
 
Codigo de ética
Codigo de éticaCodigo de ética
Codigo de ética
 
Lectie De Viata
Lectie De ViataLectie De Viata
Lectie De Viata
 
Landbruk På Utsira 220906
Landbruk På  Utsira 220906Landbruk På  Utsira 220906
Landbruk På Utsira 220906
 

Similar to Google Code Jam Practice

Project seminar ppt_steelcasting
Project seminar ppt_steelcastingProject seminar ppt_steelcasting
Project seminar ppt_steelcastingRudra Narayan Paul
 
Class[2][29th may] [javascript]
Class[2][29th may] [javascript]Class[2][29th may] [javascript]
Class[2][29th may] [javascript]Saajid Akram
 
Engineering + Programming portfolio
Engineering + Programming portfolioEngineering + Programming portfolio
Engineering + Programming portfolioJosephDonnelly14
 
Class[6][5th aug] [three js-loaders]
Class[6][5th aug] [three js-loaders]Class[6][5th aug] [three js-loaders]
Class[6][5th aug] [three js-loaders]Saajid Akram
 
mago3D: A brand new Geo-BIM platform on top of Cesium & World Wind
mago3D: A brand new Geo-BIM platform on top of Cesium & World Wind mago3D: A brand new Geo-BIM platform on top of Cesium & World Wind
mago3D: A brand new Geo-BIM platform on top of Cesium & World Wind SANGHEE SHIN
 
Summer training on matlab
Summer training on matlabSummer training on matlab
Summer training on matlabdangerahad
 
Migrating from OpenGL to Vulkan
Migrating from OpenGL to VulkanMigrating from OpenGL to Vulkan
Migrating from OpenGL to VulkanMark Kilgard
 
GDG Kuwait - Modern android development
GDG Kuwait - Modern android developmentGDG Kuwait - Modern android development
GDG Kuwait - Modern android developmentGDGKuwaitGoogleDevel
 
Introducing google’s mobile nets
Introducing google’s mobile netsIntroducing google’s mobile nets
Introducing google’s mobile netsLarry Guo
 
The Kokkos C++ Performance Portability EcoSystem
The Kokkos C++ Performance Portability EcoSystemThe Kokkos C++ Performance Portability EcoSystem
The Kokkos C++ Performance Portability EcoSysteminside-BigData.com
 
Copy of Copy of Untitled presentation (1).pdf
Copy of Copy of Untitled presentation (1).pdfCopy of Copy of Untitled presentation (1).pdf
Copy of Copy of Untitled presentation (1).pdfjosephdonnelly2024
 
Scala can do this, too
Scala can do this, tooScala can do this, too
Scala can do this, tooHairy Fotr
 
Greedy subtourcrossover.arob98
Greedy subtourcrossover.arob98Greedy subtourcrossover.arob98
Greedy subtourcrossover.arob98Kaal Nath
 
mloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game developmentmloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game developmentDavid Galeano
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).pptHIMANKMISHRA2
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.pptHIMANKMISHRA2
 
Minimal Introduction to C++ - Part I
Minimal Introduction to C++ - Part IMinimal Introduction to C++ - Part I
Minimal Introduction to C++ - Part IMichel Alves
 

Similar to Google Code Jam Practice (20)

Project seminar ppt_steelcasting
Project seminar ppt_steelcastingProject seminar ppt_steelcasting
Project seminar ppt_steelcasting
 
Class[2][29th may] [javascript]
Class[2][29th may] [javascript]Class[2][29th may] [javascript]
Class[2][29th may] [javascript]
 
DiscoGAN
DiscoGANDiscoGAN
DiscoGAN
 
Engineering + Programming portfolio
Engineering + Programming portfolioEngineering + Programming portfolio
Engineering + Programming portfolio
 
Class[6][5th aug] [three js-loaders]
Class[6][5th aug] [three js-loaders]Class[6][5th aug] [three js-loaders]
Class[6][5th aug] [three js-loaders]
 
mago3D: A brand new Geo-BIM platform on top of Cesium & World Wind
mago3D: A brand new Geo-BIM platform on top of Cesium & World Wind mago3D: A brand new Geo-BIM platform on top of Cesium & World Wind
mago3D: A brand new Geo-BIM platform on top of Cesium & World Wind
 
Summer training on matlab
Summer training on matlabSummer training on matlab
Summer training on matlab
 
Migrating from OpenGL to Vulkan
Migrating from OpenGL to VulkanMigrating from OpenGL to Vulkan
Migrating from OpenGL to Vulkan
 
GDG Kuwait - Modern android development
GDG Kuwait - Modern android developmentGDG Kuwait - Modern android development
GDG Kuwait - Modern android development
 
Introducing google’s mobile nets
Introducing google’s mobile netsIntroducing google’s mobile nets
Introducing google’s mobile nets
 
The Kokkos C++ Performance Portability EcoSystem
The Kokkos C++ Performance Portability EcoSystemThe Kokkos C++ Performance Portability EcoSystem
The Kokkos C++ Performance Portability EcoSystem
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Copy of Copy of Untitled presentation (1).pdf
Copy of Copy of Untitled presentation (1).pdfCopy of Copy of Untitled presentation (1).pdf
Copy of Copy of Untitled presentation (1).pdf
 
Scala can do this, too
Scala can do this, tooScala can do this, too
Scala can do this, too
 
Greedy subtourcrossover.arob98
Greedy subtourcrossover.arob98Greedy subtourcrossover.arob98
Greedy subtourcrossover.arob98
 
mloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game developmentmloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game development
 
Move from C to Go
Move from C to GoMove from C to Go
Move from C to Go
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).ppt
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.ppt
 
Minimal Introduction to C++ - Part I
Minimal Introduction to C++ - Part IMinimal Introduction to C++ - Part I
Minimal Introduction to C++ - Part I
 

More from guestef7fea (20)

Notes
NotesNotes
Notes
 
Blank
BlankBlank
Blank
 
Blank
BlankBlank
Blank
 
Blank
BlankBlank
Blank
 
Notes
NotesNotes
Notes
 
Blank
BlankBlank
Blank
 
Blank
BlankBlank
Blank
 
Blank
BlankBlank
Blank
 
1 How Stupid Can We Get
1 How Stupid Can We Get1 How Stupid Can We Get
1 How Stupid Can We Get
 
1 How Stupid Can We Get
1 How Stupid Can We Get1 How Stupid Can We Get
1 How Stupid Can We Get
 
Public
PublicPublic
Public
 
Private
PrivatePrivate
Private
 
Public
PublicPublic
Public
 
Private
PrivatePrivate
Private
 
Travel Club Training Presentation Final
Travel  Club  Training  Presentation FinalTravel  Club  Training  Presentation Final
Travel Club Training Presentation Final
 
Notes
NotesNotes
Notes
 
Google Code Jam Practice
Google Code Jam PracticeGoogle Code Jam Practice
Google Code Jam Practice
 
Notes
NotesNotes
Notes
 
Notes
NotesNotes
Notes
 
taking time
taking time taking time
taking time
 

Recently uploaded

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Recently uploaded (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

Google Code Jam Practice

  • 1. Google Code Jam Practice Problems A - Big City Skyline You've just moved to the Big City so you could start work at the newest Google office, Google BC, and the one thing that interests you most is the beautiful skyline. You're sitting on a hillside ten miles away, looking at the big rectangular buildings that make up the city, and you think back to your childhood. When you were a child, you used to make toy cities out of rectangular blocks. Each building could be made from multiple blocks, and each block could be part of multiple buildings. Looking at the skyline, you wonder: what is the biggest possible block that could be part of the Big City's skyline? Write a program that takes the description of the skyline as an input, and gives the area of the maximum- area rectangle as output. This program should take less than 4 minutes to run on a 2GHz computer with 512MB of RAM, even for the biggest input size we specify. Input: The city is made out of rectangular buildings, all next to each other. The input will consist of an integer N, the number of buildings, followed by a series of N number pairs wi hi, indicating the width and height of each building in order from left to right. The buildings' heights will be less than 100,000,000, and their widths will be less than 1000. Easy: 0 < N < 1,000 Hard: 0 < N < 10,000,000 Output: A single number: the area of the largest possible block. (Here’s the beautiful skyline of the Big City.) Sample Input Sample Output Explanation 51 5 The biggest block is shaded black 5 7 1 20 3 5 6 3 2 10 in the figure above. Google Code Jam Practice Problems © Google Inc. - September 2007 p. 1
  • 2. B - Universal Search You've just started your job at Google Moon, and you've been assigned to the universal search project: that is, of course, the functionality that lets people search for anything in the universe. Your starter project seems simple: find a flight path for the GCrawler (Galaxy Crawler) that will gather stock prices from all of the galactic stock exchanges, traveling between planets using Hyperspace Jumpgates. The known universe contains k stock exchanges and p inhabited planets. Each planet deals with one stock exchange, and every planet has a record of the stock prices for its exchange. Given a list of stock exchanges, their planets, and planet<->planet jumpgate connections, find a path for the GCrawler that contains the smallest number of jumpgates, but still passes through at least one planet from each stock exchange before returning home. Input: The input will start with p, the number of planets. Next will follow p lines of the form: planet_name stock_exchange connection1 connection2 ... connectionN If planet A connects to planet B, then planet B also connects to planet A. Planet and stock exchange names will contain only alphabetic characters [A-Za-z]. One of the planets will be named GoogleMoon; that is the start and end location for the GCrawler. Easy: 0 < p < 50, 0 < k < 5. Hard: 0 < p < 500, 0 < k < 16. Output: A series of planet names, separated by spaces, describing the path the GCrawler should take. Sample Input 5 GoogleMoon TheInternet Mars Earth Mars EarthStocks GoogleMoon AlphaCentauriII AlphaCetiV Earth EarthStocks GoogleMoon AlphaCentauriII AlphaStocks Mars AlphaCetiV AlphaCetiV AlphaStocks Mars AlphaCentauriII Sample Output GoogleMoon Mars AlphaCetiV Mars GoogleMoon Explanation The GCrawler has three stock exchanges to visit: TheInternet, EarthStocks and AlphaStocks. It starts on GoogleMoon, which deals with TheInternet; it then travels to Mars, which trades in EarthStocks, then to AlphaCetiV, which deals in AlphaStocks. Now it needs to get back home; the shortest route goes through Mars. Google Code Jam Practice Problems © Google Inc. - September 2007 p. 2