自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 LeetCode习题笔记——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->

2018-01-07 13:07:16 244

原创 LeetCode习题笔记——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.题目要求移除一个已经排列好的链表的重复成员,方

2018-01-07 12:54:36 186

原创 LeetCode习题笔记——Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is def

2018-01-06 18:01:22 186

原创 LeetCode习题笔记——Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1] 

2018-01-05 19:03:49 190

原创 LeetCode习题笔记——Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "

2018-01-02 18:13:31 158

原创 LeetCode习题笔记——Combination Sum II

Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combinati

2018-01-02 18:10:42 179

原创 LeetCode习题笔记——Rotate Image

You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the input 2D matr

2018-01-02 18:06:16 263

原创 LeetCode习题笔记——Combination Sum

Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen fr

2018-01-01 18:08:26 192

原创 LeetCode习题笔记——Remove Nth Node From End of List

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 the end, the

2017-12-28 19:30:08 155

原创 LeetCode习题笔记——Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.其实这个题目说的不是很清楚,有一个条件就是每个字符串都是包含这个前缀的,即不需要去考虑有可能会有两个完全不同的字符串,这也让这个题目简单许多:class Solution {public: string lon

2017-12-28 19:26:32 174

原创 LeetCode习题笔记——水箱问题

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin

2017-12-28 19:03:06 344

原创 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 thinking o

2017-12-28 18:53:11 199

原创 LeetCode习题笔记——罗马数字和整数之间的转换

今天看的是罗马数字和阿拉伯数字之间的转换,主要是字符串和数字之间的处理,话不多说,先来看整数到罗马数字:题目描述:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.因为罗马数字有一个规定,即同一个字母不会出现超

2017-11-25 19:06:55 294

原创 LeetCode习题笔记——Longest Palindromic Substring

这次的问题是判断一个字符串里最长的“回文串”,即一个串从左边到右边和右边到左边是一样(如"aba")。下面是问题的具体描述:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Inp

2017-10-28 21:35:17 217

原创 LeetCode习题笔记——Add Two Numbers

这次问题看起来是两个数之和,其实主要考察两数相加中进位和对链表的一些基本操作,原题如下:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai

2017-10-14 20:04:55 174

原创 LeetCode习题笔记——Two Sum

Two Sum是LeetCode中最简单的例题之一,我们今天就从这个系列的题目开始练手,练习coding的算法以及算法的解析。我们先从第一个题目开始看起:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You ma

2017-09-26 16:33:46 281

空空如也

空空如也

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

TA关注的人

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