GoCalf Calf 的自留地 · 昙花一现

全站内容

medium

  • 1072. Flip Columns For Maximum Number of Equal Rows

    Coding

    #Problem You are given an m x n binary matrix matrix. You can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the cell from 0 to 1 or vice versa). Return the maximum number of rows …

    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
  • 221. Maximal Square

    Coding

    #Problem Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. https://leetcode.com/problems/maximal-square/ Example 1: case1Input: matrix = …

    medium
  • 164. Maximum Gap

    Coding

    #Problem Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains less than two elements, return 0. You must write an algorithm that runs in linear time and uses …

    medium
  • 983. Minimum Cost For Tickets

    Coding

    #Problem You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array days. Each day is an integer from 1 to 365. Train tickets are sold in three different ways: a …

    medium
  • 2466. Count Ways To Build Good Strings

    Coding

    #Problem Given the integers zero, one, low, and high, we can construct a string by starting with an empty string, and then at each step perform either of the following: Append the character '0' zero times. Append the character '1' one …

    medium
  • 1367. Linked List in Binary Tree

    Coding

    #Problem Given a binary tree root and a linked list with head as the first node. Return True if all the elements in the linked list starting from the head correspond to some downward path connected in the binary tree otherwise return False. …

    medium
  • 1366. Rank Teams by Votes

    Coding

    #Problem In a special ranking system, each voter gives a rank from highest to lowest to all teams participating in the competition. The ordering of teams is decided by who received the most position-one votes. If two or more teams tie in …

    medium
  • 785. Is Graph Bipartite?

    Coding

    #Problem There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More formally, for each v in graph[u], …

    medium
  • 1014. Best Sightseeing Pair

    Coding

    #Problem You are given an integer array values where values[i] represents the value of the iᵗʰ sightseeing spot. Two sightseeing spots i and j have a distance j - i between them. The score of a pair (i < j) of sightseeing spots is values[i] …

    medium