自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

miranda

夏天的飞鸟,来到我的窗前,歌唱,又飞走了。

  • 博客(65)
  • 资源 (1)
  • 收藏
  • 关注

原创 009 Palindrome Number [Leetcode]

题目内容: Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could negative integers be palindromes? (ie, -1) If you are thin

2015-11-11 16:41:28 429

原创 008 String to Integer (atoi) [Leetcode]

题目内容: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible

2015-11-11 16:35:42 364

原创 007 Reverse Integer [Leetcode]

题目内容: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers. Have you thought about this? Here are some good questions to ask

2015-11-11 16:31:47 369

原创 006 ZigZag Conversion [Leetcode]

题目内容: The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N

2015-11-11 16:27:23 359

原创 005 Longest Palindromic Substring [Leetcode]

题目内容: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 解题思路: 比较直观的方法,就是以

2015-11-11 15:19:20 307

原创 004 Median of Two Sorted Arrays [Leetcode]

题目内容: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). 解题思路:

2015-11-11 13:42:10 427 1

原创 003 Longest Substring Without Repeating Characters [Leetcode]

题目内容: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is

2015-11-09 14:45:38 303

原创 002 Add Two Numbers [Leetcode]

题目内容: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as

2015-11-09 14:39:10 332

原创 001 Two Sum [Leetcode]

题目内容: Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the ta

2015-11-09 14:32:30 321

原创 154 Find Minimum in Rotated Sorted Array II [Leetcode]

题目内容: Follow up for “Find Minimum in Rotated Sorted Array”: What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose a sorted array is rotated at s

2015-10-28 15:24:56 364

原创 153 Find Minimum in Rotated Sorted Array [Leetcode]

题目内容: Suppose a sorted array 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). Find the minimum element. You may assume no duplicate

2015-10-28 14:44:07 265

原创 206 Reverse Linked List [Leetcode]

题目内容: Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both? 解题思路之前提到过,直接贴代码: 迭代解法:/** * Definition for singly-linked

2015-10-28 00:40:18 282

原创 148 Sort List [Leetcode]

题目内容: Sort a linked list in O(n log n) time using constant space complexity. 根据给出的时间复杂度,可以想到满足的排序方法有: 1. 快速排序 2. 堆排序 3. 归并排序再考虑空间复杂度: 1. 快速排序主要要实现partition算法,在数组中它实现的算法复杂度为O(n),利用链表,同样可以在O(n)时间内实

2015-10-28 00:10:37 347

原创 143 Reorder List [Leetcode]

题目内容: Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes’ values. For example, Given {1,2,3,4},

2015-10-27 23:49:41 354

原创 138 Copy List with Random Pointer [Leetcode]

题目内容: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. 解题思路: 最优方法时间复杂度为O(n)且不需

2015-10-27 21:42:02 483

原创 109 Convert Sorted List to Binary Search Tree [Leetcode]

题目内容: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 思路: 只要知道了链表的中间节点,就可以把问题分解为子问题,中间节点是当前的根节点,左边的排序链表构成左子树,右边的构成右子树。 用了两种方法 1. 一种是将节

2015-10-27 21:31:05 393

原创 082&083 Remove Duplicates from Sorted List I II [Leetcode]

题目内容: Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 思路: 很清楚,顺序遍历

2015-10-27 20:53:16 254

原创 061 Rotate List [Leetcode]

题目内容: Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL. 思路: 使用双指针。注意处理k比链表长度还要

2015-10-27 20:48:43 289

原创 025 Reverse Nodes in k-Group [Leetcode]

题目内容: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain

2015-10-27 20:29:18 324

原创 024 Swap Nodes in Pairs [Leetcode]

题目内容: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only cons

2015-10-27 19:11:49 309

原创 023 Merge k Sorted Lists [Leetcode]

题目内容: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题目分析: k个排过序的链表,要将它们合并起来就要求能够在较短的时间内将当前的k个数进行排序,并且能够高效得支持数字的增删操作。 可以使用的方法有:败者树,堆排序,这两个算法在插入、删

2015-10-27 19:07:34 367

原创 021 Merge Two Sorted Lists [Leetcode]

题目内容: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 解题思路: 很基础的问题,注意处理长度不等的问题,同样使用附加头结点化简处理。非递归实现代码如下,运

2015-10-27 16:53:47 212

原创 019 Remove Nth Node From End of List [Leetcode]

题目内容: Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from t

2015-10-27 16:03:53 247

原创 002 Add Two Numbers [Leetcode]

题目内容: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as

2015-10-27 14:48:09 317

原创 142 Linked List Cycle II [Leetcode]

题目内容: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up: Can you solve it without using extra

2015-10-07 10:21:48 372

原创 216 Combination Sum III [Leetcode]

题目内容: Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. Ensure that n

2015-10-06 17:39:07 331

原创 212 Word Search II [Leetcode]

题目内容: Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where “adjacent” cells are

2015-10-06 17:03:44 566

原创 134 Gas Station [Leetcode]

题目内容: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from statio

2015-10-06 14:50:22 338

原创 140 Word Break II [Leetcode]

题目内容: Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. For example

2015-10-06 11:43:25 347

原创 139 Word Break [Leetcode]

题目内容: Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = “leetcode”, d

2015-10-04 15:38:45 234

原创 132 Palindrome Partitioning II [Leetcode]

题目内容: Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. For example, given s = “aa

2015-10-03 23:56:30 284

原创 133 Clone Graph [Leetcode]

题目内容: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ’s undirected graph serialization: Nodes are labeled uniquely. We use # as a sepa

2015-10-03 23:08:26 235

原创 131 Palindrome Partitioning [Leetcode]

题目内容: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = “aab”, Return [

2015-10-02 23:02:41 272

原创 130 Surrounded Regions [Leetcode]

题目内容: Given a 2D board containing ‘X’ and ‘O’, capture all regions surrounded by ‘X’. A region is captured by flipping all ‘O’s into ‘X’s in that surrounded region. For example,X X X X X O O X X

2015-10-02 20:45:11 328

原创 124 Binary Tree Maximum Path Sum [Leetcode]

题目内容: Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connecti

2015-09-27 09:31:43 229

原创 127 Word Ladder [Leetcode]

题目内容: Given two words (beginWord and endWord), and a dictionary’s word list, find the length of shortest transformation sequence from beginWord to endWord, such that: Only one letter can be c

2015-09-27 09:10:23 278

原创 188 Best Time to Buy and Sell Stock IV [Leetcode]

题目内容: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most k transactions. Note: You m

2015-09-25 14:13:10 321

原创 123 Best Time to Buy and Sell Stock III [Leetcode]

题目内容: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. Note

2015-09-21 07:32:04 361

原创 122 Best Time to Buy and Sell Stock II [Leetcode]

题目内容: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i

2015-09-21 07:20:57 206

原创 121 Best Time to Buy and Sell Stock [Leetcode]

题目内容: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th

2015-09-21 07:16:00 237

OpenGL编程指南第七版(英文)

OpenGL编程指南第七版(英文) 素有OpenGL红宝书之称的学习OpenGL不可或缺的经典之作

2014-09-10

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除