A

389. Find the Difference

Given two strings s and t which consist of only lowercase letters.

String t is generated by random shuffling string s and then add one more letter at a random position.

Find the letter that was added in t.

Example:

Input:
s = "abcd"
t = "abcde"

Output:
e

Explanation:

'e' is the letter that was added.

class Solution(object):
    """
    xor
    """
    def findTheDifference(self,s,t):
        dic = {}
        for ch in s:
            dic[ch] = dic.get(ch,0) + 1
        for ch in t:
            if dic.get(ch,0) == 0:
                return ch
            else:
                dic[ch] -= 1

    def findTheDifference(self,s,t):
        diff = 0
        for i in range(len(s)):
            diff -= ord(s[i])
            diff += ord(t[i])
        diff += ord(t[-1])
        return chr(diff)

    def findTheDifference(self,s,t):
        code = 0
        for ch in s:
            code^=ord(ch)
        for ch in t:
            code^=ord(ch)
        return chr(code)

290.Word Pattern

def wordPattern(self,pattern,str):
    s = pattern
    t = str.split()
    return map(s.find,s) == map(t.index,t)

def wordPattern(self,pattern,str):
    f = lambda s:map({}.setdefault,s,range(len(s)))
    return f(pattern) == f(str.split())

def wordPattern(self,pattern,str):
    s = pattern
    t = str.split()
    return len(set(zip(s,t))) == len(set(s)) == len(set(t)) and len(s) == len(t)

R

其实看了很多的,一直没写而已,本来总结下Go语言,这是一排你关于书籍的关于Hello,Word背后究竟干了啥
http://fycsc.com/index.php/archives/159/

S

2020 and Beyond Programming Trend Predictions

https://medium.com/better-programming/2020-programming-trend-predictions-a5d6b70bec26
这篇文章描述了2020年的编程趋势预测
"The best way to predict your future is to create it"
-Abraham Lincohn
首先表明Rust将会是编程主流,原因是它是一个多态范式的系统编程语言特别注重的是安全,尤其是安全的并发性,Rust与C++在语法上与C++类似,但它提供更好的内存安全性,同时保持高性能,同时facebook开发的Libra就是用Rust开发的
PWA(Progressive Web Apps Are a Force to Reckon With)将会是一个考量的因素
还有一些关于前端方面的的框架:React继续统治着那些前端框架库,排名分别为:React,Angular,Vue

QQ截图20190811234054.png

T

技术的话:总结了关于Python的一些特性:链接如下
http://fycsc.com/admin/write-post.php?cid=73