12
返回列表 发新帖
楼主: lawlietCU
跳转到指定楼层
上一主题 下一主题
收起左侧

每天打卡 + 目标每天5题 + 看书一小时

🔗
 楼主| lawlietCU 2019-1-3 12:58:24 | 只看该作者
全局:
896 Monotonic Array
    - use a flag to check status
650 2 Keys Keyboard
     - for prime number at least n operations
     - get the largest divisor and its operations
696 Count Binary Substrings
     - get the number of each group
     - the idea of groups is pretty tricky
835 Image Overlap
     - get the movement of overlapping each pair of 1
     - count the number of all movements and the max is the result
732 My Calendar III
     - represent timeline using a treemap, key is time, value is add/remove events at this time






回复

使用道具 举报

🔗
 楼主| lawlietCU 2019-1-4 14:14:08 | 只看该作者
全局:
788 Rotated Digits
    - how to check each digit of a number
    - n % 10, n /= 10
807 Max Increase to Keep City Skyline
   - two iterations, min of leftMax and topMax
382 Linked List Random Node
   - Reservoir Sampling in one iteration
   - pick k sample from n
   - first keep pool of first k
   - for next incoming k + i , probability of k / k + i to replace one, pick one random from the pool and replace
197 Rising Temperature
   - join the copy of current table by sliding it down one line





回复

使用道具 举报

🔗
 楼主| lawlietCU 2019-1-8 11:18:16 | 只看该作者
全局:
516 Longest Palindromic Subsequence
     - dp bottom up,  
     - if s.charAt(i) == s.charAt(j) dp[i][j] == dp[i + 1][j - 1] + 2
     - else dp[i][j] = max(dp[i + 1][j], dp[i][j - 1])
     - when coding, start from last line of array and make the first value dp[i][i] = 1 first.
728. Self Dividing Numbers
    - how to iterate over all digits of a number
    - String.valueOf(n).toCharArray()
740. Delete and Earn
    - similar to house rober
    - use taken/notaken to track state of last index
    - taken = notaken + track[i]
    - notaken = max(taken, nonTaken)

回复

使用道具 举报

🔗
 楼主| lawlietCU 2019-1-14 12:59:31 | 只看该作者
全局:
796. Rotate String
   - check if A + A contains B
5. Longest Palindromic Substring
   - search each index as center as leftCenter
92. Reverse Linked List II
   - reverse part of a list
   - use the start as pointer and put all next to the head
572. Subtree of Another Tree
   - recursive
836. Rectangle Overlap
    - 4 potential kinds of relations
Largest Common Divisor
    - (num1, num2)  keep recuse till smaller one is 0
    - (num1, num2 % num1)

回复

使用道具 举报

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

本版积分规则

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