查看: 862| 回复: 1
跳转到指定楼层
上一主题 下一主题
收起左侧

刷题打卡

全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
从3/4开始每天5道 (从easy开始)
刷2个月刷完leetcode 200题
只用c++
然后计划歇一阵子,暑假接着干,每天4-5道题
刷2月再刷一遍那200-300题
最后总结一下题目
加油~~

------
今天刷的题

find a cycle in a directed/ undirected graph
Directed Graph:

DFS
3 kinds of nodes:
black: already explored, no cycle
grey: under exploration, on one path
white: not explored

turn grey to black: all of its children has visited, and there is no  cycle

if the node next to visit is grey: found a cycle

if the node next to visit is black: no need to visit, since all of its children has been explored, and no cycle found(all black)


topological sort

Union Find

Undirected graph:

2 kinds of nodes black and white(don’t need grey) like directed graph

topological sort
求图中所有点的度
删除度<=1的node,和相邻的边,
重复2直到无未删除的点
如果存在未删除的点,则有环,否则无环


上一篇:有看花花酱视频刷题的组队么?
下一篇:刷题打卡~西雅图刷题求组队
🔗
 楼主| yoooo 2019-4-19 11:39:12 | 只看该作者
全局:
DFS~~~
Similar to Maze and 8-Queen Problem

Reference:
GranYang


Leetcode Combination Sum & Combination Sum II:
Recursion & Backtraking

return all vals:mostly use Recrusion to solve  it.
Like CombinationSum 2
PathSum 2
Subset 2
Permutations 1,2
Combnations
回复

使用道具 举报

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

本版积分规则

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