码迷,mamicode.com
首页 >  
搜索关键字:two points    ( 13225个结果
Divide Two Integers
Divide two integers without using multiplication, division and mod operator.思路:不能使用乘法除法以及取模运算来计算两个数相除。主要做法就是,将因子不断乘2(向左移位即可实现),同时结果从1不断移位加倍,等到除数大于被除数一...
分类:其他好文   时间:2014-07-06 15:34:24    阅读次数:197
leetcode--Scramble String
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:其他好文   时间:2014-07-06 13:57:54    阅读次数:155
leetcode--N-Queens
Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc...
分类:其他好文   时间:2014-07-06 13:32:49    阅读次数:204
华为上机练习题--将英文号码翻译成数字号码
题目:  * 将 电话号码 one two 。。。nine zero 翻译成1  2 。。9 0  *  * 中间会有double  *  * 例如  *     输入:OneTwoThree  *     输出:123  *     输入:OneTwoDoubleTwo  *     输出:1222  *     输入:1Two2  *     输出:ERRO...
分类:其他好文   时间:2014-07-06 09:24:44    阅读次数:229
素数判定 费马测试
;; Fermat's Little Theorem: ;; If N is a prime number and A is any positive integer less ;; than N, then A raised to the N-th power is congruent to A modulo N ;; Two numbers are said to be congruent...
分类:其他好文   时间:2014-07-06 09:05:22    阅读次数:158
poj 2406 Power Strings(KMP&思维)
Power Strings Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 31093   Accepted: 12974 Description Given two strings a and b we define a*b to be their concate...
分类:其他好文   时间:2014-07-06 00:33:22    阅读次数:253
【leetcode】Max Points on a Line (python)
给定一个点,除该点之外的其他所有点中,与该点的关系要么是共线,要么就是共点,也就是两点重合。 共线有三种情况:水平共线,垂直共线,倾斜的共线。合并下这三种情况就是斜率存在的共线和斜率不存在的共线。 那么我们的任务就是针对每个点,找出与其共线的这些情况中,共线最多的点的个数。 注意:最终的结果别忘了加上共点的个数。 class Solution: def maxPoints(self, p...
分类:编程语言   时间:2014-07-05 23:52:29    阅读次数:402
LeetCode——Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively.  Find the median of the two sorted arrays.  The overall run time complexity should be O(log (m+n)). 有两个已排序的数组A和B,大小为m 和 n。 找出两数组的中...
分类:其他好文   时间:2014-07-05 22:54:17    阅读次数:244
LeetCode:Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ...n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4...
分类:其他好文   时间:2014-07-05 22:10:53    阅读次数:226
CTCI 1.3
Description: Given two strings, write a method to decide if one is a permutation of the other.We could use the same idea from CTCI 1.1. The only diffe...
分类:其他好文   时间:2014-07-05 21:43:01    阅读次数:231
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!