All Posts

Leetcode 376: Wiggle Subsequence

A wiggle subsequence is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequences. Given an integer array nums, return the length of the longest wiggle subsequence of nums.

Leetcode 397: Integer Replacement

Given a positive integer n, you can perform one of the following operations: If n is even, divide n by 2. If n is odd, you can either add 1 to n or subtract 1 from n. Your task is to return the minimum number of operations required to reduce n to 1.

Leetcode 402: Remove K Digits

Given a string num representing a non-negative integer and an integer k, remove k digits from num such that the remaining number is the smallest possible integer.

Leetcode 409: Longest Palindrome

Given a string consisting of lowercase and/or uppercase English letters, find the length of the longest palindrome that can be constructed from the letters in the string. Letters are case-sensitive.

Leetcode 435: Non-overlapping Intervals

Given an array of intervals, where each interval is represented by a pair of integers [start, end], the goal is to determine the minimum number of intervals to remove to make the rest non-overlapping. Intervals that only touch at a point are considered non-overlapping.

Leetcode 452: Minimum Number of Arrows to Burst Balloons

There are several balloons attached to a flat wall, represented as intervals along the x-axis. Each balloon’s horizontal span is given by a pair of integers [xstart, xend], and you must find the minimum number of arrows required to burst all the balloons. An arrow travels infinitely upwards and bursts any balloon that overlaps with its path.