Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | LeetCode 1465 | Golang

Опубликовано: 29 Октябрь 2024
на канале: The Exception Handler
353
19

Here is the solution to "Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts " leetcode question. Hope that you will like the way I have explained the solution.

Problem Statement:
You are given a rectangular cake of size h x w and two arrays of integers horizontalCuts and verticalCuts where:

horizontalCuts[i] is the distance from the top of the rectangular cake to the ith horizontal cut and similarly, and
verticalCuts[j] is the distance from the left of the rectangular cake to the jth vertical cut.

Return the maximum area of a piece of cake after you cut at each horizontal and vertical position provided in the arrays horizontalCuts and verticalCuts. Since the answer can be a large number, return this modulo 10^9 + 7.

******* Table of content *******
00:00 Understanding the problem statement
03:00 understanding problem with an example
09:40 Algo
11:41 understand the algo with example (dry run of algo)
15:15 find time and space complexity of the algo
18:40 Final code in Golang
22:10 Thank you


#leetcode #leetcodesolution #programming #interviewquestions #codinginterview #amazoninterview #theexceptionhandler