Problem 45266. Restricted Subtraction v1
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
Show
1 older comment
goc3
on 9 Nov 2020
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.
goc3
on 9 Nov 2020
I also deleted the most recent hacking solutions.
Rafael S.T. Vieira
on 14 Nov 2020
Thanks again for fixing it, Grant. :)
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems
-
1965 Solvers
-
Back to basics 18 - justification
199 Solvers
-
Determine Whether an array is empty
783 Solvers
-
Convert from Base 10 to base 5
263 Solvers
-
287 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!