All Posts

Leetcode 1027: Longest Arithmetic Subsequence

Given an array of integers, you need to return the length of the longest subsequence where the difference between consecutive elements is constant. A subsequence is derived by deleting some elements without changing the order of the remaining elements. A sequence is considered arithmetic if the difference between consecutive elements remains the same.

Leetcode 1031: Maximum Sum of Two Non-Overlapping Subarrays

You are given an array of integers nums and two integers firstLen and secondLen. Your task is to find the maximum sum of elements from two non-overlapping subarrays of lengths firstLen and secondLen. The subarrays can appear in any order, but they must not overlap.

Leetcode 1035: Uncrossed Lines

Given two integer arrays, nums1 and nums2, we write the integers of both arrays on two separate horizontal lines. We can draw connecting lines between the elements of nums1 and nums2 if they are equal and the lines do not intersect. The objective is to return the maximum number of connecting lines that can be drawn between the two arrays without any line intersecting.

Leetcode 1039: Minimum Score Triangulation of Polygon

Given an integer array representing the values at the vertices of a convex polygon, you need to triangulate the polygon in such a way that the sum of the products of the values at the vertices of all triangles is minimized. Each triangle must consist of three vertices of the polygon, and the number of triangles will always be n - 2, where n is the number of vertices in the polygon.

Leetcode 1043: Partition Array for Maximum Sum

Given an array of integers, partition the array into contiguous subarrays where each subarray has a length of at most k. After partitioning, transform each subarray such that all its elements are replaced by the maximum element of that subarray. Your goal is to return the maximum sum of the transformed array.

Leetcode 1048: Longest String Chain

You are given an array of words, where each word consists of lowercase English letters. A wordA is considered a predecessor of wordB if you can insert exactly one letter anywhere in wordA without changing the order of the other characters to make it equal to wordB. A word chain is a sequence of words such that each word is a predecessor of the next one. Your task is to find the length of the longest word chain that can be formed from the given list of words.