about | help | code help+videos | done | prefs |
Write a method that accepts an array of integers of any length, but each integer is either a 0 or 1 representing a binary digit. Return an array of integers of the same length with each binary digit switched with its opposite digits. In other words, return an array that has a 1 where the 0's were and a 0 where the 1's were. allNegate([1, 1, 0]) → [0, 0, 1] allNegate([1]) → [0] allNegate([0]) → [1] ...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: 210
Copyright Nick Parlante 2017 - privacy