How many minimum days will he take to complete N units of work? A person has to complete N units of work; the nature of work is the same.
In order to get the hang of the work, he completes only one unit of work in the first day.
He wishes to celebrate the completion of work, so he decides to complete one unit of work in the last day.
He is only allowed to complete x, x+1 or x-1 units of work in a day, where x is the units of work completed on the previous day.
Your task is to create a program or function that will compute the minimum number of days will he take to complete N units of work.
Sample Input and Ouput:
input -&gt; output (corresponding work_per_day table)
-1    -&gt; 0      []
0     -&gt; 0      []
2     -&gt; 2      [1,1]
3     -&gt; 3      [1,1,1]
5     -&gt; 4      [1,1,2,1] or [1,2,1,1]
9     -&gt; 5      [1,2,3,2,1]
13    -&gt; 7      [1,2,2,2,3,2,1]

Input may be taken through STDIN or as function argument, or in any appropriate way.
Output may be printed or as the result of a function, or in any appropriate way.
This is code-golf. Shortest solution wins.
Pyth, 8 bytes

tfg/*TT4


How it works:

tfg/*TT4   Q is implicitly assigned to the input.
 f         test for T=1,2,3,... returning the first successful case
   /*TT4   whether T * T / 4
  g     Q  is greater than or equal to the input (second argument implied)
t          and subtract 1 from the first successful case


Try it online!

In pseudo-code:

for(int T=1;;T++)
    if(T*T/4 &gt;= Q)
        return T-1;


bonus, 22 bytes

"should return 7 for -1"

+tfg/*TT4?&gt;Q0Q-2Q1*4g1


Try it online!