关闭
当前搜索:

657. Judge Route Circle -- Python

657. Judge Route Circle Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move s...
阅读(3) 评论(0)

119. Pascal's Triangle II -- Python

119. Pascal’s Triangle II Given an index k, return the kth row of the Pascal’s triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to use only O(k) extr...
阅读(12) 评论(0)

118. Pascal's Triangle -- Python

118. Pascal’s Triangle 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] ] 思路:...
阅读(10) 评论(0)

532. K-diff Pairs in an Array -- Python

532. K-diff Pairs in an Array Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), wh...
阅读(11) 评论(0)

665. Non-decreasing Array -- Python

665. Non-decreasing Array Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if array[i] E...
阅读(10) 评论(0)

189. Rotate Array -- Python

189. Rotate Array 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]. Note: Try to come up as many so...
阅读(12) 评论(0)

414. Third Maximum Number -- Python

414. Third Maximum Number 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 complexity must be in O(n). Ex...
阅读(11) 评论(0)

88. Merge Sorted Array -- Python

88. Merge Sorted Array Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough space (size that is greater or equal t...
阅读(15) 评论(0)

219. Contains Duplicate II -- Python

219. Contains Duplicate II 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 the absolute difference be...
阅读(15) 评论(0)

26. Remove Duplicates from Sorted Array -- Python

26. Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for anothe...
阅读(19) 评论(0)

643. Maximum Average Subarray I -- Python

643. Maximum Average Subarray I Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average...
阅读(16) 评论(0)

53. Maximum Subarray -- Python

53. Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous su...
阅读(18) 评论(0)

35. Search Insert Position -- Python

35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume n...
阅读(24) 评论(0)

27. Remove Element -- Python

27. Remove ElementGiven an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the inpu...
阅读(27) 评论(0)

724. Find Pivot Index -- Python

724. Find Pivot IndexGiven an array of integers nums, write a method that returns the “pivot” index of this array.We define the pivot index as the index where the sum of the numbers to the left of the...
阅读(29) 评论(0)

674. Longest Continuous Increasing Subsequence -- Python

674. Longest Continuous Increasing SubsequenceGiven an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).Example 1:Input: [1,3,5,4,7] Output: 3 Explana...
阅读(32) 评论(0)

268. Missing Number -- Python

268. Missing NumberGiven an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.Example 1Input: [3,0,1] Output: 2Example 2Input: [9,6,4,2,3,5,7,0,1...
阅读(31) 评论(0)

628. Maximum Product of Three Numbers-- Python

628. Maximum Product of Three Numbers Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Input:...
阅读(87) 评论(0)

217. Contains Duplicate--Python

217. Contains Duplicate 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 array, and it should ret...
阅读(37) 评论(0)

697. Degree of an Array--Python

697. Degree of an ArrayGiven a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest p...
阅读(55) 评论(0)
70条 共4页1 2 3 4 下一页 尾页
    个人资料
    • 访问:11713次
    • 积分:831
    • 等级:
    • 排名:千里之外
    • 原创:69篇
    • 转载:1篇
    • 译文:0篇
    • 评论:27条
    最新评论