Implement int sqrt(int x). Compute and return the square root of x. 二分可解 这里是关于二分的一些总结: 首先,如果题目属于"二分值越大越符合条件",即要求符合条件的最小值,那就是while(r>l){mid=(l+r)/2。。。} ...
分类:
其他好文 时间:
2017-07-20 17:29:46
阅读次数:
109
Wildcard Matching Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of char ...
分类:
其他好文 时间:
2017-07-20 12:49:04
阅读次数:
119
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 字符串Rabin--Karp算法。滚动哈希,时间 ...
分类:
其他好文 时间:
2017-07-19 20:36:49
阅读次数:
215
Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure.find ...
分类:
其他好文 时间:
2017-07-18 09:57:42
阅读次数:
219
1 接口 interface implement 接口的所有方法自动地属于public。因此,在接口中声明方法时,不必提供关键字public。 接口可以包含多个方法,接口中可以定义常量。接口中的域将被自动设为public static final。 SwingConstants就是只定义了常量,而没 ...
分类:
编程语言 时间:
2017-07-18 01:39:16
阅读次数:
135
Implement int sqrt(int x). Compute and return the square root of x. ...
分类:
其他好文 时间:
2017-07-16 23:33:53
阅读次数:
208
【 声明:版权全部,转载请标明出处,请勿用于商业用途。 联系信箱:libin493073668@sina.com】 题目链接:https://leetcode.com/problems/implement-strstr/ 题意: 给定两个串,判定needle串是否haystack串的子串,假设是,返 ...
分类:
其他好文 时间:
2017-07-16 19:20:01
阅读次数:
161
一:Implement Trie (Prefix Tree) 题目: Implement a trie with insert, search, and startsWith methods. Note: You may assume that all inputs are consist of l ...
分类:
其他好文 时间:
2017-07-16 18:23:28
阅读次数:
169
from sys import exitfrom random import randintclass Scene(object): def enter(self): print "This scene is not yet configured.Subclass it and implement ... ...
分类:
编程语言 时间:
2017-07-16 00:47:25
阅读次数:
304
抽象类: 1.用abstract表示 2.里面有一个或多个抽象方法,在方法前加abstract,抽象类中也可以没有抽象方法 3.抽象类用extends继承,并且必须重写抽象方法 接口 1.用implement表示 2.接口是极度抽象的类,所有方法都是抽象的,都需要进行重写 接口的作用:解决java中 ...
分类:
编程语言 时间:
2017-07-15 17:59:10
阅读次数:
161