GoCalf Calf 的自留地 · 昙花一现

全站内容

Calf

这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。

  • 3410. Maximize Subarray Sum After Removing All Occurrences of One Element

    Coding

    #Problem You are given an integer array nums. You can do the following operation on the array at most once: Choose any integer x such that nums remains non-empty on removing all occurrences of x. Remove all occurrences of x from the array. …

    hard
  • 3414. Maximum Score of Non-overlapping Intervals

    Coding

    #Problem You are given a 2D integer array intervals, where intervals[i] = [lᵢ, rᵢ, weightᵢ]. Interval i starts at position lᵢ and ends at rᵢ, and has a weight of weightᵢ. You can choose up to 4 non-overlapping intervals. The score of the …

    hard
  • 344. Reverse String

    Coding

    #Problem Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. https://leetcode.cn/problems/reverse-string/ Example 1: …

    easy
  • 347. Top K Frequent Elements

    Coding

    #Problem Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. https://leetcode.com/problems/top-k-frequent-elements/ Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: …

    medium
  • 349. Intersection of Two Arrays

    Coding

    #Problem Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order. https://leetcode.cn/problems/intersection-of-two-arrays/ Example …

    easy
  • 350. Intersection of Two Arrays II

    Coding

    #Problem Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order. …

    easy
  • 371. Sum of Two Integers

    Coding

    #Problem Given two integers a and b, return the sum of the two integers without using the operators + and -. https://leetcode.com/problems/sum-of-two-integers/ Example 1: Input: a = 1, b = 2 Output: 3 Example 2: Input: a = 2, b = 3 Output: …

    medium
  • 377. Combination Sum IV

    Coding

    #Problem Given an array of distinct integers nums and a target integer target, return the number of possible combinations that add up to target. The test cases are generated so that the answer can fit in a 32-bit integer. …

    medium
  • 382. Linked List Random Node

    Coding

    #Problem Given a singly linked list, return a random node’s value from the linked list. Each node must have the same probability of being chosen. Implement the Solution class: Solution(ListNode head) Initializes the object with the head of …

    medium
  • 417. Pacific Atlantic Water Flow

    Coding

    #Problem There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island’s left and top edges, and the Atlantic Ocean touches the island’s right and bottom edges. The island …

    medium