码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
leetCode 29.Divide Two Integers (两整数相除) 解题思路和方法
Divide Two Integers  Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 思路:这个题算法上不是很难,但是通过率相当低,只有15%,果然,自己在写完之后,各种出错,而且错误不是算法上...
分类:其他好文   时间:2015-07-08 09:38:07    阅读次数:115
Remove Duplicates from Sorted List
题目描述 链接地址 解法题目描述Given a sorted linked list, delete all duplicates such that each element appear only once.Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3.链接地址http://www.lintcode.com/en...
分类:其他好文   时间:2015-07-08 09:36:06    阅读次数:109
014 Longest Common Prefix
想法很直接 复杂度O(mn)class Solution: # @param {string[]} strs # @return {string} def longestCommonPrefix(self, strs): n = len(strs) if...
分类:其他好文   时间:2015-07-08 08:14:36    阅读次数:139
015 3 SUM
这道题县排序 然后设定好第一位,后面两位夹逼搜索就好, 但是因为数字会出现重复,导致得出的3元祖也有可能重复,一开始我的办法是采用set来避免多次加入同样的三元组,运行时间为 344msclass Solution: # @param {integer[]} nums # @return...
分类:其他好文   时间:2015-07-08 07:11:23    阅读次数:116
074 Search a 2D Matrix
一开始的想法是先确定行,在确定是否在这一行中 方法如下class Solution: # @param {integer[][]} matrix # @param {integer} target # @return {boolean} def searchMatrix(se...
分类:其他好文   时间:2015-07-08 07:10:16    阅读次数:119
016 3SUM Closest
这道题与 015 3 SUM 基本思路一样 都是夹逼思想 复杂度 O(n*n)class Solution: # @param {integer[]} nums # @param {integer} target # @return {integer} def threeSu...
分类:其他好文   时间:2015-07-08 07:09:51    阅读次数:101
[LeetCode] Number of Digit One 数字1的个数
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example: Given n = 13,Return...
分类:其他好文   时间:2015-07-08 07:06:15    阅读次数:122
驼峰风格、下划线风格互转
1 /** 2 * 将驼峰式命名的字符串转换为下划线大写方式。如果转换前的驼峰式命名的字符串为空,则返回空字符串。 3 * 例如:HelloWorld->HELLO_WORLD 4 * @param name 转换前的驼峰式命名的字符串 5 * @return 转换后下划线大写方式命名的字...
分类:其他好文   时间:2015-07-08 02:03:33    阅读次数:191
自定义UIBtton类后,在@implementation重写方法的作用
1 /** 2 * 用来自定义imageView的尺寸和位置 (contentRect等于按钮的bounds) 3 */ 4 - (CGRect)imageRectForContentRect:(CGRect)contentRect { 5 return CGRectMake((co...
分类:其他好文   时间:2015-07-08 00:22:21    阅读次数:146
leetCode 26.Remove Duplicates from Sorted Array(删除数组重复点) 解题思路和方法
Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another ...
分类:编程语言   时间:2015-07-07 22:53:56    阅读次数:203
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!