自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Leetcode #14. Longest Common Prefix

原题: Write a function to find the longest common prefix string amongst an array of strings. 思路: 普通的字符串处理题,可以直接通过逐位的循环来检测;可以通过先找出最短字符串的预处理来优化匹配过程。 代码: class Solution { public: string longes

2017-09-08 20:27:05 148

原创 Leetcode #12. Integer to Roman & #13. Roman to Integer

#12. Integer to Roman 原题: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. #13. Roman to Integer 题型:数组。 解法: 找到罗马数字的规律即可:4的表示法和9的表示法是需要

2017-09-08 20:22:53 154

原创 Leetcode #11. Container With Most Water

原题: 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).

2017-09-08 20:19:23 176

原创 Leetcode #3. Longest Substring Without Repeating Characters

题意:对于给定的字符串,返回其最大不重复字串的长度。如对于abcabcbb返回3。 题型:辅助变量;哈希表。 解法:定义一个包含所有ascii字符数量的数组m [128],初始化为0; 定义三个变量count、pre和max,初始化为0;其中count代表包括当前元素的最小不重字串;pre指当前元素上一次出现的位置;max代表当前元素为止出现的最大不重字串的大小。 遍历字符串,只要没有出

2017-09-08 20:17:53 163

空空如也

空空如也

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

TA关注的人

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