id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > ringWorldAliens4
prev  |  next  |  chance

RingWorld has many aliens inhabitants. They have a peculiar way of stating numbers. Each alien states a number by actually SAYING a number less than the number they mean. They do this because all numbers implicitly include additional size based on the number of letters in the speakers name. In other words, an alien named "Floxwel" would state OUR number 20 by saying "13". Anyone who heard Floxwel say 13 would know he really meant OUR number 20 because he has 7 letters in his name. Floxwels wife "Bla" would say OUR number 20 by saying "17". Hopefully you see how this system works! It seems strange to us, but everyone on RingWorld grows up with this system so it seems natural to them. Write a method that accepts an array of alien names, then an array of OUR integers. For each alien, in order, convert ALL of OUR numbers to what that alien would call that number. For example, ringWorldAliens4({"Tom", "Sally"}, {50, 10, 90}) would return {47, 7, 87, 45, 5, 85}. Note that the first three numbers in this array are how "Tom" would say our list of numbers. The next three numbers in the returned array are how "Sally" would say our list of numbers. Your method must work no matter how long the list of aliens is and no matter how long the list of numbers is (within reason). As always, look at the test data for further examples.


ringWorldAliens4(["Lichneria"], [17]) → [8]
ringWorldAliens4(["Arthenhallanfeldsabar", "Lu"], [63, 532, 11]) → [42, 511, -10, 61, 530, 9]
ringWorldAliens4(["qBert", "da", "Z"], [100, 400, 50]) → [95, 395, 45, 98, 398, 48, 99, 399, 49]

...Save, Compile, Run (ctrl-enter)

public int[] ringWorldAliens4(String[] names, int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy