楼主: UCLA34
跳转到指定楼层
上一主题 下一主题
收起左侧

打卡帖 告别拖延症~

🔗
 楼主| UCLA34 2021-3-31 06:13:37 | 只看该作者
全局:
        dummy = ListNode(-1)
        dummy.next = head
        pre = dummy
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-3-31 22:04:25 | 只看该作者
全局:
Always bear in mind:

"use space trade for time"
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-1 05:09:16 | 只看该作者
全局:
        #if token != '+' and token != '-' and token != '*' and token != '/':
        if token not in ['+', '-', '*', '/']:

line 2 is much cleaner than line 1
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-1 05:10:03 | 只看该作者
全局:
      return '/' + '/'.join(stack)

you can always do something like this

join operation join at the end -> one/two/three...
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-1 05:48:10 | 只看该作者
全局:
group[key] = group.get(key, []) + [string]

B = [1,2,3] D = ['d']
B + D
-> [1,2,3,'d']
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-1 08:36:42 | 只看该作者
全局:
这个 数组滚动的方式值得学习
        A = [1,2]
        for i in range(n - 2):
            A.append(A[-1] + A[-2])
        
        return A[-1]
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-1 22:24:59 | 只看该作者
全局:
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-1 23:41:53 | 只看该作者
全局:
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-2 05:58:36 | 只看该作者
全局:
https://www.lintcode.com/problem/subsets/

list() function used to create a new copy, as opposed to passing in the address
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-2 06:07:05 | 只看该作者
全局:
本帖最后由 UCLA34 于 2021-4-2 06:14 编辑

preoder, inorder, postorer, -> the pre is parent node,

e.g. preorder: parent node is preceding other nodes
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表