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

俩娃大妈在职刷题

   
🔗
lauraxy 2019-3-28 11:54:50 | 只看该作者
全局:
楼主真棒,加油!
回复

使用道具 举报

全局:
suhehe 发表于 2019/03/27 10:19:33


谢谢您的支持!在您的鼓励下,我今天一鼓作气刷了5道easy的题(^_^),目前共刷了20题。洗洗睡了。明天早上6点半要起床给娃准备早餐,还有给晚餐备菜(要是我早上不把菜洗好切好,晚上来不及做饭给娃...

哈哈,共勉,昨天看完你的帖子就立马继续学Python了,效率也挺高的😁今天争取就把最后一个course的题刷完,一起加油呀,小姐姐。
回复

使用道具 举报

🔗
 楼主| suhehe 2019-3-29 10:28:45 来自APP | 只看该作者
全局:
再忙!也要打卡[Fist]
107. Binary Tree Level Order Traversal II
BFS: Runtime: 1 ms, faster than 88.42% of Java online submissions for Binary Tree Level Order Traversal II.
Memory Usage: 37.3 MB, less than 53.58% of Java online submissions for Binary Tree Level Order Traversal II.
DFS: Runtime: 1 ms, faster than 88.42% of Java online submissions for Binary Tree Level Order Traversal II.
Memory Usage: 37.2 MB, less than 75.87% of Java online submissions for Binary Tree Level Order Traversal II.  DFS比BFS省空间

补充内容 (2019-3-29 11:00):
110. Balanced Binary Tree
还是用global variable的方法容易理解,以后再写不用global variable 的方法吧!Runtime: 1 ms, faster than 76.77% of Java online submissions for Balanced Binary Tree.
Memory Usage: 40.5 MB, less than 33.86% of Java online submissions for Balanced Binary Tree.

补充内容 (2019-3-29 11:11):
111. Minimum Depth of Binary Tree 晚上终于遇到一道稍微简单一点的题了
Runtime: 0 ms, faster than 100.00% of Java online submissions for Minimum Depth of Binary Tree.
Memory Usage: 39.8 MB, less than 12.17% of Java online submissions for Minimum Depth of Binary Tree.

补充内容 (2019-3-29 11:20):
112. Path Sum recursion, 没什么好说的 Runtime: 0 ms, faster than 100.00% of Java online submissions for Path Sum.
Memory Usage: 38.7 MB, less than 34.72% of Java online submissions for Path Sum.
回复

使用道具 举报

🔗
 楼主| suhehe 2019-3-30 09:08:00 来自APP | 只看该作者
全局:
118. Pascal's Triangle
Runtime: 0 ms, faster than 100.00% of Java online submissions for Pascal's Triangle.
Memory Usage: 32.5 MB, less than 100.00% of Java online submissions for Pascal's Triangle.
说个八卦,刚才我码这道题的时候,刚上小学的老大看到了,说:“So easy!One plus one is easy work。”

补充内容 (2019-3-30 10:12):
119. Pascal's Triangle II
Runtime: 0 ms, faster than 100.00% of Java online submissions for Pascal's Triangle II.
Memory Usage: 32.5 MB, less than 100.00% of Java online submissions for Pascal's Triangle II.
我用的是recursion的方法。用DP的方法,我理解起来有困难。孩子啊!这题对你娘来说不容易呢!

补充内容 (2019-3-30 11:04):
121. Best Time to Buy and Sell Stock 用DP的解法应该更快,但是我偷懒, 还是买低卖高的方法容易理解 Runtime: 1 ms, faster than 81.15% of Java online submissions for Best Time to Buy and Sell Stock.
Memory Usage: 39.6 MB, less than 30.47% of Java online submissions for Best Time to Buy and Sell Stock.

补充内容 (2019-3-30 11:13):
122. Best Time to Buy and Sell Stock II
这道题好像出错了,没什么意思
Runtime: 1 ms, faster than 77.76% of Java online submissions for Best Time to Buy and Sell Stock II.
Memory Usage: 38.6 MB, less than 56.12% of Java online submissions for Best Time to Buy and Sell Stock II.

补充内容 (2019-3-30 11:47):
125. Valid Palindrome 虽然我的解法慢了点,可是容易理解,算了!周末的晚上
Runtime: 6 ms, faster than 50.57% of Java online submissions for Valid Palindrome.
Memory Usage: 39.2 MB, less than 20.22% of Java online submissions for Valid Palindrome.

补充内容 (2019-3-30 12:02):
136. Single Number 居然可以用XOR解!
Runtime: 0 ms, faster than 100.00% of Java online submissions for Single Number.
Memory Usage: 41.9 MB, less than 15.27% of Java online submissions for Single Number.

补充内容 (2019-3-30 12:04):
明天不用上班,今晚稍微晚点睡。但是不能太晚,因为娃早上8点要起来吃早餐了

补充内容 (2019-3-30 12:07):
目前共刷了34题了
回复

使用道具 举报

🔗
 楼主| suhehe 2019-3-31 10:34:37 来自APP | 只看该作者
全局:
141. Linked List Cycle 用双指针好理解:Runtime: 0 ms, faster than 100.00% of Java online submissions for Linked List Cycle.
Memory Usage: 37.5 MB, less than 96.73% of Java online submissions for Linked List Cycle.
Time complexity : O(n); Space complexity: O(1)。
然后还可以用Set, naive,太慢。Time complexity : O(n); Space complexity: O(1) 关键是新建一个Set也要花时间。所以只有Runtime: 5 ms, faster than 18.78% of Java online submissions for Linked List Cycle.
Memory Usage: 39.2 MB, less than 5.15% of Java online submissions for Linked List Cycle.

补充内容 (2019-3-31 10:57):
155. Min Stack
我好怕写这些data structures。研究了一个最佳答案:Runtime: 45 ms, faster than 99.81% of Java online submissions for Min Stack.
Memory Usage: 38.3 MB, less than 92.96% of Java online submissions for Min Stack.

补充内容 (2019-3-31 11:18):
157. Read N Characters Given Read4 题目好长,搞了半天才弄懂意思 Runtime: 0 ms, faster than 100.00% of Java online submissions for Read N Characters Given Read4.
Memory Usage: 35.8 MB, less than 43.80% of Java online submissions for Read N Characters Given Read4.
Time complexity : O(n); Space complexity: O(n)

补充内容 (2019-3-31 11:20):
今天真累了。周末带娃比平时还累!又要买菜又要带娃去游乐场,平时正常的洗衣做饭一样不少,累死了!目前共刷37题
回复

使用道具 举报

🔗
月落西谷 2019-3-31 14:22:03 | 只看该作者
全局:
楼主小姐姐好棒!!!
收到了激励~努力刷题too!
回复

使用道具 举报

🔗
 楼主| suhehe 2019-4-1 11:42:23 来自APP | 只看该作者
全局:
160. Intersection of Two Linked Lists
看了一个小时也没搞懂最佳解法为什么设 a = a == null? headB : a.next; 今天周末,真是比平时更忙,因为带娃是从早上7点到晚上9点,没娃的人不能理解:-( 而且我这一周oncall,进度不得不慢下来了。
回复

使用道具 举报

🔗
scz 2019-4-1 12:20:16 | 只看该作者
本楼:
全局:
好感动…
回复

使用道具 举报

🔗
scz 2019-4-1 12:20:58 | 只看该作者
全局:
加油!!!!!!!!!娃一定也为你骄傲!
回复

使用道具 举报

🔗
 楼主| suhehe 2019-4-2 09:34:17 来自APP | 只看该作者
全局:
160. Intersection of Two Linked Lists
终于弄懂 a = a == null? headB : a.next; 的意思了,就是通过双链链接产生平头末端,这样在第二次iteration headB为首的List 和headA为首的List时候,这两条链肯定是尾端match的。Time complexity : O(m + n); Space complexity: O(1).

补充内容 (2019-4-2 09:40):
167. Two Sum II - Input array is sorted
Two pointers。Runtime: 0 ms, faster than 100.00% of Java online submissions for Two Sum II - Input array is sorted.
Memory Usage: 38.5 MB, less than 24.19% of Java online submissions for Two Sum II - Input array is sorted.

补充内容 (2019-4-2 09:54):
168. Excel Sheet Column Title 捣鼓了半天,没想到结果这么好!可是最佳答案只写一行,我写了if - else if - else
Runtime: 0 ms, faster than 100.00% of Java online submissions for Excel Sheet Column Title.
Memory Usage: 35.1 MB, less than 100.00% of Java online submissions for Excel Sheet Column Title.

补充内容 (2019-4-2 10:10):
169. Majority Element
Moore Voting Algorithm, Time complexity: O(n) Space complexity: O(1)

补充内容 (2019-4-2 11:00):
170. Two Sum III - Data structure design
不知道为什么,这道题总有case不能通过。算了,今晚on call,抓紧时间睡会,保佑今晚平平安安

补充内容 (2019-4-2 11:01):
目前刷了41题easy
回复

使用道具 举报

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

本版积分规则

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