array
MVincent
这个作者很懒,什么都没留下…
展开
-
leetcode 283 Move Zeroes
python:class Solution: def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ i = 0 ...原创 2018-06-29 11:06:58 · 153 阅读 · 0 评论 -
leetcode 88 Merge Sorted Array
python:class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :...原创 2018-09-07 19:02:18 · 165 阅读 · 0 评论 -
leetcode 74 Search a 2D Matrix
python:class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if len(matrix) =...原创 2018-07-12 15:27:43 · 211 阅读 · 0 评论 -
leetcode 66 Plus One
python:class Solution: def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ res = [] t = 1 for i in digits[::-1]: ...原创 2018-07-05 11:04:19 · 197 阅读 · 0 评论 -
leetcode 35 Search Insert Position
python:class Solution: def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ t = 0 for index, i ...原创 2018-07-04 16:35:42 · 174 阅读 · 0 评论 -
leetcode 485 Max Consecutive Ones
python:class Solution: def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ res = 0 l = 0 for i in nums: ...原创 2018-07-02 17:17:57 · 215 阅读 · 0 评论 -
leetcode 189 Rotate Array
c++:class Solution {public: void rotate(vector<int>& nums, int k) { k = k % nums.size(); reverse(nums.begin(), nums.end()); reverse(nums.begin(), nums.begin() + ...原创 2018-06-20 17:20:16 · 136 阅读 · 0 评论 -
leetcode 189 Rotate Array
c++:class Solution {public: void rotate(vector<int>& nums, int k) { k = k % nums.size(); reverse(nums.begin(), nums.end()); reverse(nums.begin(), nums.begin() + ...原创 2018-06-20 17:19:50 · 114 阅读 · 0 评论 -
leetcode 16 3Sum Closest
C++:class Solution {public: int threeSumClosest(vector<int>& nums, int target) { sort(nums.begin(), nums.end()); int l, r; int res = INT_MAX; int ans = 0...原创 2018-06-20 15:49:58 · 266 阅读 · 0 评论 -
leetcode 118 Pascal's Triangle
python:class Solution: def generate(self, numRows): """ :type numRows: int :rtype: List[List[int]] """ res = [] arr = [1]*numRows ...原创 2018-09-10 16:52:25 · 172 阅读 · 0 评论