Explorar o código

comment out some main function

dengxinyi %!s(int64=6) %!d(string=hai) anos
pai
achega
b5894b3fa6
Modificáronse 26 ficheiros con 289 adicións e 361 borrados
  1. 30 34
      easy/101.go
  2. 20 24
      easy/104.go
  3. 22 26
      easy/107.go
  4. 9 9
      easy/108.go
  5. 27 31
      easy/110.go
  6. 20 24
      easy/111.go
  7. 20 24
      easy/112.go
  8. 3 7
      easy/118.go
  9. 3 7
      easy/119.go
  10. 8 12
      easy/121.go
  11. 15 19
      easy/122.go
  12. 27 28
      easy/125.go
  13. 3 7
      easy/136.go
  14. 1 1
      easy/14.go
  15. 6 10
      easy/155.go
  16. 18 22
      easy/167.go
  17. 6 10
      easy/168.go
  18. 4 8
      easy/169.go
  19. 3 7
      easy/171.go
  20. 7 8
      easy/172.go
  21. 5 9
      easy/189.go
  22. 10 14
      easy/198.go
  23. 6 6
      easy/67.go
  24. 3 4
      easy/7.go
  25. 8 10
      hard/10.go
  26. 5 0
      hard/4.go

+ 30 - 34
easy/101.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 // TreeNode ...
 type TreeNode struct {
 	Val   int
@@ -36,33 +32,33 @@ func isSymmetric(root *TreeNode) bool {
 	return isSymmetricIter(root.Left, root.Right)
 }
 
-func main() {
-	/**
-	 * t1:  5
-	 *     / \
-	 *    1   4
-	 *       / \
-	 *      2   3
-	 */
-	t1l := TreeNode{1, nil, nil}
-	t1rl := TreeNode{2, nil, nil}
-	t1rr := TreeNode{3, nil, nil}
-	t1r := TreeNode{4, &t1rl, &t1rr}
-	t1 := &TreeNode{5, &t1l, &t1r}
-	/**
-	 * t2:   1
-	 *     /   \
-	 *    2     2
-	 *   / \   / \
-	 *  4   3 3   4
-	 */
-	t2ll := TreeNode{4, nil, nil}
-	t2lr := TreeNode{3, nil, nil}
-	t2l := TreeNode{2, &t2ll, &t2lr}
-	t2rl := TreeNode{3, nil, nil}
-	t2rr := TreeNode{4, nil, nil}
-	t2r := TreeNode{2, &t2rl, &t2rr}
-	t2 := &TreeNode{1, &t2l, &t2r}
-	fmt.Println(isSymmetric(t1))
-	fmt.Println(isSymmetric(t2))
-}
+// func main() {
+// 	/**
+// 	 * t1:  5
+// 	 *     / \
+// 	 *    1   4
+// 	 *       / \
+// 	 *      2   3
+// 	 */
+// 	t1l := TreeNode{1, nil, nil}
+// 	t1rl := TreeNode{2, nil, nil}
+// 	t1rr := TreeNode{3, nil, nil}
+// 	t1r := TreeNode{4, &t1rl, &t1rr}
+// 	t1 := &TreeNode{5, &t1l, &t1r}
+// 	/**
+// 	 * t2:   1
+// 	 *     /   \
+// 	 *    2     2
+// 	 *   / \   / \
+// 	 *  4   3 3   4
+// 	 */
+// 	t2ll := TreeNode{4, nil, nil}
+// 	t2lr := TreeNode{3, nil, nil}
+// 	t2l := TreeNode{2, &t2ll, &t2lr}
+// 	t2rl := TreeNode{3, nil, nil}
+// 	t2rr := TreeNode{4, nil, nil}
+// 	t2r := TreeNode{2, &t2rl, &t2rr}
+// 	t2 := &TreeNode{1, &t2l, &t2r}
+// 	fmt.Println(isSymmetric(t1))
+// 	fmt.Println(isSymmetric(t2))
+// }

+ 20 - 24
easy/104.go

@@ -1,15 +1,11 @@
 package main
 
-import (
-	"fmt"
-)
-
 // TreeNode ...
-type TreeNode struct {
-	Val   int
-	Left  *TreeNode
-	Right *TreeNode
-}
+// type TreeNode struct {
+// 	Val   int
+// 	Left  *TreeNode
+// 	Right *TreeNode
+// }
 
 func maxInt(x, y int) int {
 	if x > y {
@@ -37,18 +33,18 @@ func maxDepth(root *TreeNode) int {
 	return maxDepthIter(root, 0)
 }
 
-func main() {
-	/**
-	 * t1:  5
-	 *     / \
-	 *    1   4
-	 *       / \
-	 *      2   3
-	 */
-	t1l := TreeNode{1, nil, nil}
-	t1rl := TreeNode{2, nil, nil}
-	t1rr := TreeNode{3, nil, nil}
-	t1r := TreeNode{4, &t1rl, &t1rr}
-	t1 := &TreeNode{5, &t1l, &t1r}
-	fmt.Println(maxDepth(t1))
-}
+// func main() {
+// 	/**
+// 	 * t1:  5
+// 	 *     / \
+// 	 *    1   4
+// 	 *       / \
+// 	 *      2   3
+// 	 */
+// 	t1l := TreeNode{1, nil, nil}
+// 	t1rl := TreeNode{2, nil, nil}
+// 	t1rr := TreeNode{3, nil, nil}
+// 	t1r := TreeNode{4, &t1rl, &t1rr}
+// 	t1 := &TreeNode{5, &t1l, &t1r}
+// 	fmt.Println(maxDepth(t1))
+// }

+ 22 - 26
easy/107.go

@@ -1,15 +1,11 @@
 package main
 
-import (
-	"fmt"
-)
-
 // TreeNode ...
-type TreeNode struct {
-	Val   int
-	Left  *TreeNode
-	Right *TreeNode
-}
+// type TreeNode struct {
+// 	Val   int
+// 	Left  *TreeNode
+// 	Right *TreeNode
+// }
 
 func reverseArr(arr *[][]int) {
 	for i, j := 0, len(*arr)-1; i < j; i, j = i+1, j-1 {
@@ -49,20 +45,20 @@ func levelOrderBottom(root *TreeNode) [][]int {
 	return arr
 }
 
-func main() {
-	/**
-	 * t1:  5
-	 *     / \
-	 *    1   4
-	 *       / \
-	 *      2   3
-	 */
-	t1l := TreeNode{1, nil, nil}
-	t1rl := TreeNode{2, nil, nil}
-	t1rr := TreeNode{3, nil, nil}
-	t1r := TreeNode{4, &t1rl, &t1rr}
-	t1 := &TreeNode{5, &t1l, &t1r}
-	t2 := &TreeNode{9, nil, nil}
-	fmt.Println(levelOrderBottom(t1))
-	fmt.Println(levelOrderBottom(t2))
-}
+// func main() {
+// 	/**
+// 	 * t1:  5
+// 	 *     / \
+// 	 *    1   4
+// 	 *       / \
+// 	 *      2   3
+// 	 */
+// 	t1l := TreeNode{1, nil, nil}
+// 	t1rl := TreeNode{2, nil, nil}
+// 	t1rr := TreeNode{3, nil, nil}
+// 	t1r := TreeNode{4, &t1rl, &t1rr}
+// 	t1 := &TreeNode{5, &t1l, &t1r}
+// 	t2 := &TreeNode{9, nil, nil}
+// 	fmt.Println(levelOrderBottom(t1))
+// 	fmt.Println(levelOrderBottom(t2))
+// }

+ 9 - 9
easy/108.go

@@ -18,11 +18,11 @@ func printTree(root *TreeNode) {
 	}
 }
 
-type TreeNode struct {
-	Val   int
-	Left  *TreeNode
-	Right *TreeNode
-}
+// type TreeNode struct {
+// 	Val   int
+// 	Left  *TreeNode
+// 	Right *TreeNode
+// }
 
 /**
  * Definition for a binary tree node.
@@ -47,7 +47,7 @@ func sortedArrayToBST(nums []int) *TreeNode {
 	return &root
 }
 
-func main() {
-	t1 := sortedArrayToBST([]int{-10, -3, 0, 5, 9})
-	printTree(t1)
-}
+// func main() {
+// 	t1 := sortedArrayToBST([]int{-10, -3, 0, 5, 9})
+// 	printTree(t1)
+// }

+ 27 - 31
easy/110.go

@@ -1,21 +1,17 @@
 package main
 
-import (
-	"fmt"
-)
+// type TreeNode struct {
+// 	Val   int
+// 	Left  *TreeNode
+// 	Right *TreeNode
+// }
 
-type TreeNode struct {
-	Val   int
-	Left  *TreeNode
-	Right *TreeNode
-}
-
-func maxInt(x, y int) int {
-	if x > y {
-		return x
-	}
-	return y
-}
+// func maxInt(x, y int) int {
+// 	if x > y {
+// 		return x
+// 	}
+// 	return y
+// }
 
 func abs(x int) int {
 	if x < 0 {
@@ -49,19 +45,19 @@ func isBalanced(root *TreeNode) bool {
 	return isBalanced(root.Left) && isBalanced(root.Right)
 }
 
-func main() {
-	/**
-	 * t1:  5
-	 *     / \
-	 *    1   4
-	 *       / \
-	 *      2   3
-	 */
-	t1l := TreeNode{1, nil, nil}
-	t1rl := TreeNode{2, nil, nil}
-	t1rr := TreeNode{3, nil, nil}
-	t1r := TreeNode{4, &t1rl, &t1rr}
-	t1 := &TreeNode{5, &t1l, &t1r}
-	fmt.Println(isBalanced(t1))
-	fmt.Println(isBalanced(nil))
-}
+// func main() {
+// 	/**
+// 	 * t1:  5
+// 	 *     / \
+// 	 *    1   4
+// 	 *       / \
+// 	 *      2   3
+// 	 */
+// 	t1l := TreeNode{1, nil, nil}
+// 	t1rl := TreeNode{2, nil, nil}
+// 	t1rr := TreeNode{3, nil, nil}
+// 	t1r := TreeNode{4, &t1rl, &t1rr}
+// 	t1 := &TreeNode{5, &t1l, &t1r}
+// 	fmt.Println(isBalanced(t1))
+// 	fmt.Println(isBalanced(nil))
+// }

+ 20 - 24
easy/111.go

@@ -1,14 +1,10 @@
 package main
 
-import (
-	"fmt"
-)
-
-type TreeNode struct {
-	Val   int
-	Left  *TreeNode
-	Right *TreeNode
-}
+// type TreeNode struct {
+// 	Val   int
+// 	Left  *TreeNode
+// 	Right *TreeNode
+// }
 
 func minInt(x, y int) int {
 	if x < y {
@@ -45,18 +41,18 @@ func minDepth(root *TreeNode) int {
 	return minDepthIter(root, 1)
 }
 
-func main() {
-	/**
-	 * t1:  5
-	 *       \
-	 *        4
-	 *       / \
-	 *      2   3
-	 */
-	t1rl := TreeNode{2, nil, nil}
-	t1rr := TreeNode{3, nil, nil}
-	t1r := TreeNode{4, &t1rl, &t1rr}
-	t1 := &TreeNode{5, nil, &t1r}
-	fmt.Println(minDepth(t1))
-	fmt.Println(minDepth(nil))
-}
+// func main() {
+// 	/**
+// 	 * t1:  5
+// 	 *       \
+// 	 *        4
+// 	 *       / \
+// 	 *      2   3
+// 	 */
+// 	t1rl := TreeNode{2, nil, nil}
+// 	t1rr := TreeNode{3, nil, nil}
+// 	t1r := TreeNode{4, &t1rl, &t1rr}
+// 	t1 := &TreeNode{5, nil, &t1r}
+// 	fmt.Println(minDepth(t1))
+// 	fmt.Println(minDepth(nil))
+// }

+ 20 - 24
easy/112.go

@@ -1,14 +1,10 @@
 package main
 
-import (
-	"fmt"
-)
-
-type TreeNode struct {
-	Val   int
-	Left  *TreeNode
-	Right *TreeNode
-}
+// type TreeNode struct {
+// 	Val   int
+// 	Left  *TreeNode
+// 	Right *TreeNode
+// }
 
 // important!! "leaf node"
 func hasPathSumIter(root *TreeNode, sum int, tmpSum int) bool {
@@ -39,18 +35,18 @@ func hasPathSum(root *TreeNode, sum int) bool {
 	return hasPathSumIter(root, sum, 0)
 }
 
-func main() {
-	/**
-	 * t1:  5
-	 *     / \
-	 *    1   4
-	 *       / \
-	 *      2   3
-	 */
-	t1r := TreeNode{4, nil, nil}
-	t1 := &TreeNode{5, nil, &t1r}
-	fmt.Println(hasPathSum(t1, 11))
-	fmt.Println(hasPathSum(t1, 5))
-	fmt.Println(hasPathSum(t1, 7))
-	fmt.Println(hasPathSum(nil, 0))
-}
+// func main() {
+// 	/**
+// 	 * t1:  5
+// 	 *     / \
+// 	 *    1   4
+// 	 *       / \
+// 	 *      2   3
+// 	 */
+// 	t1r := TreeNode{4, nil, nil}
+// 	t1 := &TreeNode{5, nil, &t1r}
+// 	fmt.Println(hasPathSum(t1, 11))
+// 	fmt.Println(hasPathSum(t1, 5))
+// 	fmt.Println(hasPathSum(t1, 7))
+// 	fmt.Println(hasPathSum(nil, 0))
+// }

+ 3 - 7
easy/118.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 func generate(numRows int) [][]int {
 	res := make([][]int, 0)
 	for i := 0; i < numRows; i++ {
@@ -19,6 +15,6 @@ func generate(numRows int) [][]int {
 	return res
 }
 
-func main() {
-	fmt.Println(generate(30))
-}
+// func main() {
+// 	fmt.Println(generate(30))
+// }

+ 3 - 7
easy/119.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 // O(k) space usage
 func getRow(rowIndex int) []int {
 	res := [2][]int{make([]int, rowIndex+1), make([]int, rowIndex+1)}
@@ -19,6 +15,6 @@ func getRow(rowIndex int) []int {
 	return res[rowIndex&1]
 }
 
-func main() {
-	fmt.Println(getRow(3))
-}
+// func main() {
+// 	fmt.Println(getRow(3))
+// }

+ 8 - 12
easy/121.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 func maxProfit(prices []int) int {
 	cost, profit := 1<<31-1, 0
 	for _, v := range prices {
@@ -17,11 +13,11 @@ func maxProfit(prices []int) int {
 	return profit
 }
 
-func main() {
-	a1 := []int{1, 2, 3, 4, 5}
-	a2 := []int{5, 4, 3, 2, 1}
-	a3 := []int{8, 1}
-	fmt.Println(maxProfit(a1))
-	fmt.Println(maxProfit(a2))
-	fmt.Println(maxProfit(a3))
-}
+// func main() {
+// 	a1 := []int{1, 2, 3, 4, 5}
+// 	a2 := []int{5, 4, 3, 2, 1}
+// 	a3 := []int{8, 1}
+// 	fmt.Println(maxProfit(a1))
+// 	fmt.Println(maxProfit(a2))
+// 	fmt.Println(maxProfit(a3))
+// }

+ 15 - 19
easy/122.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 func maxProfitOld(prices []int) int {
 	last, cost, profit := -1<<31, 1<<31-1, 0
 	for _, v := range prices {
@@ -30,19 +26,19 @@ func maxProfitOld(prices []int) int {
 }
 
 // split into small pieces!
-func maxProfit(prices []int) int {
-	profit := 0
-	for i := 1; i < len(prices); i++ {
-		if prices[i] > prices[i-1] {
-			profit += prices[i] - prices[i-1]
-		}
-	}
-	return profit
-}
+// func maxProfit(prices []int) int {
+// 	profit := 0
+// 	for i := 1; i < len(prices); i++ {
+// 		if prices[i] > prices[i-1] {
+// 			profit += prices[i] - prices[i-1]
+// 		}
+// 	}
+// 	return profit
+// }
 
-func main() {
-	a1 := []int{1, 2, 3, 46, 1, 4, 1, 4, 5}
-	a2 := []int{2, 1}
-	fmt.Println(maxProfit(a1))
-	fmt.Println(maxProfit(a2))
-}
+// func main() {
+// 	a1 := []int{1, 2, 3, 46, 1, 4, 1, 4, 5}
+// 	a2 := []int{2, 1}
+// 	fmt.Println(maxProfit(a1))
+// 	fmt.Println(maxProfit(a2))
+// }

+ 27 - 28
easy/125.go

@@ -1,7 +1,6 @@
 package main
 
 import (
-	"fmt"
 	"strings"
 )
 
@@ -38,31 +37,31 @@ func isEqual(a, b byte) bool {
 	return a == b
 }
 
-func isPalindrome(s string) bool {
-	if len(s) == 0 || len(s) == 1 {
-		return true
-	}
-	for beg, end := 0, len(s)-1; beg < end; {
-		if !isAlphanum(s[beg]) {
-			beg++
-			continue
-		}
-		if !isAlphanum(s[end]) {
-			end--
-			continue
-		}
-		if isEqual(s[beg], s[end]) {
-			beg++
-			end--
-		} else {
-			return false
-		}
-	}
-	return true
-}
+// func isPalindrome(s string) bool {
+// 	if len(s) == 0 || len(s) == 1 {
+// 		return true
+// 	}
+// 	for beg, end := 0, len(s)-1; beg < end; {
+// 		if !isAlphanum(s[beg]) {
+// 			beg++
+// 			continue
+// 		}
+// 		if !isAlphanum(s[end]) {
+// 			end--
+// 			continue
+// 		}
+// 		if isEqual(s[beg], s[end]) {
+// 			beg++
+// 			end--
+// 		} else {
+// 			return false
+// 		}
+// 	}
+// 	return true
+// }
 
-func main() {
-	fmt.Println(isPalindrome(""))
-	fmt.Println(isPalindrome("How are!! ! rawoh~"))
-	fmt.Println(isPalindrome("0P"))
-}
+// func main() {
+// 	fmt.Println(isPalindrome(""))
+// 	fmt.Println(isPalindrome("How are!! ! rawoh~"))
+// 	fmt.Println(isPalindrome("0P"))
+// }

+ 3 - 7
easy/136.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 func singleNumberOld(nums []int) int {
 	m := make(map[int]int, 0)
 	for _, v := range nums {
@@ -27,6 +23,6 @@ func singleNumber(nums []int) int {
 	return n
 }
 
-func main() {
-	fmt.Println(singleNumber([]int{1, 2, 3, 3, 2}))
-}
+// func main() {
+// 	fmt.Println(singleNumber([]int{1, 2, 3, 3, 2}))
+// }

+ 1 - 1
easy/14.go

@@ -11,7 +11,7 @@ func longestCommonPrefix(strs []string) string {
 	for _, v := range strs {
 		if cnt > len(v) {
 			cnt = len(v)
-		}2
+		}
 	}
 	// vertical serach
 	// [0 _] [0 _] [0 _] --> [_ 1] [_ 1] [_ 0] --> [0]

+ 6 - 10
easy/155.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 type MinStackOld struct {
 	val []int
 	min []int
@@ -100,9 +96,9 @@ func (this *MinStack) GetMin() int {
 	return this.min[len(this.min)-1]
 }
 
-func main() {
-	stack := Constructor()
-	stack.Push(1)
-	fmt.Println(stack.Top())
-	fmt.Println(stack.GetMin())
-}
+// func main() {
+// 	stack := Constructor()
+// 	stack.Push(1)
+// 	fmt.Println(stack.Top())
+// 	fmt.Println(stack.GetMin())
+// }

+ 18 - 22
easy/167.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 func twoSumOld(numbers []int, target int) []int {
 	for i := 0; i < len(numbers)-1; i++ {
 		for j := i + 1; j < len(numbers); j++ {
@@ -15,22 +11,22 @@ func twoSumOld(numbers []int, target int) []int {
 	return nil
 }
 
-func twoSum(numbers []int, target int) []int {
-	left, right := 0, len(numbers)-1
-	for left != right {
-		sum := numbers[left] + numbers[right]
-		if sum < target {
-			left++
-		} else if sum > target {
-			right--
-		} else {
-			return []int{left + 1, right + 1}
-		}
-	}
-	return nil
-}
+// func twoSum(numbers []int, target int) []int {
+// 	left, right := 0, len(numbers)-1
+// 	for left != right {
+// 		sum := numbers[left] + numbers[right]
+// 		if sum < target {
+// 			left++
+// 		} else if sum > target {
+// 			right--
+// 		} else {
+// 			return []int{left + 1, right + 1}
+// 		}
+// 	}
+// 	return nil
+// }
 
-func main() {
-	arr := []int{-1, 0}
-	fmt.Println(twoSum(arr, -1))
-}
+// func main() {
+// 	arr := []int{-1, 0}
+// 	fmt.Println(twoSum(arr, -1))
+// }

+ 6 - 10
easy/168.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 // wtf
 func convertToTitleOld(n int) string {
 	if n == 0 {
@@ -22,9 +18,9 @@ func convertToTitle(n int) string {
 	return res
 } // A --> 0, Z --> 25 !!!
 
-func main() {
-	fmt.Println(convertToTitle(546))
-	fmt.Println(convertToTitle(26))
-	fmt.Println(convertToTitle(702))
-	fmt.Println(convertToTitle(676))
-}
+// func main() {
+// 	fmt.Println(convertToTitle(546))
+// 	fmt.Println(convertToTitle(26))
+// 	fmt.Println(convertToTitle(702))
+// 	fmt.Println(convertToTitle(676))
+// }

+ 4 - 8
easy/169.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 func majorityElementOld(nums []int) int {
 	m := map[int]int{}
 	n := int(len(nums) / 2)
@@ -33,7 +29,7 @@ func majorityElement(nums []int) int {
 	return num
 }
 
-func main() {
-	arr := []int{1, 1, 3}
-	fmt.Println(majorityElement(arr))
-}
+// func main() {
+// 	arr := []int{1, 1, 3}
+// 	fmt.Println(majorityElement(arr))
+// }

+ 3 - 7
easy/171.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 func titleToNumber(s string) int {
 	res := 0
 	for base, i := 1, len(s)-1; i >= 0; base, i = base*26, i-1 {
@@ -12,6 +8,6 @@ func titleToNumber(s string) int {
 	return res
 }
 
-func main() {
-	fmt.Println(titleToNumber("WV"))
-}
+// func main() {
+// 	fmt.Println(titleToNumber("WV"))
+// }

+ 7 - 8
easy/172.go

@@ -1,7 +1,6 @@
 package main
 
 import (
-	"fmt"
 	"math"
 )
 
@@ -23,10 +22,10 @@ func trailingZeroes(n int) int {
 	return res
 }
 
-func main() {
-	fmt.Println(trailingZeroes(3))
-	fmt.Println(trailingZeroes(7))
-	fmt.Println(trailingZeroes(10))
-	fmt.Println(trailingZeroes(100))
-	fmt.Println(int(math.Log10(float64(125)) / math.Log10(5)))
-}
+// func main() {
+// 	fmt.Println(trailingZeroes(3))
+// 	fmt.Println(trailingZeroes(7))
+// 	fmt.Println(trailingZeroes(10))
+// 	fmt.Println(trailingZeroes(100))
+// 	fmt.Println(int(math.Log10(float64(125)) / math.Log10(5)))
+// }

+ 5 - 9
easy/189.go

@@ -1,9 +1,5 @@
 package main
 
-import (
-	"fmt"
-)
-
 func rotate1st(nums []int, k int) {
 	n := len(nums)
 	k %= n
@@ -38,8 +34,8 @@ func rotate3rd(nums []int, k int) {
 	}
 }
 
-func main() {
-	arr := []int{1, 2, 3, 4, 5, 6, 7}
-	rotate1st(arr, 4)
-	fmt.Println(arr)
-}
+// func main() {
+// 	arr := []int{1, 2, 3, 4, 5, 6, 7}
+// 	rotate1st(arr, 4)
+// 	fmt.Println(arr)
+// }

+ 10 - 14
easy/198.go

@@ -1,15 +1,11 @@
 package main
 
-import (
-	"fmt"
-)
-
-func maxInt(x, y int) int {
-	if x > y {
-		return x
-	}
-	return y
-}
+// func maxInt(x, y int) int {
+// 	if x > y {
+// 		return x
+// 	}
+// 	return y
+// }
 
 // DP? try to understand
 func rob(nums []int) int {
@@ -27,7 +23,7 @@ func rob(nums []int) int {
 	return maxInt(odd, even)
 }
 
-func main() {
-	arr := []int{1, 2, 435, 6543, 31, 43, 543, 21, 532}
-	fmt.Println(rob(arr))
-}
+// func main() {
+// 	arr := []int{1, 2, 435, 6543, 31, 43, 543, 21, 532}
+// 	fmt.Println(rob(arr))
+// }

+ 6 - 6
easy/67.go

@@ -1,12 +1,12 @@
 package main
 
 // add binary
-func minInt(x, y int) int {
-	if x < y {
-		return x
-	}
-	return y
-}
+// func minInt(x, y int) int {
+// 	if x < y {
+// 		return x
+// 	}
+// 	return y
+// }
 
 const one, zero = byte('1'), byte('0')
 

+ 3 - 4
easy/7.go

@@ -1,7 +1,6 @@
 package main
 
 import (
-	"fmt"
 	"math"
 )
 
@@ -42,6 +41,6 @@ func reverse(x int) int {
 	return int(res)
 }
 
-func main() {
-	fmt.Println(reverse(1234))
-}
+// func main() {
+// 	fmt.Println(reverse(1234))
+// }

+ 8 - 10
hard/10.go

@@ -1,7 +1,5 @@
 package main
 
-import "fmt"
-
 func isMatch(s string, p string) bool {
 	// If former x chars of string matches former y chars
 	// of pattern, match[x][y] == true, else == false
@@ -45,11 +43,11 @@ func isMatch(s string, p string) bool {
 	return match[len(s)][len(p)]
 }
 
-func main() {
-	fmt.Println(isMatch("", ""))
-	fmt.Println(isMatch("ssssss", "p"))
-	fmt.Println(isMatch("ssssss", "s*"))
-	fmt.Println(isMatch("ssssss", "s.*s"))
-	fmt.Println(isMatch("ss", "s.*ss"))
-	fmt.Println(isMatch("ss", "s*"))
-}
+// func main() {
+// 	fmt.Println(isMatch("", ""))
+// 	fmt.Println(isMatch("ssssss", "p"))
+// 	fmt.Println(isMatch("ssssss", "s*"))
+// 	fmt.Println(isMatch("ssssss", "s.*s"))
+// 	fmt.Println(isMatch("ss", "s.*ss"))
+// 	fmt.Println(isMatch("ss", "s*"))
+// }

+ 5 - 0
hard/4.go

@@ -0,0 +1,5 @@
+package main
+
+func main() {
+
+}