Monday, 29 Nov 2021
Category: square-rectangle

class Node:          def __init__(self, val):        self.data = val        self.next = None        self.prev = None        self.top = None        self.bottom = None    class LinkedList:          def __init__(self):        self.head = None              def Quad(self, grid, n, m):                  self.head = Node(grid[0][0])                  temp = self.head                  i = 0        j = 1                  while temp.top != self.head:                                                                                      if j < m and i == 0:                temp.next = Node(grid[i][j])                temp = temp.next                j += 1                                      elif j == m and i < n - 1:                i […]

Given two positive integers h and w representing the height h and width w which forms a rectangle. Also, there are two arrays of integers horizontalCuts and verticalCuts where horizontalCuts[i] is the distance from the top of the rectangle to the ith horizontal cut and similarly, verticalCuts[j] is the distance from the left of the […]

Area of a triangle with two vertices at midpoints of opposite sides of a square and the other vertex lying on vertex of a squareGiven a positive integer N representing the side of a square, the task is to find the area of a triangle formed by connecting the midpoints of two adjacent sides and […]