- There is 12 ball where 1 ball slightly different weight than others eleven.
- The differnce ball could be heavier or lighter than others.
- There is one scale to measure the ball.
- Best amount of scale use is 3 times only.
can you achieve that?? :)
coding instruction;
scaling will produce three result, right is lighter, right is heavier, or scale balance.
so it meant in each of the scale interval only can use three if()else if() else{} three time only, or one switch statement with three case. ball setup there is 12 identical ball there place in array as weight 1. one random ball weight between 0 to 2 replace randomly in ball setup array. if weight random ball equal to one the system will failed as 12 ball now identical
Checking. There is while loop checking the riddle.
tsc riddle.ts
node riddle.js