-
19 votes
-
GEARS 5 Gears Forever | Launch trailer
5 votes -
Magic: the Gathering - Throne of Eldraine mechanics
8 votes -
The gut-wrenching predictions of Satoshi Kon’s masterpiece Perfect Blue came true
6 votes -
Bad Boys For Life | Official trailer
5 votes -
Programming Challenge: Convert between units
Hi everyone! It's been a long time since last programming challenge list, and here's a nice one I've encountered. If you search for something like 7km to AU, you'll get your answer. But how is it...
Hi everyone! It's been a long time since last programming challenge list, and here's a nice one I've encountered.
If you search for something like 7km to AU, you'll get your answer. But how is it done? I don't think they hardcoded all 23 units of distance and every conversion factor between them.
If you were programming a conversion system - how would you do it?
First of all, you have input in format that you can specify, for example something like this:
meter kilometer 1000 mile kilometer 1.609344 second minute 60 ...Then you should be able answer queries. For example
7 mile metershould convert 7 miles to meters, which is11265.41.Can you design an algorithm that will convert any unit into any other unit?
Edit: Some conversion rates I extracted from wikipedia:
ångström 0.1nm astronomical unit 149597870700m attometre 0.000000000000000001m barleycorn 8.4m bohr 0.00846 cable length (imperial) 185.3184m cable length 185.2m cable length (US) 219.456m chain (Gunters) 20.11684m cubit 0.5m ell 1.143m fathom 1.8288m femtometre 0.00000000000001m fermi 0.00000000000001m finger 0.022225m finger (cloth) 0.1143m foot (Benoit) 0.304799735m foot (Cape) (H) 0.314858m foot (Clarke's) (H) 0.3047972654m foot (Indian) (H) 0.304799514m foot,metric 0.31622776602m foot,metric (long) 0.3m foot,metric (short) 0.30m foot (International) 0.3048m foot (Sear's) (H) 0.30479947m foot (US Survey) 0.304800610 french 0.0003m furlong 201.168m hand 0.1016m inch 0.0254m league 4828m light-day 25902068371200m light-hour 107925284880m light-minute 17987547480 light-second 299792458m light-year 31557600light-second line 0.002116m link (Gunter's) 0.2011684m link (Ramsden's; Engineer's) 0.3048m metre 1m m 1metre km 1000m mickey 0.000127 micrometre 0.000001 mil; thou 0.0000254 mil 10km mile (geographical) 6082foot (International) quarter 0.2286m rod 5.0292m rope 6.096m shaku 0.303 0303m span (H) 0.2286m stick (H) 0.0508m toise 1.949 0363m twip 1.76310 yard 0.9144m17 votes -
Google and YouTube will pay record $170 million for alleged violations of US children’s privacy law
6 votes -
Steam Library overhaul coming to open beta on September 17, will focus on organization and events
9 votes -
Brave uncovers Google’s GDPR workaround
13 votes -
Syl Johnson -- Thank You Baby
4 votes -
How do people learn to cook a poisonous plant safely?
13 votes -
Senator Warren's climate change plan: 100% clean energy for America
11 votes -
Hong Kong government withdraws extradition bill, a key demand of protesters
19 votes -
Norway's bold plan to tackle overtourism and climate change at the same time
9 votes -
What email provider do you use?
I’m currently using ProtonMail, I’ve been with them since Indiegogo. I know calendar’s supposed to come out in beta this month, but I’m honestly fed up with the speed of their development and the...
I’m currently using ProtonMail, I’ve been with them since Indiegogo. I know calendar’s supposed to come out in beta this month, but I’m honestly fed up with the speed of their development and the quality of apps, and I think it’s too expensive.
I need custom domain support, and calendar. Nothing fancy.
Self-hosting email is out of the question in 2019.What are you guys using for email these days?
25 votes -
The Danish centre-left aped the far right to win an election – there's a better way to deal with people's fears
9 votes -
Cherokee nation takes up 1835 treaty right and names first delegate to US Congress
18 votes -
Mike Pence heads into potential new Nordic storm with Iceland visit
6 votes -
The Booth at the End
4 votes -
US Senator says Facebook’s Mark Zuckerberg should face ‘possibility of a prison term’
14 votes -
Australian Federal Police raid Canberra home where intelligence officer lived
3 votes -
Tennis needs change if it wants to restore fairness and transparency
4 votes -
Burnout symptoms in tech
7 votes -
AMD announces BIOS fix for Ryzen 3000 boost clocks, update comes September 10
7 votes -
Why everyone should care about what is happening in Hong Kong, despite all the world’s troubles
10 votes -
Australian government braces for poor GDP result as shoppers keep wallets shut
7 votes -
Philippines Supreme Court thumbs down same-sex marriage petition
7 votes -
Brexit: Boris Johnson defeated as MPs take control
32 votes -
Communications and internet have been blacked out in Kashmir since August 4 - five people explain what it's like to live through
8 votes -
Session | Steam Early Access trailer
6 votes -
Android 10 has been released
13 votes -
Yooka-Laylee and the Impossible Lair | Release date trailer (October 8, 2019)
4 votes -
What's it like to have conversion therapy?
9 votes -
Go 1.13 Is Released
6 votes -
What games have you been playing, and what's your opinion on them?
What have you been playing lately? Discussion about video games and board games are both welcome. Please don't just make a list of titles, give some thoughts about the game(s) as well.
20 votes -
Brains on Film - Documentary about an 80s public access show that praised cult movies
3 votes -
Virtual Cards by Privacy
8 votes -
Conservative MP Phillip Lee has defected to the Liberal Democrats ahead of a crucial no-deal vote, leaving the PM with no working majority
22 votes -
Anamanaguchi - Lorem Ipsum (Arctic Anthem) (2019)
7 votes -
Mozilla’s Manifest v3 FAQ
5 votes -
Hurricane Dorian: Storm inches north west, leaving devastation in Bahamas
5 votes -
Firefox 69.0 released
22 votes -
Girls’ comparative advantage in reading can largely explain the gender gap in math-related fields
16 votes -
Jojo Rabbit | Official trailer
6 votes -
Reducing your own carbon footprint is great, but it won’t save the planet unless governments and corporations step up
19 votes -
Lezer (the parser used in CodeMirror 6)
3 votes -
Swedish cashless app Swish is teaming up with six other companies to form a European network of mobile payment solutions
5 votes -
Five steps to becoming a read out-loud book hero
10 votes -
Finland under pressure to criminalise lack of consent in rape laws
10 votes -
The country disappearing under rising tides
4 votes