随笔分类 - leetcode
摘要:Binary Watch A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED re
阅读全文
摘要:Rank Transform of an Array Given an array of integers arr, replace each element with its rank. The rank represents how large the element is. The rank
阅读全文
摘要:Check if Word Equals Summation of Two Words The letter value of a letter is its position in the alphabet starting from 0 (i.e. 'a' -> 0, 'b' -> 1, 'c'
阅读全文
摘要:Reshape the Matrix In MATLAB, there is a handy function called reshape which can reshape an m x n matrix into a new one with a different size r x c ke
阅读全文
摘要:Remove Letter To Equalize Frequency You are given a 0-indexed string word, consisting of lowercase English letters. You need to select one index and r
阅读全文
摘要:Minimum Cost of Buying Candies With Discount A shop is selling candies at a discount. For every two candies sold, the shop gives a third candy for fre
阅读全文
摘要:N-th Tribonacci Number The Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. Given n, retu
阅读全文
摘要:Binary Tree Paths Given the root of a binary tree, return all root-to-leaf paths in any order. A leaf is a node with no children. Example 1: Input: ro
阅读全文
摘要:Find N Unique Integers Sum up to Zero Given an integer n, return any array containing n unique integers such that they add up to 0. Example 1: Input:
阅读全文
摘要:Pascal's Triangle Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two num
阅读全文
摘要:Make Two Arrays Equal by Reversing Subarrays You are given two integer arrays of equal length target and arr. In one step, you can select any non-empt
阅读全文
摘要:Sort Integers by The Number Of 1 Bits You are given an integer array arr. Sort the integers in the array in ascending order by the number of 1's in th
阅读全文
摘要:Keyboard Row Given an array of strings words, return the words that can be typed using letters of the alphabet on only one row of American keyboard li
阅读全文
摘要:First Bad Version You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product f
阅读全文
摘要:Missing Number Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the arr
阅读全文
摘要:Number Of 1 Bits Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Note: N
阅读全文
摘要:Two Sum Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that
阅读全文
摘要:Calculate Money in Leetcode Bank Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1
阅读全文
摘要:Add to Array-Form of Integer The array-form of an integer num is an array representing its digits in left to right order. For example, for num = 1321,
阅读全文
摘要:Check if One String Swap Can Make Strings Equal You are given two strings s1 and s2 of equal length. A string swap is an operation where you choose tw
阅读全文

浙公网安备 33010602011771号