
面向对象基础
文章平均质量分 86
Matcha_ee
这个作者很懒,什么都没留下…
展开
-
LeetCode - 383. Ransom Note
题目:Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magaz原创 2017-02-16 22:24:38 · 351 阅读 · 0 评论 -
LeetCode - 13. Roman to Integer
题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.思路与步骤:分两步进行,先对应,再计算。基本思路是: 首先将 roman 基本字符与阿拉伯数字对应起来,存在一个结构中,然后对输入的字符串逐个字原创 2017-02-19 15:24:04 · 414 阅读 · 0 评论 -
LeetCode - 67. Add Binary
题目:Given two binary strings, return their sum (also a binary string).思路与步骤:原思路:将两个string逐个字符相加,设置一个flag ,进位的话记 flag=1,反之 flag=0需要处理的一些细节:1. a 和 b 的 0, 1 是字符形式,要写成 '0', '1';flag 是 int 型原创 2017-02-20 13:23:21 · 248 阅读 · 0 评论 -
LeetCode - 125. Valid Palindrome
题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.思路与步骤:首先理解题目要求:通过测试样例得知,输入的字符串只比较大小写字母和0-9,其中同一个字母的大小写认为一样,其他字忽略。于是有两种思路思路1:原创 2017-02-20 22:13:56 · 383 阅读 · 0 评论 -
Leetcode - 8.String to Integer (atoi)
题目:Implement atoi to convert a string to an integer. 思路与步骤:1. 判断字符串是否为控字符串;2. 去掉开头的空格;3. 判断开始位是否有正负;4. 转换,同时注意overflow的问题。 核心步骤: String逐个字符从左往右遍历,若为数字,则 result = String当前位的int值;原创 2017-01-26 15:24:26 · 250 阅读 · 0 评论