about | help | code help+videos | done | prefs |
The method accepts a string in the form "ax^2+bx+c" where a, b, and c are integers (which could include positive, negative, or zero values). Return true if the quadratic can be factored into the product of two binomials with integer coefficients and constants. Return false otherwise. For example, canItFactor("1x^2+5x+6") returns true because 1x^2+5x+6=(x+3)(x+2). (Note that you are only returning true or false NOT the factored form.) Another example is canItFactor("1x^2-9x") returns true because it can be factored as (x-9)(x+0) (Note that it is OK to call the second term a binomial in this case if we write it with the "+0"). Likewise "1x^2" returns true since it equals (x+0)(x+0). Another case is "8" which returns true since you can write it a (0x+8)(0x+1). canItFactor("8") → true canItFactor("1x^2+5x+6") → true canItFactor("2x^2+2x-1") → false ...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: 440
Copyright Nick Parlante 2017 - privacy