about | help | code help+videos | done | prefs |
Remember, you are NOT allowed to go to other CodingBat problems, websites, documents, or anywhere else while taking a CodingBat quiz or test. Write a method that accepts two n-bit binary numbers, each in the form of a boolean array. For example, 1011 would be represented by {true, false, true, true}. Your method should use a helper method that emulates the one-bit binary adder using only logic operators. The resulting method may not use any addition, subtraction, multiplication, or division. It must accomplish n-bit binary adding using only logic operators! The method returns an (n+1)-bit binary number in the form of a boolean array where the most-significant bit (bit 0) represents the final carry bit. The two input arrays will have the same length, and each array will contain at least one element. may25_2018_APSL_nBitAdder([true, true, false, true, true, true, false, false, true, true, true, true, true, false, true, true, true, false, false, true, true, true], [true, true, false, true, true, true, false, false, true, false, true, true, true, true, true, true, true, false, false, true, true, true]) → [true, true, false, true, true, true, false, false, true, true, false, true, true, true, false, true, true, false, false, true, true, true, false] may25_2018_APSL_nBitAdder([true, true], [true, true]) → [true, true, false] may25_2018_APSL_nBitAdder([true], [false]) → [false, true] ...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: 280
Copyright Nick Parlante 2017 - privacy