Write a function that will read
scaleArr. In this array, there will be two elements. The first will contain two positive integers that represent the left and right sides of a scale respectively. The second array represents the available weights that can be added to either side.
Balance the scale by using the least amount of weight from the list. You can only use an integer from available weights once.
For example: If
scaleArr is ["[9,4]","[1,2,6,7]"], you must add 2 to the left side and 7 to the right side to balance the scale. Both sides will equal 11!
If it is not possible to balance the scale using the weight available, return
Good luck, happy coding!
Want to propose a challenge idea for a future post? Email firstname.lastname@example.org with your suggestions!