伪程序员的世界

Debug myself and debug the world!


  • 首页

  • 归档

  • 分类

  • 标签

  • 搜索

LeetCode 219.Contains Duplicate II

发表于 2017-12-12 | 分类于 算法 , LeetCode
字数统计: 2k | 阅读时长≈ 0:02

LeetCode 219.Contains Duplicate II

Description:

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 between i and j is at most k.

阅读全文 »

LeetCode 136.Single Number

发表于 2017-12-11 | 分类于 算法 , LeetCode
字数统计: 1.6k | 阅读时长≈ 0:02

LeetCode 136.Single Number

Description:

Given an array of integers, every element appears twice except for one. Find that single one.

阅读全文 »

LeetCode 268.Missing Number

发表于 2017-12-11 | 分类于 算法 , LeetCode
字数统计: 1.1k | 阅读时长≈ 0:01

LeetCode 268.Missing Number

Description:

Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.

阅读全文 »

LeetCode 27.Remove Element

发表于 2017-12-11 | 分类于 算法 , LeetCode
字数统计: 1.2k | 阅读时长≈ 0:01

LeetCode 27.Remove Element

Description:

Given 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 input array in-place with O(1) extra memory.

The order of elements can be changed. It doesn’t matter what you leave beyond the new length.

阅读全文 »

LeetCode 283.Move Zeroes

发表于 2017-12-11 | 分类于 算法 , LeetCode
字数统计: 1.5k | 阅读时长≈ 0:01

LeetCode 283.Move Zeroes

Description:

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 nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0].

Note:

  • You must do this in-place without making a copy of the array.
  • Minimize the total number of operations.
阅读全文 »

LeetCode 442.Find All Duplicates in an Array

发表于 2017-12-10 | 分类于 算法 , LeetCode
字数统计: 1.3k | 阅读时长≈ 0:01

LeetCode 442.Find All Duplicates in an Array

Description:

Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
Find all the elements that appear twice in this array.
Could you do it without extra space and in O(n) runtime?

阅读全文 »

LeetCode 448.Find All Numbers Disappeared in an Array

发表于 2017-12-10 | 分类于 算法 , LeetCode
字数统计: 1.4k | 阅读时长≈ 0:01

LeetCode 448.Find All Numbers Disappeared in an Array

Description:

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 you do it without extra space and in O(n) runtime? You may assume the returned list does not count as extra space.

阅读全文 »

LeetCode 561.Array Partition I

发表于 2017-12-10 | 分类于 算法 , LeetCode
字数统计: 1.1k | 阅读时长≈ 0:01

LeetCode 561.Array Partition I

Description:

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 possible.

阅读全文 »

LeetCode 566.Reshape the Matrix

发表于 2017-12-10 | 分类于 算法 , LeetCode
字数统计: 2.4k | 阅读时长≈ 0:02

LeetCode 566.Reshape the Matrix

Description:

In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data.
You’re given a matrix represented by a two-dimensional array, and two positive integers r and c representing the row number and column number of the wanted reshaped matrix, respectively.
The reshaped matrix need to be filled with all the elements of the original matrix in the same row-traversing order as they were.

阅读全文 »

LeetCode 628. Maximum Product of Three Numbers

发表于 2017-12-10 | 分类于 算法 , LeetCode
字数统计: 659 | 阅读时长≈ 0:01

LeetCode 628. Maximum Product of Three Numbers

Description:

Given an integer array, find three numbers whose product is maximum and output the maximum product.

阅读全文 »
1…891011
linjiafengyang

linjiafengyang

Debug myself and debug the world!

106 日志
7 分类
3 标签
GitHub CSDN
© 2019 linjiafengyang | 394k | 6:34