# Minimum Height Triangle

# Minimum Height Triangle

plague187x2 + 0 comments In the C# stub, base is a keyword and can't be used as a variable.

Slaunger + 1 comment C++: No need for floats

int main() { uint32_t a, b; cin >> b >> a; cout << 2 * a / b + bool((2 * a) % b); return 0; }

Himanshu98 + 0 comments nice approach simple and straight forward. Thanks

Vaibhav119 + 3 comments static int lowestTriangle(int base, int area){ // Complete this function return (int)Math.ceil(area*2/(double)base); }

a3deepstrik + 1 comment Teach me my dark master, for i am forever your.....!!

Vaibhav119 + 0 comments Definitely... for any doubt you are free to contact me or any other programmer here...

dipeshjadhav34 + 1 comment why is (double) base necessary?

abhiram_nataraj1 + 0 comments Dividing by an integer would truncate the value.We want the entire thing, example 2*5/3 gives 3 but we want 3.33 which would ceil to 4 3 would ceil to 3 itself

sravaniteja + 0 comments why do u use (double) for base here?

Aabhas99 + 0 comments *SOLUTION TO THE PROBLEM:**First , try your level best and then , IF you have any problem :**You can visit the link below to have the solution:*https://github.com/Aabhas99/HackerRank-Solution-To-Algorithms

*GOOD LUCK!!ðŸ˜Š*

jongod5399 + 0 comments I am so mad. One of the test cases' answer was 2000000 and C++ std::cout gave the output as 2e+06 instead of 2000000 so it gave a wrong answer... I really need to start using std::printf everywhere.

gmoreno + 0 comments Oneline on Ruby

((2 * area).to_f / base.to_f).ceil

jenilvagadiya19 + 0 comments ans= ceil( (2*area)/base)

geethapanchala + 0 comments ### #

niteshyadavand21 + 0 comments // for java if((2*area)%base!=0) {return (2*area)/base +1;} else return (2*area)/base;

Sort 36 Discussions, By:

Please Login in order to post a comment