Subtract two inputs without use of common arithmetic operations. Unfortunately, in order to enforce this restriction, other restrictions are imposed. For example, use of 'e' is restricted to prevent use of 'eval' functions.
Until the Cody test system is changed, the hack below will work (as it currently does on every Cody problem). However, this type of solution is not appreciated.
function ans = fileread(~), ''
Other hacks are appreciated. If you can circumvent the restrictions (with your code running when called by tests 2, 3, ...) to use subtraction, then you have a valid and welcomed solution.
This version of the problem does not require hacks at all, just some basic MATLAB creativity!
See also:
Solution Stats
Problem Comments
4 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers9
Suggested Problems
-
98 Solvers
-
Project Euler: Problem 5, Smallest multiple
1648 Solvers
-
542 Solvers
-
967 Solvers
-
String substitution, sub problem to cryptoMath
242 Solvers
More from this Author9
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Please, do not use isequal with floats, prefer abs(a-b) < tol. I've found a solution, but it gives an error of order 1e-15. Rounding solutions to 10 or 14 decimal places is close enough. And looking at all other solutions so far, I am the first one to truly solve this problem (please, try my commented code).
Wow! That was hard to fix. The problem now tests against a tolerance of 1e–10. I also had to update a few of the anti-hacking checks to allow for a solution. Thanks to Rafael S.T. Vieira for providing a solution that could be used as a reference while fixing the test suite.
I also deleted the most recent hacking solutions.
Thanks again for fixing it, Grant. :)