manjeettahkur / leetcode

Leetcode problem solution in Go programming

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Leetcode problem solution in Go programming

License:MIT License


Languages

Language:Go 100.0%