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

 

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

Yoda wants to know if the positive integer input parameter can be expressed as the square of a positive integer, or the sum of the squares of two positive integers. Return true if the number CAN be expressed as a square or the sum of two squares. Return false otherwise. This method can be solved nicely using backtrack recursion, but recursion is NOT required! Choose the method of solution that you prefer. Full credit will be given for non-recursive solutions. However, bonus points are available for exceptionally well-done solutions that use backtrack recursion.


yodaSquaresAdvanced2(149) → true
yodaSquaresAdvanced2(2) → true
yodaSquaresAdvanced2(3) → false

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

public boolean yodaSquaresAdvanced2(int num) { }

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

Copyright Nick Parlante 2017 - privacy