自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(31)
  • 资源 (1)
  • 收藏
  • 关注

原创 LeetCode-E-Valid Palindrome

题意Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a pal

2017-05-14 18:55:22 201

原创 LeetCode-E- Palindrome Number

题意Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Subscribe to see which companies asked this question.解法实现class Solution {public: bool isPalindrom

2017-05-14 18:53:21 224

原创 LeetCode-E-Palindrome Linked List

题意Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?Subscribe to see which companies asked this question.Show Tags Show Similar Proble

2017-05-14 18:51:00 168

原创 LeetCode-M-Unique Binary Search Trees II

题意Given an integer n, generate all structurally unique BST’s (binary search trees) that store values 1…n.For example, Given n = 3, your program should return all 5 unique BST’s shown below. 1

2017-04-23 12:27:58 221

原创 LeetCode-M-Unique Binary Search Trees

题意Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example, Given n = 3, there are a total of 5 unique BST’s. 1 3 3 2 1 \ /

2017-04-23 12:19:32 173

原创 LeetCode-E-Isomorphic Strings

题意Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another cha

2017-04-23 00:40:56 250

原创 LeetCode-M-Binary Tree Zigzag Level Order Traversal

题意Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).For example: Given binary tre

2017-04-23 00:13:31 188

原创 LeetCode-E-Two Sum II - Input array is sorted

题意Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers s

2017-04-22 23:32:14 515

原创 LeetCode-E-Two Sum

题意Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same e

2017-04-22 23:22:08 229

原创 LeetCode-M-Binary Tree Level Order Traversal

题意Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example: Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 /

2017-04-22 22:42:47 237

原创 LeetCode-M-Jump Game

题意Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you a

2017-04-17 01:03:51 165

原创 LeetCode-M-Copy List with Random Pointe

题意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.Subscribe to see which companies aske

2017-04-17 00:42:51 215

原创 LeetCode-E-Remove Linked List Elements

题意Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5Credits: Special thanks to @mithmatt for

2017-04-17 00:19:08 232

原创 LeetCode-M-Reorder List

题意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}, reorder it to {1,4,2,

2017-04-17 00:11:23 309

原创 LeetCode-M-Remove Duplicates from Sorted List II

题意Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example, Given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1-

2017-04-15 17:57:57 363

原创 LeetCode-E-Remove Duplicates from Sorted List

题意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.Subscribe to see which compani

2017-04-15 17:12:52 248

原创 LeetCode - E- Min Stack

题意Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get th

2017-04-14 19:26:51 230

原创 LeetCode - M - Evaluate Reverse Polish Notation

题意Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", "*

2017-04-09 21:15:13 198

原创 LeetCode - H - Reverse Nodes in k-Group

题意Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the number of n

2017-04-09 20:37:53 286

原创 LeetCode - M - Swap Nodes in Pairs

题意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 constant space. You may

2017-04-09 20:00:32 153

原创 LeetCode - M - 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->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note: Given m, n satisfy the following

2017-04-09 19:47:45 189

原创 LeetCode - E - Reverse Linked List

题意Reverse a singly linked list.click to show more hints.Subscribe to see which companies asked this question.解法将当前元素插入到头节点之前实现/** * Definition for singly-linked list. * struct ListNode { * int v

2017-04-09 19:16:50 165

原创 LeetCode - E - Reverse Integer

题意Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321click to show spoilers.Note: The input is assumed to be a 32-bit signed integer. Your function should retur

2017-04-09 19:00:34 169

原创 LeetCode-M-Single Element in a Sorted Array

题意Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element that appears only once.Example 1:Input: [1,1,2,

2017-04-09 14:50:47 225

原创 LeetCode-M-Sort Colors

题意Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0,

2017-04-09 13:42:58 254

原创 LeetCode-M-Insertion Sort List

题意Sort a linked list using insertion sort.解法链表插入算法实现,记录已排好序段的表头和表尾,记录小于当前值的最大节点,注意三种情况:链表头插入链表尾插入链表中插入实现/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNod

2017-04-07 20:05:54 218

原创 LeetCode-E-Fizz Buzz

题目Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For

2017-04-06 20:47:03 355

原创 LeetCode-E-Single Number

题目Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra

2017-04-06 20:43:34 301

原创 LeetCode-E-Delete Node in a Linked List

题目Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3,

2017-04-06 20:41:09 190

原创 LeetCode-E-Same Tree

题目Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.解法递归实现:均为null,返回

2017-04-06 20:37:09 282

原创 LeetCode - M- Rotate List

LeetCode - Rotate List - 翻转链表

2017-04-05 23:48:53 224

空空如也

空空如也

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

TA关注的人

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