Problem 1444. Dots in a Circle
Return how many integer grid points there are inside a circle of radius r centred at (0,0) (including points on the edge).
Neither string operations nor interpolations are allowed!
Solution Stats
Problem Comments
-
5 Comments
@Michael_C. and @James, Thank you! I have indeed overlooked that edge case. The problem is now fixed. (The "for" loops are unnecessary).
Yaroslav, you are certainly correct that for loops are not needed. I just used them to confirm that my answer using the "no-for-loop-required algorithm" was correct before commenting on the problem. My similar problem (Cody problem 1387) only used integer radii.
Thanks for the correction!
Solution Comments
Show commentsProblem Recent Solvers97
Suggested Problems
-
7348 Solvers
-
Number of 1s in the Binary Representation of a Number
453 Solvers
-
Back to basics 23 - Triangular matrix
1023 Solvers
-
Volume difference between Ellipsoid and Sphere
129 Solvers
-
373 Solvers
More from this Author18
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!