17.letter Combinations of a Phone Number - 2018-07-26 00:17:05

题目 Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。 A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. 给出数字到字母

19.remove Nth Node From End of List - 2018-08-01 22:53:23

Leetcode地址 Github地址 题干 Given a linked list, remove the n-th node from the end of list and return its head. 给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。 Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the

Go的位操作四则运算实现 - 2018-08-02 00:26:55

package main import "fmt" func main() { a := 2 b := 2 fmt.Println(add(a, b)) fmt.Println(sub(a, b)) fmt.Println(mul(a, b)) fmt.Println(div(a, b)) } func add(a, b int) int { if b == 0 { return a } tmp := 0 for b != 0 { tmp = (a & b) << 1 a = a ^ b b = tmp } return a } func addr(a, b int) int { if b == 0 { return a } tmp := (a & b) << 1 a = a ^ b return addr(a, tmp) } func sub(a, b int) int { return add(a, add(^b, 1)) } func mul(a, b int) int { ans := 0 for b !