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

 

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

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)

public int[] allNegate(int[] digits) { }

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: 210

Copyright Nick Parlante 2017 - privacy