随笔分类 - leetcode
摘要:leetcode-1175-easy Return the number of permutations of 1 to n so that prime numbers are at prime indices (1-indexed.) (Recall that an integer is prim
阅读全文
摘要:Unique Email Addresses Every valid email consists of a local name and a domain name, separated by the '@' sign. Besides lowercase letters, the email m
阅读全文
摘要:Rotate String Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s. A shift on s consists of mo
阅读全文
摘要:Replace Elements with Greatest Element on Right Side Given an array arr, replace every element in that array with the greatest element among the eleme
阅读全文
摘要:Balanced Binary Tree Given a binary tree, determine if it is height-balanced. Example 1: Input: root = [3,9,20,null,null,15,7] Output: true Example 2:
阅读全文
摘要:Count Binary Substrings Given a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's a
阅读全文
摘要:License Key Formatting You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is s
阅读全文
摘要:Relative Ranks You are given an integer array score of size n, where score[i] is the score of the ith athlete in a competition. All the scores are gua
阅读全文
摘要:Lucky Numbers in a Matrix Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element
阅读全文
摘要:Perfect Number A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an
阅读全文
摘要:Minimum Subsequence in No-Increasing Order Given the array nums, obtain a subsequence of the array whose sum of elements is strictly greater than the
阅读全文
摘要:Fair Candy Swap Alice and Bob have a different total number of candies. You are given two integer arrays aliceSizes and bobSizes where aliceSizes[i] i
阅读全文
摘要:XOR Operation in an Array You are given an integer n and an integer start. Define an array nums where nums[i] = start + 2 * i (0-indexed) and n == num
阅读全文
摘要:Number of Valid Words in a Sentence A sentence consists of lowercase letters ('a' to 'z'), digits ('0' to '9'), hyphens ('-'), punctuation marks ('!',
阅读全文
摘要:Find Target Indices After Sorting Array You are given a 0-indexed integer array nums and a target element target. A target index is an index i such th
阅读全文
摘要:Thousand Separator Given an integer n, add a dot (".") as the thousands separator and return it in string format. Example 1: Input: n = 987 Output: "9
阅读全文
摘要:Increasing Decreasing String You are given a string s. Reorder the string using the following algorithm: Pick the smallest character from s and append
阅读全文
摘要:Binary Number with Alternating Bits Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have dif
阅读全文
摘要:Most Common Word Given a string paragraph and a string array of the banned words banned, return the most frequent word that is not banned. It is guara
阅读全文
摘要:Count Equal and Divisible Pairs in an Array Given a 0-indexed integer array nums of length n and an integer k, return the number of pairs (i, j) where
阅读全文

浙公网安备 33010602011771号