All Posts

Leetcode 377: Combination Sum IV

Given an array of distinct positive integers nums and a target integer target, determine the number of possible combinations of elements from nums that sum up to target. You can use any element of nums multiple times in a combination. A combination is considered different if the sequence of numbers is different, even if the same numbers are used.

Leetcode 392: Is Subsequence

Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence is formed by deleting some characters of t while maintaining the relative order of the remaining characters.

Leetcode 396: Rotate Function

You are given an integer array nums of length n. For each rotation k, we define a function F(k) which is calculated as: F(k) = 0 * arrk[0] + 1 * arrk[1] + … + (n-1) * arrk[n-1]. The goal is to return the maximum value of F(k) for all possible k in the range from 0 to n-1.

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 416: Partition Equal Subset Sum

Given an integer array, determine if it is possible to partition the array into two subsets with equal sum. Return true if such a partition exists, otherwise return false.

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.