123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- package main
- import (
- "fmt"
- "math"
- "strconv"
- )
- func main(){
- a := []int{1,2,3}
- //b := []int{4,4,4}
- b := make([]int,3)
- copy(b,a)
- test(b)
- fmt.Println(b)
- s := "({{[wqeyqebA"
- for _, value := range s {
- //println(value)
- if value == 's' {
- }
- //println(string(value))
- }
- c := 'B'-1
- e := math.Pow(2,3)
- //println(string(s[2]))
- fmt.Println("======",'A','B',c,e)
- f,err :=strconv.ParseFloat("2d2",64)
- if err != nil {
- fmt.Println("--wwdd",err)
- }
- fmt.Println("--dd",f)
- //w :=titleToNumber("ABC")
- //fmt.Println("================",w)
- res := []string{"ffffffflowwew","ffffffflsrrww","ffffffflswee"}
- t :=longestCommonPrefix(res)
- fmt.Println(t)
- }
- func test(a []int){
- b := a
- b[1]= 1
- }
- func titleToNumber(columnTitle string) int {
- l := len(columnTitle)
- if l == 0 {
- return 0
- }
- res := 0
- for i:= 0;i<l;i++{
- m := int(math.Pow(26,float64(l-i-1)))
- println(m)
- res = res + int(columnTitle[i]-64)*m
- }
- return res
- }
- func longestCommonPrefix(strs []string) string {
- res := ""
- for i:=0;i<=200;i++{
- var tem byte
- ist := true
- for k,str := range strs{
- if len(str)<i-1{
- return res
- }
- if k == 0{
- if len(str) == 0{
- return ""
- }
- if len(str)<i-1{
- return res
- }
- tem = str[i]
- }
- if str[i] != tem{
- ist = false
- }
- }
- if ist{
- res = res +string(tem)
- }else {
- return res
- }
- }
- return res
- }
|