leetcode
文章平均质量分 71
Chromer163
机器学习 计算机视觉 信号处理
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leetcode刷题(python)--1. twoSum
两数之和(twoSum)给定一个整数数组和一个目标值,找出数组中和为目标值的两个数。你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用。例子:Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1].class Solution: def twoSu...原创 2018-04-23 09:44:13 · 172 阅读 · 0 评论 -
leetcode刷题(python)--384. Shuffle an Array
Shuffle a set of numbers without duplicates.Example:// Init an array with set 1, 2, and 3.int[] nums = {1,2,3};Solution solution = new Solution(nums);// Shuffle the array [1,2,3] and return its re...原创 2018-05-07 22:52:39 · 463 阅读 · 0 评论 -
leetcode刷题(python)--81. Search in Rotated Sorted Array II (思路以及两种解法-迭代和递归)
Search in Rotated Sorted Array II Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]).You are given a ta...原创 2018-05-20 20:07:05 · 266 阅读 · 0 评论 -
leetcode刷题(python)--33. Search in Rotated Sorted Array(思路以及两种解法-迭代和递归)
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If found in t...原创 2018-05-20 10:49:26 · 1216 阅读 · 0 评论 -
leetcode刷题(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), where i and j are both numbers in...原创 2018-05-04 09:58:29 · 302 阅读 · 0 评论 -
leetcode刷题(python)--448. Find All Numbers Disappeared in an Array
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.Could yo...原创 2018-05-03 09:03:39 · 226 阅读 · 0 评论 -
leetcode刷题(python)--*697. Degree of an Array(to review)
Given 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 possible length of a (c...原创 2018-05-02 15:17:03 · 193 阅读 · 0 评论 -
leetcode刷题(python)--561. Array Partition I
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as poss...原创 2018-05-01 15:57:57 · 201 阅读 · 0 评论 -
leetcode刷题(python)--26. Remove Duplicates from Sorted Array
Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by modifying...原创 2018-05-01 15:41:48 · 136 阅读 · 0 评论 -
leetcode刷题(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] <= array[i + 1] holds for eve...原创 2018-05-01 09:55:01 · 346 阅读 · 0 评论 -
leetcode刷题(python)--349. Intersection of Two Arrays
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.The result can be in any ...原创 2018-04-30 19:16:30 · 162 阅读 · 0 评论 -
leetcode刷题(python)--338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5 you sho...原创 2018-06-05 10:21:38 · 418 阅读 · 0 评论
分享