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

打卡帖 告别拖延症~

🔗
 楼主| UCLA34 2021-4-2 07:20:50 | 只看该作者
全局:
list.extend(another list)

image.png (12.68 KB, 下载次数: 1)

image.png
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-6 03:19:08 | 只看该作者
全局:
Python 这么写 可以锁定当前层数的node

image.png (17.46 KB, 下载次数: 0)

image.png
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-6 04:45:10 | 只看该作者
全局:
python

.append()     for old list

to create a new list
list + [new element]

image.png (26.8 KB, 下载次数: 1)

image.png
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-4-13 04:55:25 | 只看该作者
全局:
https://www.lintcode.com/problem/combinations/

for each element, you either take it or not take it.

Also, use

newCombi = list(combination)
results.append(newCombi)

to create a new copy

image.png (47.09 KB, 下载次数: 1)

image.png
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-7-7 14:51:27 | 只看该作者
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-7-17 06:29:30 | 只看该作者
全局:
if result > (1 << 31) - 1 or result < - (1 << 31) :
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-8-31 06:58:30 | 只看该作者
全局:
https://www.guru99.com/learn-pyt ... nderstand-main.html

In python3, you do not actually need to do the if __name__ == "__main__": thingy
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-9-8 05:38:54 | 只看该作者
全局:
UCLA34 发表于 2021-8-30 18:58
https://www.guru99.com/learn-python-main-function-with-examples-understand-main.html

In python3,  ...

def main():
  print("Hello World!")
  
main()
print("Guru99")
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-9-8 16:04:05 | 只看该作者
全局:
distance = [[float('inf')]*n for _ in range(m)] , this will create seperate rows, if do *n *m, it will create same row, change one row will affect all the other rows
回复

使用道具 举报

🔗
 楼主| UCLA34 2021-9-8 16:04:32 | 只看该作者
全局:

        distance = [[float('inf')]*m for _ in range(n)]     m for col and n for row
回复

使用道具 举报

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

本版积分规则

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