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

 

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

Given an array of integers 'nums', return the number in the array that has the most factors of 2. As a precondition, you may assume that there will be a clear winner in which number has the most factors of 2 (meaning that there will not be ties for first place). Note: If there is a single number in the array and it has NO factors of 2, then just return that number (because it has the MOST factors of 2 in the array with ZERO factors of 2).


quiz2021_12_08_SLHL_mostAwesome([65536, 5040, 512, 4194304, 222222222, 40, 60000]) → 4194304
quiz2021_12_08_SLHL_mostAwesome([3]) → 3
quiz2021_12_08_SLHL_mostAwesome([17, 11, 19, 23, 2, 51, 91]) → 2

...Save, Compile, Run (ctrl-enter)

public int quiz2021_12_08_SLHL_mostAwesome(int[] nums) { }

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

Copyright Nick Parlante 2017 - privacy