博客专栏  >  编程语言   >  Leetcode面试题解

Leetcode面试题解

希望开一个解答leetcode.com上面试题的专栏,与众多的刷题爱好者交流和分享解题过程,探讨做题的方法和思路,望通过。

关注
0 已关注
31篇博文
  • 【Leetcode】Copy List with Random Pointer

    A linked list is given such that each node contains an additional random pointer which could point t...

    2014-04-14 15:38
    1287
  • 【Leetcode】Flatten Binary Tree to Linked List

    Given a binary tree, flatten it to a linked list in-place. For example, Given 1 ...

    2013-11-26 19:28
    499
  • 【Leetcode】Pow(x, n)

    Implement pow(x, n). 题目的要求是计算x的n次方,主要需要注意的地方有以下几点: 1.n应该分正数,0,负数三部分讨论,主要任何数的0次方为1,包括0的0次方。 2.本题采用...

    2013-11-26 20:33
    610
  • 【Leetcode】Add Binary

    Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1...

    2013-11-26 21:05
    424
  • 【Leetcode】Reverse Linked List II

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

    2013-11-26 21:31
    568
  • 【Leetcode】Edit Distance

    Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2...

    2013-11-28 19:01
    583
  • 【Leetcode】Construct Binary Tree from Preorder and Inorder Traversal

    Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume tha...

    2013-11-28 19:16
    581
  • 【Leetcode】Remove Duplicates from Sorted List II

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

    2013-11-28 19:50
    529
  • 【Leetcode】Letter Combinations of a Phone Number

    Given a digit string, return all possible letter combinations that the number could represent. A ...

    2013-11-28 20:25
    523
  • 【Leetcode】Palindrome Partitioning

    Given a string s, partition s such that every substring of the partition is a palindrome. Return al...

    2013-11-28 22:07
    428
  • 【Leetcode】Gas Station

    There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. ...

    2013-11-29 13:44
    736
  • 【Leetcode】Longest Substring Without Repeating Characters

    Given a string, find the length of the longest substring without repeating characters. For example, ...

    2013-11-29 18:36
    550
  • 【Leetcode】Distinct Subsequences

    Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence...

    2013-12-04 01:28
    425
  • 【Leetcode】Combination Sum II

    Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in...

    2013-12-05 12:01
    522
  • 【Leetcode】Reverse Nodes in k-Group

    题意:给你一个链表和正整数k,让链表每隔k个结点进行反转,最后若剩下不足k个结点,则不反转。 个人感觉这题难度是有一定的,想了很久,也没有能得到一个比较清晰的解法。于是网上搜索了下,得到了以下这一种...

    2013-12-05 14:47
    807
  • 【Leetcode】Jump Game II

    题意:给你一个数组,由数组起点0开始,每次可走的长度为0至所在位置的元素大小,问最少需要多少步可以走到终点? 一开始想到了递归的方法,但是很显然,这会超时,下面是超时的方法。 class Soluti...

    2013-12-05 16:41
    540
  • 【Leetcode】Add Two Numbers

    You are given two linked lists representing two non-negative numbers. The digits are stored in rever...

    2013-12-05 17:22
    543
  • 【Leetcode】Anagrams

    Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will ...

    2013-12-05 19:37
    446
  • 【Leetcode】Merge k Sorted Lists

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

    2013-12-05 21:25
    590
  • 【Leetcode】Two Sum

    Given an array of integers, find two numbers such that they add up to a specific target number. T...

    2013-12-05 21:58
    649
img博客搬家
img撰写博客
img发布 Chat
img专家申请
img意见反馈
img返回顶部