leetcode

所属分类:Leetcode/题库
开发工具:GO
文件大小:3KB
下载次数:0
上传日期:2019-07-11 18:28:11
上 传 者sh-1993
说明:  leetcode,围棋编程中的leetcode问题解决方案
(leetcode,Leetcode problem solution in Go programming)

文件列表:
LICENSE (1071, 2019-07-12)
addtwonumber.go (593, 2019-07-12)
twosum.go (629, 2019-07-12)
twosum1.go (288, 2019-07-12)
twosum1_test.go (441, 2019-07-12)
twosum_test.go (631, 2019-07-12)

# leetcode Leetcode problem solution in Go programming ##### 1. Two sum problem The two sum problem is a common interview question, and it is a variation of the subset sum problem. There is a popular dynamic programming solution for the subset sum problem, but for the two sum problem we can actually write an algorithm that runs in O(n) time. The challenge is to find all the pairs of two integers in an unsorted array that sum up to a given S. For example, if the array is [3, 5, 2, -4, 8, 11] and the sum is 7, your program should return [[11, -4], [2, 5]] because 11 + -4 = 7 and 2 + 5 = 7. ##### 2. Add Two Numbers You may assume the two numbers do not contain any leading zero, except the number 0 itself. Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 0 -> 8

近期下载者

相关文件


收藏者