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

刷题记录帖

🔗
 楼主| Oceanid77 2019-12-13 02:29:17 | 只看该作者
全局:
Super fast Java solution using two-end BFS

752. Open the Lock
finish this tmr


make summary of BFS
127. Word Ladder
you wen ti
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-15 04:05:03 | 只看该作者
全局:
1057. Campus Bikes
1066. Campus Bikes II
linkedList
24. Swap Nodes in Pairs

make summary of BFS
127. Word Ladder
you wen ti
明天跑一遍
q.size() 提前记录

怎样讲解listnode的题目?

25. Reverse Nodes in k-Group
24. Swap Nodes in Pairs
recursive
if(head ==null || head.next==null){return head;}
iterative
  while (curr != null && curr.next != null){
344. Reverse String
541. Reverse String II
557. Reverse Words in a String III !!!


Dynamic Programming
       
Climbing Stairs

Greedy: comparator!
study

graph
417. Pacific Atlantic Water Flow
iterator
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-15 10:42:52 | 只看该作者
全局:
1096. Brace Expansion II

DP
5. Longest Palindromic Substring
study !
1057. Campus Bikes
write it tmr
PriorityQueue<int[]> q = new PriorityQueue<int[]>((a, b) -> {
            int comp = Integer.compare(a[0], b[0]);
            if (comp == 0) {
                if (a[1] == b[1]) {
                    return Integer.compare(a[2], b[2]);
                }
               
                return Integer.compare(a[1], b[1]);
            }
            
            return comp;
        });
1066. Campus Bikes II
枚举法
boolean to recordvisited
22. Generate Parentheses
Java DFS with memorization study
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-15 12:01:37 | 只看该作者
全局:
01string flip,  从开始string到目标string, 然后有个allow list 是允许的中间状态,  问最少多少次反转。follow up, if start word do not change and there are many target word, how can you get the answer with a short time.
word ladder
01 二叉树的题。 根节点有一个孩子是0则为0, 两个孩子都是1则是1.  第一问是clear 最后一层给定index 区间的节点,变成0, 然后调整整个树的值。 第二问是把给定区间的值设为1, 返回整颗树调整后的值。
Binary tree
有两个map, 用二维矩阵表示,0 represent empty and 1 represent island. 你可以上下左右地移动map, 求最大的重合面积。时间复杂度要求n^3, follow up 如何实现n^2
835. Image Overlap找一个0,1矩阵中最长连续的1. 可以是一行一列和对角线
200. Number of Islands 加上对角线
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-15 12:50:11 | 只看该作者
全局:

给两个字符串a, b,长度相等,定义两者之间的距离为,如果同一位置字符不一样,距离加一。返回b的两个index,将这两个index的字符互换可以让距离最小。
????

给一个二叉树,节点是字符,返回中序遍历的字符串。第二问,给两个字符串,返回两者的中序遍历的字符串是否相等。
binary tree


一个矩阵,有鱼,草,空位。第一问,写出鱼草之间的距离函数,是8个方向的。第二问,给一个鱼,返回它能吃到的离它最近的草,注意有些草虽然离这条鱼最近,但是离另一条鱼可能更近。
unique path


combination sum 变体,二维dp。第二问,如果数据量很大怎么办 =》 分布式
dp

补充内容 (2019-12-18 13:06):
campus bike

补充内容 (2019-12-18 13:08):
62. Unique Paths  dpti
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-15 13:35:06 | 只看该作者
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-15 14:05:37 | 只看该作者
全局:
252. Meeting Rooms
253. Meeting Rooms II
56. Merge Intervals
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-16 15:07:03 | 只看该作者
全局:
22. Generate Parentheses
Java DFS with memorization study
257. Binary Tree Paths
iterative way , study and write tmr
222. Count Complete Tree Nodes
Approach 2: Binary search
important study it

Can you determine some parameters to help the node know its answer? Can you use these parameters and the value of the node itself to determine what should be the parameters passed to its children?
for a node in a tree, if you know the answer of its children, can you calculate the answer of that node?

104. Maximum Depth of Binary Tree
iterstive way. similiar with 257
101. Symmetric Tree
iterative way
100. Same Tree
iterative way

those two questions are the same
112. Path Sum
有关于求是否等于一个sum
正向思维: 把一个path上所有的和求出来,然后和sum比较,这样会需要一个额外的数来储存求出来的和。
可以在过程中,将sum不断地减去root的值,最后得出一个值和0比较。
????????想一想
dfs campus bike ii

250. Count Univalue Subtrees
study tmr
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-17 10:02:58 | 只看该作者
全局:
250. Count Univalue Subtrees
if(left == true  && right == true)
简化为
if(left  && right)
if((root.right == null ||root.right.val == root.val) &&
               (root.left == null || root.left.val == root.val)){
study and try Approach 2: Depth First Search - Pass Parent Values!!

572. Subtree of Another Tree
[1,1][1]test case
100. Same Tree
101. Symmetric Tree
write again!!!!!
508. Most Frequent Subtree Sum
687. Longest Univalue Path

good ti, study again tmor
!!!!
囫囵吞枣
https://www.youtube.com/watch?v=yX1hVhcHcH8

112. Path Sum
done check iterative way

113. Path Sum II
257. Binary Tree Paths

437. Path Sum III
666. Path Sum IV
124. Binary Tree Maximum Path Sum
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-12-17 15:27:56 | 只看该作者
全局:
252. Meeting Rooms
253. Meeting Rooms II
56. Merge Intervals
435. Non-overlapping Intervals
回复

使用道具 举报

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

本版积分规则

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