Tag:Side length

  • DP is violence, violence is art

    Time:2021-12-4

    Title address (interview question 17.23. Maximum black square matrix) https://leetcode-cn.com/probl… Title Description Given a square matrix, each unit (pixel) is either black or white. An algorithm is designed to find the largest sub matrix with four edges of black pixels. Returns an array [R, C, size], where   r,   c   Represents the row […]

  • JavaScript graphic example: hexaflake fractal like snowflake

    Time:2021-4-30

    Write the following function:    function drawHexagon(x,y,L)    {         ctx.beginPath();         ctx.moveTo(x-sqrt3/2*L,y-L/2);         ctx.lineTo(x-sqrt3/2*L,y+L/2);         ctx.lineTo(x,y+L);         ctx.lineTo(x+sqrt3/2*L,y+L/2);         ctx.lineTo(x+sqrt3/2*L,y-L/2);         ctx.lineTo(x,y-L);         ctx.closePath();         ctx.fillStyle = “#00FFFF”;         ctx.fill();    } The value of sqrt3 in the function is math. Sqrt (3). The function is: take the coordinate (x, y) as the center […]