Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iwharris/hackerrank-spacex
Solution for the SpaceX challenge for HackerRank
https://github.com/iwharris/hackerrank-spacex
Last synced: 1 day ago
JSON representation
Solution for the SpaceX challenge for HackerRank
- Host: GitHub
- URL: https://github.com/iwharris/hackerrank-spacex
- Owner: iwharris
- License: gpl-2.0
- Created: 2015-09-19T19:33:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-19T20:02:50.000Z (about 9 years ago)
- Last Synced: 2023-02-26T20:56:57.549Z (over 1 year ago)
- Language: Python
- Size: 152 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
hackerrank-solutions
====================Solutions to the original HackerRank challenges.
###Alpha
The SpaceX challenge required you to decode garbled strings that were encoded with different methods.
The first 10,000 strings were encoded with a ROT cipher. Your task was to compute the rotation offset and decode the string. The decoded strings then had to be parsed into integers and submitted. For example, the decoded string "four thousand, three hundred and twenty-one" had to be parsed into 4321. This was easy enough to brute-force (with 25 possible offsets for each encoded string).
The following 1,000 strings would decode into a Wikipedia URL. However, it was difficult to tell if a decoded string is a valid URL. The brute-force approach is to try all 26 possible URLs until you receive a response. Once you retrieve the page content, you had to scrape the page to find the 4-digit code and submit it. I used [Beautiful Soup](http://www.crummy.com/software/BeautifulSoup/) to scrape the pages.