In this post, I’m going to explain to you how I solved the dividing a plot problem using Scala.
You’re a farmer, and you want to divide a farm plot into smaller plots. Then, you must follow the next conditions.
- All the smaller plots must be squares.
- All the smaller plots must have the same size.
- The new plots must have an area greater than zero.
This exercise is mentioned in the book Grokking Algorithms of Aditya y. Bhargava.
About the solution.
- I’m using Scala.
- I added many comments, you can disable them, by changing the value in UtilsObject.
- There are some sanity checks, there aren’t part of the solutions. They are small tests, just to make sure everything is running properly.
- You can track every recursive step in the comments.
- If you’re learning recursion, I also mentioned when the program is running a base step.
- I tried to make the code very descriptive.
- I used IntelliJ for running, a scratch file.
- #HowTo Upgrade the JRE 8 to 11 in Teamcity (Windows). - 2023-01-05
- #How to resolver el error: MSB4019: The imported project «Microsoft.Data.Tools.Schema.SqlTasks.targets» was not found - 2023-01-03
- #HowTo Resolver error MSB4019: No se encuentra el proyecto importado Microsoft.WebApplication.targets - 2022-11-24