#187

Поділитися
Вставка
  • Опубліковано 4 лис 2024

КОМЕНТАРІ • 18

  • @MilanNakum-g2c
    @MilanNakum-g2c 4 місяці тому +3

    bro formula for volume u calculated in here is different from which u implemented in the code , in the code u implemented volume=l^2 *(p/4)-(2*l);
    which i could n't find in here 5:40

  • @aizad786iqbal
    @aizad786iqbal 4 місяці тому +1

    why are you caculating twice
    perimeter - (sqrt(pow(perimeter, 2) - (24 * area)))) / 12,
    Please try to upload cleaner code

    • @maskedcoder-dy1ub
      @maskedcoder-dy1ub  4 місяці тому

      You can create one variable and use it once as well
      No problem in that too

  • @aizad786iqbal
    @aizad786iqbal 4 місяці тому +1

    also tried to code based on given volume formula but it was failing for big test case
    your code logic seems different ...

  • @siddharthbhagat7637
    @siddharthbhagat7637 4 місяці тому +1

    Bro pls help it is getting stuck at 1110 test case I dont know whats the problem...
    // User function Template for Java
    class Solution {
    double maxVolume(double perimeter, double area) {
    // code here
    double h=(perimeter/2-Math.sqrt(perimeter*perimeter/4-6*area))/6;
    double v=h*area/2-h*h*perimeter/4+h*h*h;
    return v;
    }
    }

  • @Shiva_XD_
    @Shiva_XD_ 4 місяці тому +2

    Here is my code which is easy to Understand:
    double l = (p - sqrt((p * p) - (24 * a))) / 12;
    double ans = (l * l) * ((p / 4) - (2 * l));
    return ans;

    • @AbhieramBandaru
      @AbhieramBandaru 4 місяці тому +1

      could you explain how we got this formula as the original formula explained in the video was AL/2 -PL^2/4+L^3

    • @Shiva_XD_
      @Shiva_XD_ 4 місяці тому

      @@AbhieramBandaru simplifying equations

  • @AmanKumar-ux1ww
    @AmanKumar-ux1ww 4 місяці тому +2

    yeh math ka question tha ya coding ka

  • @entreprenuermind7453
    @entreprenuermind7453 4 місяці тому +1

    ans at 110 coming 1131004.73 but my output comes out to be 1131004.67

    • @Shiva_XD_
      @Shiva_XD_ 4 місяці тому +1

      same problem here, too
      got 1110 / 1115 Passed Testcases
      My Code:
      double l = (p - sqrt((p * p) - (24 * a))) / 12;
      double ans = (l * a * 0.5) - (l * l * p * 0.25) + pow(l, 3);
      return ans;

  • @raghavendrac4710
    @raghavendrac4710 4 місяці тому

    Thanks for the amazing explanation