目录: K Airdrop I Soldier Game L Sub-cycle Graph G Repair the Artwork ———————————————————— ps:楼主脑残有点严重,很容易写错别字和语言组织混乱,如果在读文章时遇到,可以在评论区里回复一下,我好改(花式骗评论) 补题地址:http://acm.zju.edu.cn/onlinejudge/showProblems.do?contestId=1&pageNumber=31 顺便好人做到底,给大家凑个11/13的
题目描述 输入一个链表,输出该链表中倒数第k个结点 # -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def FindKthToTail(self, head, k): # write code here #遍历一次链表获得链表长度,再次遍历链表,至n-k+1出输出 if head == None or k <= 0
''' Created on Nov 06, 2017 kNN: k Nearest Neighbors Input: inX: vector to compare to existing dataset (1xN) dataSet: size m data set of known vectors (NxM) labels: data set labels (1xM vector) k: number of neighbors to use for comparison (should be
题目描述 输入一个链表,输出该链表中倒数第k个结点. 无力吐槽牛客网... class Solution: def FindKthToTail(self, head, k): # write code here f=p=head while f and k>0: f=f.next k-=1 if k>0 and f==None: return while f!=None: p=p.next f=f.next return p 2019-12-06 11:12:54