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

[其他] 九月刷题给米接龙活动(小伙伴们冲冲冲)

   关闭
全局:
9月第二天还在整理之前的:
925:Long Pressed Name
two pointer,两个typed和named的指针一起动,如果不相同判断typed是否与name的前一个字符相同,注意edge case可以添加两个的长度,首位是否相同以及是否处理完所有的named的字符
977:Squares of a Sorted Array
暴力解先绝对值sort然后直接filter,小范围进阶找到零的位置用双指针,对比左右大小插入,直到两边走完
1011:Capacity To Ship Packages Within D Days:
最小的cap应该介于单个包裹最重和总包裹重量之间,因为包裹无法拆分,二分法,计算出在给定天数内能寄完所有包裹的最小容积

评分

参与人数 3大米 +4 收起 理由
rick_cheung + 1 给你点个赞!
DL + 2 给你点个赞!
ren365 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

全局:
九月Day2 今天做的题都好难 看来bfs就是要多练

F3351B56-3650-4475-83FA-6DE17AB3170C.jpg (85.09 KB, 下载次数: 0)

F3351B56-3650-4475-83FA-6DE17AB3170C.jpg

评分

参与人数 5大米 +6 收起 理由
damonguo + 2 给你点个赞!
UCLA34 + 1 给你点个赞!
rick_cheung + 1 给你点个赞!
DL + 1 给你点个赞!
ren365 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
ren365 2020-9-3 13:20:19 | 只看该作者
全局:
merge interval from grokking

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

image.png

评分

参与人数 3大米 +4 收起 理由
UCLA34 + 1 给你点个赞!
rick_cheung + 1 给你点个赞!
DL + 2 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
DL 2020-9-3 13:23:19 | 只看该作者
全局:
9/2 打卡第2天, 刷了3道题

64. Minimum Path Sum
动态编程
dp[i][j] = min(dp[i-1][j], dp[i][j-1])+grid[i][j]

68. Text Justification
string

220. Contains Duplicate III
暴力解法,O(nk), 超时
用hashtable,
key=nums[i]//(t+1)
if (key in bucket or
    (key-1 in bucket and nums[i]-nums[bucket[key-1]]<=t) or
    (key+1 in bucket and nums[bucket[key+1]]-nums[i]<=t)):
     return True

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

image.png

评分

参与人数 5大米 +6 收起 理由
damonguo + 2 给你点个赞!
erico + 1 给你点个赞!
yguozhen90 + 1 赞一个
UCLA34 + 1 给你点个赞!
rick_cheung + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
rick_cheung 2020-9-3 13:32:21 | 只看该作者
全局:
9/2

943.   Find the Shortest Superstring
1024. Video Stitching
741.   Cherry Pickup

评分

参与人数 3大米 +3 收起 理由
erico + 1 给你点个赞!
yguozhen90 + 1 赞一个
UCLA34 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
UCLA34 2020-9-3 13:38:29 | 只看该作者
全局:
9.2 第二天
4题目
dfs专题继续

Screen Shot 2020-09-03 at 01.37.28.png (35.28 KB, 下载次数: 1)

Screen Shot 2020-09-03 at 01.37.28.png

评分

参与人数 4大米 +4 收起 理由
qiaobao + 1 给你点个赞!
Bmbmwbm + 1 给你点个赞!
erico + 1 给你点个赞!
yguozhen90 + 1 赞一个

查看全部评分

回复

使用道具 举报

全局:
【刷题汇报】9/2 3题 #487 #414 #448

评分

参与人数 3大米 +3 收起 理由
qiaobao + 1 给你点个赞!
Bmbmwbm + 1 给你点个赞!
erico + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
erico 2020-9-3 13:55:36 | 只看该作者
全局:
今儿继续3题。第一题做蠢了,竟然用递归/dp做了,看完答案怀疑人生。。

9-2.PNG (75.62 KB, 下载次数: 1)

9-2.PNG

评分

参与人数 5大米 +7 收起 理由
xiaohao12 + 2 给你点个赞!
Lichens + 1 给你点个赞!
damonguo + 2 给你点个赞!
qiaobao + 1 给你点个赞!
Bmbmwbm + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
Bmbmwbm 2020-9-3 14:06:25 | 只看该作者
全局:
Sep 2
220:
Medium
bucket sort

358
# HARD

# Heap

# Input: s = "aaadbbcc", k = 2
# Output: "abacabcd"

# 1. find the frequency of each char in the input and store em in a heap
#     ==>  a: 3, b:2, c:2, d: 1

# 2. pop the heap till its empty
#     ==>
#         while heap is not empty
#             pop the heap k times.   since here k == 2, we popped  a,b
#             store the popped value to result, and a tmp

#             after k pops:
#                 decrement each t-- in [tmp],
#                 if the frequency of t is still >0, push it back

# eg. =>
#     1st:    a: 3, b:2, c:2, d: 1
#             a,b  
#     2nd:    a:2, c:2, b:1, d:1
#             a,c
#     3rd:    a:1, b:1, c:1, d:1
#             a,b
#     4th:    c:1, d:1
#             c,d  
#     result => a,b,a,c,a,b,c,d

294:
MEDIUM
# recursion

# recursive rule:
#     s[i-1] == s[i] == "+" and flipped s[i-1:i+1] + rest of string are not flippable

316

# check if we have it in stack using set
    if c not in appear:
    # if current char has lower value and there is one more stack[-1]
    # at the following string, then we have to pop the previous one
           while stack and c< stack[-1] and i < lastOccur[stack[-1]]:

评分

参与人数 3大米 +4 收起 理由
Lichens + 1 给你点个赞!
damonguo + 2 给你点个赞!
qiaobao + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
qiaobao 2020-9-3 14:17:15 | 只看该作者
全局:
9/2,写了Tree相关的几个简单题。

Screen Shot 2020-09-02 at 11.16.32 PM.png (72.18 KB, 下载次数: 0)

Screen Shot 2020-09-02 at 11.16.32 PM.png

评分

参与人数 3大米 +4 收起 理由
kanuo_007 + 1 给你点个赞!
Lichens + 1 给你点个赞!
damonguo + 2 给你点个赞!

查看全部评分

回复

使用道具 举报

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

本版积分规则

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