Sort by

recency

|

77 Discussions

|

  • + 0 comments

    int clique(int n, int m) { int i=2,c=0;

    long double r=0.0,e=0.0; e=(n*(n-1)/2); while(i<=m) {

    r=(long double)((i-1)*(n*n))/(long double)(2*i); 
    
    if(r>=m)
    {
    c=i;
    
    break;   
    }
    else 
    {
    if(r>e)
    {
    c=i;
    
    break;   
    }
    }
    i++;
    }  
    

    return c; } On submission the code fails for 9/11 test cases. But while giving custom input from the failed test cases, it works well. I am unable to find the exact reason. return c; }

  • + 0 comments

    here is my solution in java, javascript, python, C, C++, csharp HackerRank Clique Problem Solution

  • + 1 comment

    In Test 10 the 3rd input specifies 15 vertices and 144 edges. A 15-vertex simple graph can have at most 105 edges. If we consider multigraphs then the task is meaningless. The expected answer is 16, which is a nonsense. A 15 vertex graph cannot contain a 16 vertex subgraph! So that input is wrong.

  • + 0 comments

    Here is the solution of Clique Click Here

  • + 0 comments

    Those having a hard time implementing the formulae can see this.. https://cs.stackexchange.com/a/51033