Sort by

recency

|

2095 Discussions

|

  • + 0 comments

    A drawing book is a creative space where artists of all ages express ideas through sketches, doodles, and designs. It encourages imagination, improves hand-eye coordination, and helps develop artistic skills. With the Accelerated App, users can now digitize their drawing book pages instantly, enhancing creativity by blending traditional drawing with modern technology, making it easier to share and store artwork.

  • + 0 comments

    C# return p <= n / 2 ? p / 2 : (n/2 -p/2);

  • + 0 comments

    C++ one liner:

    int pageCount(int n, int p) { return std::min(p/2, ((n/2)-(p/2))); }

  • + 0 comments

    My humble python solution:

    # Write your code here
    
    #left to right
    min_left = p // 2
    
    #right to left
    n = n + 1 if n % 2 == 0 else n
    min_right = (n - p) // 2
    
    return min_left if min_left <= min_right else min_right
    
  • + 0 comments

    Typescript Solution:

    const pageCount = (n: number, p: number): number => Math.min(Math.floor(p / 2), Math.floor(n / 2) - Math.floor(p / 2));