All Posts

Leetcode 456: 132 Pattern

Given an array of integers, determine if there exists a subsequence of three integers nums[i], nums[j], nums[k] where i < j < k and nums[i] < nums[k] < nums[j]. Return true if such a subsequence exists, otherwise return false.

Leetcode 497: Random Point in Non-overlapping Rectangles

You are given an array of non-overlapping axis-aligned rectangles. Each rectangle is represented by its bottom-left and top-right corner. Your task is to design a system that can pick a random integer point from the space covered by one of the given rectangles. A point on the perimeter of a rectangle is considered inside the rectangle.

Leetcode 729: My Calendar I

You are implementing a calendar application where you can add events. Each event has a start time and end time represented by a half-open interval [start, end). An event can only be added if it does not overlap with existing events in the calendar. Return true if the event can be booked successfully, and false if it causes a conflict.

Leetcode 731: My Calendar II

You are implementing a calendar system where you can add events. Each event is represented by a start time and an end time, defined as a half-open interval [startTime, endTime). You need to ensure that no more than two events overlap at any given time, or else return false. Your task is to implement a class, MyCalendarTwo, that will book events while preventing triple bookings.

Leetcode 855: Exam Room

You are tasked with simulating an exam room where students will choose seats based on a strategy that maximizes their distance from the closest person already seated. If multiple seats have the same distance, the student will choose the seat with the smallest index. Additionally, students can leave the room, freeing up their seats.

Leetcode 1348: Tweet Counts Per Frequency

A social media company wants to analyze tweet activity by counting the number of tweets in given time periods, broken down by minute, hour, or day frequency. Design an API to record tweets and calculate the number of tweets within specific time intervals.