05 2017 档案
摘要:描述 Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order
阅读全文
摘要:描述 Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. 分析 先构造了一个杨辉三角,然后返回这个杨辉三角的最后一组值,没超时就万事大吉了
阅读全文
摘要:描述 Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1
阅读全文
摘要:描述 Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The funct
阅读全文
摘要:描述 Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that
阅读全文
摘要:描述 Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
阅读全文
摘要:描述 Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and t
阅读全文
摘要:描述 Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the
阅读全文
摘要:描述 Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0,
阅读全文
摘要:描述 Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non zero elements. For example,
阅读全文
摘要:描述 Given a non empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time compl
阅读全文
摘要:描述 Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two
阅读全文

浙公网安备 33010602011771号