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 659: Split Array into Consecutive Subsequences

You are given a sorted integer array nums. Determine if it is possible to split nums into one or more subsequences such that each subsequence is a consecutive increasing sequence and each subsequence has a length of 3 or more.

Leetcode 670: Maximum Swap

You are given an integer num, and you can swap two digits at most once to get the largest possible number. Return the maximum number that can be obtained after performing the swap.

Leetcode 678: Valid Parenthesis String

Given a string consisting of ‘(’, ‘)’, and ‘’, determine if the string is valid according to the following rules. ‘’ can be treated as a left parenthesis, a right parenthesis, or an empty string.

Leetcode 714: Best Time to Buy and Sell Stock with Transaction Fee

You are given an array prices where prices[i] represents the price of a stock on the i-th day, and an integer fee that represents a transaction fee for each transaction. The task is to calculate the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction.

Leetcode 738: Monotone Increasing Digits

Given an integer n, return the largest number less than or equal to n with digits in monotone increasing order, meaning each digit is less than or equal to the next one.