about | help | code help+videos | done | prefs |
Given an ArrayList of numbers, find out if any numbers do not have their additive inverse (the result of multiplying by -1) present elsewhere in the list. For those numbers, add the additive inverse as the next element in the list after the first instance of the unmatched number. Return the modified list. apcsaListAddNegations([-1]) → [-1, 1] apcsaListAddNegations([2, -2]) → [2, -2] apcsaListAddNegations([2, -2, 2]) → [2, -2, 2] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 320
Copyright Nick Parlante 2017 - privacy