- 博客(13)
- 收藏
- 关注
原创 leetcode 19. Remove Nth Node From End of List
19. Remove Nth Node From End of List就是设两个指针,他们所指的元素相隔n个元素,当一个指针指向末尾时,另一个就指向了目标元素。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNo...
2018-07-28 00:11:17 111
原创 leetcode 2 add two numbers
leetcode 2 add two numbers常规数字加法#2017/03/12# practise on leetcode# Definition for singly-linked list.class Solution: def addTwoNumbers(self, l1, l2): ans = ListNode(0) t...
2018-07-27 23:44:40 117
原创 leetcode 004 Median of Two Sorted Arrays
leetcode 004 Median of Two Sorted Arrays先找第k个,再把第k个设为中间值就是答案。 类似二分查找的思想,k大于一半时小于一半时分别对应与不同的舍弃搜索范围的情况。 例如当k大于一半时,比较两个数组的中间元素,舍弃较小元素所属的数组的前一半,对剩余进行同样的查找(注意更新k,要减去该数组长度的一半)。这样每次缩小范围为原来的四分之三。# 2018/...
2018-07-27 23:20:04 129
原创 Python课程第八章练习
这里写代码片 class Restaurant(): def init(self, restaurant_name, cuisine_type): self.name = restaurant_name self.cuisine_type = cuisine_typedef describe_restaurant(self): p...
2018-07-27 21:11:43 236
原创 Python第二章课程练习
Python第二章课程练习2-1 存储并打印一条消息 message = “Fighting!” print(message)2-2 存储并打印一条消息,然后修改内容后再打印一次 message = “Happy” print(message) message = “Ending” print(message) 2-3 存储姓名,个性化...
2018-03-07 23:46:03 563
原创 Python 官网的浏览收获和关于Python的幻想
Python 官网的浏览收获和关于Python的幻想浏览网站的收获主要关注的是对于学习这门语言这个网站能够提供的帮助,经过走马观花式的浏览和粗略的筛选,对于这个学期的学习,我从这网站大概能获取的帮助有以下的这些对于一些语法知识,可以从网站的language reference 模块中获得,所以在使用Python的过程中,可以像之前用cppreference那样很快的对一些不熟悉的...
2018-03-05 17:18:53 151
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人