摘要: Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array. Exampl 阅读全文
posted @ 2016-12-13 13:59 lettuan 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of two. Hint: 最容易想到的方法是用n反复的去除以2,一直到n变成1。这期间如果出现不能被2整除的数,那么一开始的n就不是2的power. 但是为了满足O(1 阅读全文
posted @ 2016-12-13 13:18 lettuan 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 实现Pow(x, n), 使用二分n的办法进行递归。 阅读全文
posted @ 2016-12-13 13:00 lettuan 阅读(94) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2016-12-13 03:48 lettuan 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2016-12-13 03:42 lettuan 阅读(199) 评论(0) 推荐(0) 编辑
摘要: key: build and search Hash table. following up questions: Overflow value for target? 用Hash table记录之间的状态,思想类似DP def twoSum(nums, target): d = {} n = len(nums) res = [] for i in range... 阅读全文
posted @ 2016-12-13 03:38 lettuan 阅读(93) 评论(0) 推荐(0) 编辑
摘要: Q: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sing 阅读全文
posted @ 2016-12-13 03:35 lettuan 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Example: Example: 阅读全文
posted @ 2016-12-13 03:33 lettuan 阅读(116) 评论(0) 推荐(0) 编辑