Pursuant to the first problem in this series, this one involves checking for divisibility by 11.
Write a function to determine if a number is divisible by 11. Like the number seven, this can be done by a variety of methods. Some are:
Previous problem: divisible by 10. Next problem: divisible by 12.
Grant, your divisible series should become a challenge by its own right.
Thanks for the vote. We'll see if the Cody team agrees. I just added a few more problems to the series today to round it out.
Nice problem - deceptively tricky.
my solution is failing because when the numbers are very large it gets confused by the "eXX" where XX is the exponent associated with the test number.
Can i get help on how to avoid this?
You need to find a way to operate on the string, which may involve mathematical operations on small portions of the string, bit by bit, converting small portions of the string to a number, in an iterative fashion, etc., based on the method you choose. str2num() is subject to loss of precision for very large numbers and will not work for at least one test case in essentially all of these problems (by design).
given 3 sides, find area of this triangle
609 Solvers
What is the distance from point P(x,y) to the line Ax + By + C = 0?
221 Solvers
Find perfect placement of non-rotating dominoes (easier)
233 Solvers
246 Solvers
Given a 4x4 matrix, swap the two middle columns
366 Solvers