over the years I always encountered these kind of problems, and I've never solved them the way it felt "right".
imagine I have to implement a function/method to judge level of a river.the int river()
gives us int from 0 to 10
, which means
0 being no water passed at all
, and
10 means near-over-flow
normally I would take the output for a few sec/min and then grade it to some groups such as empty/ half-full / full
if time is a free option here, how would you collect the output of river()
, and judge after a few sec/min ? or even is it correct and reliable to use Time
as a parameter in these kind of problems.
Im asking for an Idea of algorithm to solve these type of questions. Respect
Edit1: bold part is my main question
Edit2: by Time
, I mean implementing a Runnable
and call it every 10 sec