博客 / 列表

primeshao - 1239. Maximum Length of a Concatenated String with Unique Characters

題目 Given an array of stringsarr. Stringsis a concatenation of a sub-sequence ofarrwhich haveunique characters. Returnthe maximum possible lengthofs. Example 1: Input: arr = [

yyds乾貨盤點 , 字符串 , 字符串數組 , bc , 代碼人生

primeshao - 1160. Find Words That Can Be Formed by Characters

題目 You are given an array of stringswordsand a stringchars. A string isgoodifit can be formed bycharacters fromchars(each charactercan only be used once). Return the sum of lengths o

yyds乾貨盤點 , 字符串 , i++ , 字符串數組 , 代碼人生

primeshao - 1093. Statistics from a Large Sample

題目 We sampled integers between0and255, and stored the results in an arraycount:count[k]is the number of integers we sampled equal tok. Return the minimum, maximum, mean, median, and mod

yyds乾貨盤點 , 最小值 , 中位數 , 眾數 , 代碼人生

primeshao - 1040. Moving Stones Until Consecutive II

題目 On aninfinitenumber line, the position of the i-th stone is given bystones[i]. Call a stone anendpoint stoneif it has the smallest or largest position. Each turn, you pick up an endp

初始狀態 , 數組 , yyds乾貨盤點 , 滑動窗口 , 代碼人生

primeshao - 1030. Matrix Cells in Distance Order

題目 We are given a matrix withRrows andCcolumns has cells with integer coordinates(r, c), where0 = r Rand0 = c C. Additionally, we are given a cell in that matrix with coordinates(r0,

yyds乾貨盤點 , 曼哈頓距離 , i++ , c++ , 代碼人生

primeshao - 1020. Number of Enclaves

題目 Given a 2D arrayA, each cell is 0 (representing sea) or 1 (representing land) A move consists of walking from one land square 4-directionally to another land square, or off the bound

sed , yyds乾貨盤點 , i++ , 並查集 , 代碼人生

primeshao - 1017. Convert to Base -2

題目 Given a numberN, return a string consisting of"0"s and"1"sthat represents its value in base-2 The returned string must have no leading zeroes, unless the string is"0". Example 1:

yyds乾貨盤點 , 字符串 , 代碼人生 , 進制 , 十進制

primeshao - 1006. Clumsy Factorial

題目 Normally, the factorial of a positive integernis the product of all positive integers less than or equal ton. For example,factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1. We i

sed , yyds乾貨盤點 , 操作符 , 代碼人生 , ide

primeshao - 991. Broken Calculator

題目 On a broken calculator that has a number showing on its display, we can perform two operations: Double: Multiply the number on the display by 2, or; Decrement: Subtract 1 fr

yyds乾貨盤點 , 數據 , 操作數 , 數學方法 , 代碼人生

primeshao - 989. Add to Array-Form of Integer

題目 For a non-negative integerX, thearray-form ofXis an array of its digits in left to right order. For example, ifX = 1231, then the array form is[1,2,3,1]. Given the array-formAof a no

數組 , yyds乾貨盤點 , i++ , 逆序 , 代碼人生

primeshao - 976. Largest Perimeter Triangle

題目 Given an array A of positive lengths, return the largest perimeter of a triangle with non-zero area, formed from 3 of these lengths. If it is impossible to form any triangle of non-zero area, retur

yyds乾貨盤點 , i++ , 代碼人生