We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Mathematics
  3. Fundamentals
  4. Minimum Height Triangle
  5. Discussions

Minimum Height Triangle

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 332 Discussions, By:

votes

Please Login in order to post a comment

  • Slaunger
    5 years ago+ 11 comments

    C++: No need for floats

    int main() {
        uint32_t a, b;
        cin >> b >> a;
        cout << 2 * a / b + bool((2 * a) % b);   
        return 0;
    }
    
    35|
    Permalink
    View more Comments..
  • plague187x2
    5 years ago+ 6 comments

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

    20|
    Permalink
    View more Comments..
  • aarcangeli
    3 years ago+ 5 comments

    C++: One line solution without using float

    int lowestTriangle(int base, int area){
        // Complete this function
        return (area * 2 + (base - 1)) / base;
    }
    
    9|
    Permalink
    View more Comments..
  • rk513
    4 years ago+ 2 comments

    height = (int)Math.ceil((2.0*area)/base);

    6|
    Permalink
  • jongod5399
    5 years ago+ 2 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.

    2|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature