String rotation . Given two strings s1 and s2, Please write code check s2 Is it s1 Rotating ( such as ,waterbottle yes erbottlewat Rotated string ).

Examples 1

input :s1 = "waterbottle", s2 = "erbottlewat"
  output :True

Examples 2

input :s1 = "aa", "aba"
output :False
func isFlipedString(s1 string, s2 string) bool { return len(s1) == len(s2) &&
strings.Contains(s2 + s2, s1) }
Write code , Remove duplicate nodes from unsorted linked list . Keep the first node .

Examples 1:
input :[1, 2, 3, 3, 2, 1] output :[1, 2, 3]
Delete all the same nodes after each node .
/** * Definition for singly-linked list. * type ListNode struct { * Val int *
Next *ListNode * } */ func removeDuplicateNodes(head *ListNode) *ListNode { ;
for temp:=head;temp!=nil;temp=temp.Next{ num:=temp.Val; for i:=temp;i!=nil &&
i.Next!=nil;{ if(i.Next.Val==num){ i.Next=i.Next.Next; }else{ i=i.Next } } }
return head; }
Implement an algorithm , Find the penultimate in a one-way linked list k Nodes . Returns the value of the node .

be careful : This question is slightly changed from the original one

Examples :

input : 1->2->3->4->5 and k = 2
output : 4
/** * Definition for singly-linked list. * type ListNode struct { * Val int *
Next *ListNode * } */ func kthToLast(head *ListNode, k int) int { length:=0;
for temp:=head;temp!=nil;temp=temp.Next{ length++; } for i:=length-k;i>0;i--{
head=head.Next; } return head.Val; }
Implement an algorithm , Delete a node in the middle of a one-way linked list ( That is not the first or last node ), Suppose you can only access the node .

 

Examples :

input : One way linked list a->b->c->d->e->f Node in c
result : No data is returned , But the linked list becomes a->b->d->e->f

thinking : Change the value to the value of the next node , And delete the next node .
/** * Definition for singly-linked list. * type ListNode struct { * Val int *
Next *ListNode * } */ func deleteNode(node *ListNode) { node.Val=node.Next.Val;
node.Next=node.Next.Next; }
 

Technology
©2019-2020 Toolsou All rights reserved,
pytorch of ResNet18( Yes cifar10 The accuracy of data classification is achieved 94%)[AndroidO] [RK3399] -- GPIO Drive and control mode 11-5 Output string at specified position ( Essence )2020 year 6 month 26 day C# Class library read json Profile help class element ui Drop down box search function Element-UI Implementation of secondary packaging TreeSelect Tree drop-down selection component Paging tool class PageResult( Essence 2020 year 6 month 3 Daily update ) TypeScript Detailed explanation of Chinese interface Hack Bar 2.1.2 Press F9 No response Dijkstra Algorithmic Python realization - Shortest path problem