GoCalf Calf 的自留地 · 昙花一现

全站内容

Calf

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

  • 825. Friends Of Appropriate Ages

    Coding

    #Problem There are n persons on a social media website. You are given an integer array ages where ages[i] is the age of the iᵗʰ person. A Person x will not send a friend request to a person y (x != y) if any of the following conditions is …

    medium
  • 827. Making A Large Island

    Coding

    #Problem You are given an n x n binary matrix grid. You are allowed to change at most one 0 to be 1. Return the size of the largest island in grid after applying this operation. An island is a 4-directionally connected group of 1s. …

    hard
  • 843. Guess the Word

    Coding

    #Problem You are given an array of unique strings words where words[i] is six letters long. One word of words was chosen as a secret word. You are also given the helper object Master. You may call Master.guess(word) where word is a …

    hard
  • 848. Shifting Letters

    Coding

    #Problem You are given a string s of lowercase English letters and an integer array shifts of the same length. Call the shift() of a letter, the next letter in the alphabet, (wrapping around so that 'z' becomes 'a'). For example, shift('a') …

    medium
  • 855. Exam Room

    Coding

    #Problem There is an exam room with n seats in a single row labeled from 0 to n - 1. When a student enters the room, they must sit in the seat that maximizes the distance to the closest person. If there are multiple such seats, they sit in …

    medium
  • 873. Length of Longest Fibonacci Subsequence

    Coding

    #Problem A sequence x₁, x₂, ..., xₙ is Fibonacci-like if: n >= 3 xᵢ + xᵢ₊₁ == xᵢ₊₂ for all i + 2 <= n Given a strictly increasing array arr of positive integers forming a sequence, return the length of the longest Fibonacci-like subsequence …

    medium
  • 889. Construct Binary Tree from Preorder and Postorder Traversal

    Coding

    #Problem Given two integer arrays, preorder and postorder where preorder is the preorder traversal of a binary tree of distinct values and postorder is the postorder traversal of the same tree, reconstruct and return the binary tree. If …

    medium
  • 89. Gray Code

    Coding

    #Problem An n-bit gray code sequence is a sequence of 2ⁿ integers where: Every integer is in the inclusive range [0, 2ⁿ - 1], The first integer is 0, An integer appears no more than once in the sequence, The binary representation of every …

    medium
  • 90. Subsets II

    Coding

    #Problem Given an integer array nums that may contain duplicates, return all possible subsets (the power set). A subset of an array is a selection of elements (possibly none) of the array. The solution set must not contain duplicate …

    easy
  • 905. Sort Array By Parity

    Coding

    #Problem Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array that satisfies this condition. https://leetcode.cn/problems/sort-array-by-parity/ Example 1: …

    easy