All Posts

Leetcode 649: Dota2 Senate

In a Senate made up of senators from two parties, Radiant and Dire, senators can either ban another senator from voting or announce victory if only one party remains with active senators. Predict which party will announce the victory and change the game.

Leetcode 918: Maximum Sum Circular Subarray

You are given a circular integer array nums of length n. A circular array means that the end of the array connects back to the beginning. Your task is to find the maximum possible sum of a non-empty subarray of nums, which can wrap around the array. Formally, you need to find the maximum sum of a subarray where the subarray can either be within the linear array or it can wrap around from the end to the beginning.

Leetcode 950: Reveal Cards In Increasing Order

You are given an array of integers, where each integer represents a unique card in a deck. The deck can be shuffled into any order, and the goal is to reorder it such that the cards are revealed in increasing order. To do this, you repeatedly reveal the top card and move the next card to the bottom of the deck until all cards are revealed. The problem is to return the order of cards that would reveal them in increasing order.

Leetcode 1352: Product of the Last K Numbers

Design an algorithm that accepts a stream of integers and retrieves the product of the last k integers in the stream.

Leetcode 1438: Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit

Given an array of integers nums and a positive integer limit, determine the length of the longest subarray where the absolute difference between the minimum and maximum elements is less than or equal to limit.

Leetcode 1670: Design Front Middle Back Queue

Design a queue that supports operations at the front, middle, and back. Implement the FrontMiddleBackQueue class with methods for adding and removing elements from these positions.