博客专栏  >  编程语言   >  LeetCode题解

LeetCode题解

每周坚持刷LeetCode题,无论AC与否坚持记录解题思路,锻炼自己express thoughts precisely.

关注
0 已关注
73篇博文
  • [LeetCode]Isomorphic Strings

    Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the ...

    2015-05-03 21:07
    490
  • [LeetCode]Count Primes

    Count the number of prime numbers less than a non-negative number, n 一个合数总是可以分解成若干质数的乘积。所以,如果把质数的倍数全...

    2015-05-04 18:58
    468
  • [LeetCode]Pow(x, n)

    Implement pow(x, n). 这道题要求完成pow(),即求出x的n次方的结果。二分法,注意n<0的情况。 1. 若n = 0,二分递归求解。例如,求2^5,可以先算2^2=4,2^2...

    2015-04-26 09:44
    455
  • [LeetCode]Sort Colors

    Given an array with n objects colored red, white or blue, sort them so that objects of the same colo...

    2015-04-26 09:58
    472
  • [LeetCode]Single Number

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

    2015-04-26 09:04
    463
  • [LeetCode]Multiply Strings

    Given two numbers represented as strings, return multiplication of the numbers as a string. Not...

    2015-04-24 22:01
    413
  • [LeetCode]Remove Linked List Elements

    Remove all elements from a linked list of integers that have value val. Example Given: 1 –> ...

    2015-04-24 22:13
    449
  • [LeetCode]Happy Number

    Write an algorithm to determine if a number is “happy”. A happy number is a number defined by t...

    2015-04-24 22:44
    497
  • [LeetCode]Convert Sorted Array to Binary Search Tree

    Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 这道...

    2015-04-14 20:55
    423
  • [LeetCode]Symmetric Tree

    Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). ...

    2015-04-09 20:47
    394
  • [LeetCode]Binary Tree Right Side View

    Given a binary tree, imagine yourself standing on the right side of it, return the values of the nod...

    2015-04-09 19:52
    381
  • [LeetCode]Find Minimum in Rotated Sorted Array II

    Follow up for “Find Minimum in Rotated Sorted Array”: What if duplicates are allowed? Would ...

    2015-04-09 19:34
    380
  • [LeetCode]Merge k Sorted Lists

    Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 这...

    2015-03-22 21:45
    297
  • [LeetCode]Maximum Subarray

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

    2015-03-22 20:24
    312
  • [LeetCode]Linked List Cycle

    Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without ...

    2015-03-22 18:55
    442
  • [LeetCode]Convert Sorted List to Binary Search Tree

    Given a singly linked list where elements are sorted in ascending order, convert it to a height bala...

    2015-03-22 18:47
    541
  • [LeetCode]Reverse Linked List II

    Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: ...

    2015-03-22 18:38
    415
  • [LeetCode]Partition List

    Given a linked list and a value x, partition it such that all nodes less than x come before nodes gr...

    2015-03-22 18:30
    456
  • [LeetCode]Remove Duplicates from Sorted List II

    Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numb...

    2015-03-22 18:06
    497
  • [LeetCode]Insertion Sort

    Sort a linked list using insertion sort. 这道题是要求用插入排序的方式对单链表进行排序。先不考虑边界情况: 1. 将第一个结点看做有序区,之后的所有结点看做无...

    2015-03-20 22:04
    429

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