博客专栏  >  综合   >  Leetcode

Leetcode

这是在LeetCode 中的一些题目的解答,带有自己的思路,方便于自己的回头再看

关注
25 已关注
24篇博文
  • 字符串转换成整数

    题目描述: 输入一个由数字组成的字符串,请把它转换成整数并输出。例如输入“123”则输出123。不能使用库函数atoi。 这道题随看着很简单,这里最简单的一个实现的方法为下面所示,这里...

    2017-09-19 10:24
    489
  • 两个栈实现队列

    问题:已知下面Stack类以及其三个方法push、pop和count,请用两个stack实现queue类的入队和出队的方法 这道题在面试中出现主要考察三点:1、在短时间内,能不能找到这道题足够清晰的思...

    2017-09-26 08:23
    297
  • 1. Two Sum

    Given an array of integers, return indices of the two numbers such that they add up to a specific ta...

    2017-12-15 17:05
    204
  • 697. Degree of an Array

    Given a non-empty array of non-negative integers nums, the degree of this array is defined as the ma...

    2017-12-16 15:37
    252
  • 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 t...

    2017-12-18 14:21
    239
  • 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 [...

    2017-12-19 16:02
    201
  • 665. Non-decreasing Array

    题目描述:给定一个有n个整数的数组,检查它是否可以通过修改最多一个元素使它变得非递减数组Given an array with n integers, your task is to check if...

    2017-12-20 10:27
    227
  • 581. Shortest Unsorted Continuous Subarray

    Given an integer array, you need to find one continuous subarray that if you only sort this subarray...

    2018-01-10 18:07
    209
  • 53. Maximum Subarray

    Find the contiguous subarray within an array (containing at least one number) which has the largest ...

    2018-01-12 20:47
    68
  • 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,...

    2018-01-14 21:10
    61
  • 35. Search Insert Position

    Given a sorted array and a target value, return the index if the target is found. If not, return th...

    2018-01-15 15:20
    62
  • 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...

    2018-01-15 16:51
    75
  • 287. Find the Duplicate Number

    Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), ...

    2018-01-15 20:44
    72
  • 238. Product of Array Except Self

    Given an array of n integers where n > 1, nums, return an array output such that output[i]...

    2018-03-05 19:57
    30
  • 565. Array Nesting

    A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longe...

    2018-03-05 20:46
    29
  • 769. Max Chunks To Make Sorted

    Given an array arr that is a permutation of [0, 1, …, arr.length - 1], we split the array into so...

    2018-03-06 19:51
    29
  • 714. Best Time to Buy and Sell Stock with Transaction Fee

    Your are given an array of integers prices, for which the i-th element is the price of a given st...

    2018-03-06 20:53
    24
  • 561. Array PartitionI

    Given an array of 2n integers, your task is to group these integers into n pairs of integer, say...

    2018-03-06 22:33
    22
  • 442.Find All Duplicatesinan Array

    Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and othe...

    2018-03-06 22:39
    22
  • 169.Majority Element

    Given an array of size n, find the majority element. The majority element is the element that appear...

    2018-03-06 22:41
    16

img博客搬家
img撰写博客
img发布 Chat
img专家申请
img意见反馈
img返回顶部