Brush the topic study :

 

160 Linked list intersection node search python realization

def getIntersectionNode(self, headA, headB):
        """
        :type head1, head1: ListNode
        :rtype: ListNode
        """
        a,b = 0,0
        p,q = headA,headB
        while headA and headB:
            headA,headB = headA.next,headB.next
            a,b = a+1,b+1
        while headA:
            headA,p = headA.next,p.next
        while headB:
            headB,q = headB.next,q.next
        while p:
            if p==q:
                return p
            p,q = p.next,q.next
           
        return 
    '''
        if not headA or not headB:# Empty list detection , No matter who comes back empty
            return 
        p,q = headA,headB
        while p!=q:# Parallel comparison of linked list nodes value, Complexity O(N)
            p = p.next if p else headB
            q = q.next if q else headA
        return p 
        '''

241 class Solution:
    def diffWaysToCompute(self, input: str) -> List[int]:  
        
       #241 Divide and rule
        res = []
        ops = {'+':lambda x,y:x+y, '-':lambda x,y:x-y, '*':lambda x,y:x*y}
        for indx in range(1,len(input)-1):
            if input[indx] in ops.keys():             
                for left in self.diffWaysToCompute(input[:indx]):
                    for right in self.diffWaysToCompute(input[indx+1:]):
                        res.append(ops[input[indx]](left,right))            
         
        if not res:
            res.append(int(input))
        
        return res

242 String to determine whether the same ectopic class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        if len(s)!=len(t):
            return False
        s_=list(s)
        t_=list(t)
        s_res=dict.fromkeys(s_,0)
        t_res=dict.fromkeys(t_,0)
        for i in s_:
            if i in s_res.keys():
                s_res[i]+=1
        for j in t_:
            if j in t_res.keys():
                t_res[j]+=1
        if len(s_res.items()&t_res.items())==len(s_res):
            return True
        else:
            return False

232 Stack queue
class MyQueue(object): def __init__(self): self.input = [] self.output = []
def push(self, x): self.input.append(x) def pop(self): if self.output: return
self.output.pop() else: while self.input: self.output.append(self.input.pop())
return self.output.pop() def peek(self): if self.output: return self.output[-1]
else: while self.input: self.output.append(self.input.pop()) return
self.output[-1] def empty(self): return len(self.input) == 0 and
len(self.output) == 0

Technology
©2019-2020 Toolsou All rights reserved,
CCTV :Tiktok A lawsuit shows the attitude and determination of safeguarding rights 【JAVA】【 Huawei campus recruitment written examination - Software 】2020-09-09ELementUI select Multi select drop-down box to get all properties of the selected item Vue Development tips Maximum security risk of cloud computing : Unclear safety responsibility uboot set up nfs parameter ——linux kernel use nfs Mode to load the root file system rootfs( Six )python3 Read the file and specify a few lines , And write to another file Golang Array bisection , Array split , Array grouping ( Essence )2020 year 6 month 26 day C# Class library File read and write operation help class vue use THREE.js Create a cube that you can control