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

 

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

Write a method that returns the product of all the pairs of elements taken from two arrays. The two arrays do not have to be the same length. Stop at the end of the shorter array. But there is a twist! If the product ends in zero, get rid of the last zero! For example, if the product is 4250, then you make that element 425 instead. This does not "cascade", so if the product is 5000 you use 500 for that element. ONLY do this for products that end with a zero. You are NOT allowed to use ANY string methods! Look at the test data for examples.


sept26_2019_SLHL_multiply([5, 7, 3, 10, 4, 9], [9, 100, 1, -2]) → [45, 70, 3, -2]
sept26_2019_SLHL_multiply([54, 72, 21, 15], [20, 53, 18, 23]) → [108, 3816, 378, 345]
sept26_2019_SLHL_multiply([5, 7, 6], [2]) → [1]

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

public int[] sept26_2019_SLHL_multiply(int[] a, int[] b) { }

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