Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 420 Bytes

doubling.md

File metadata and controls

22 lines (16 loc) · 420 Bytes

doubling

Given a list of integers, return a list where each integer is multiplied by 2.

doubling([1, 2, 3]) → [2, 4, 6]
doubling([6, 8, 6, 8, -1]) → [12, 16, 12, 16, -2]
doubling([]) → []

Solution:

public List<Integer> doubling(List<Integer> nums) {
  nums.replaceAll(n -> n*2);
  return nums;
}

codingbat

< back to readme