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

new graduate转MLE打卡

全局:

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

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

x
研究生12月就毕业啦,学的东西很杂,之前刷题都集中在绿皮书上,面试的时候被问到leetcode的题没答上有点难受,所以我准备刷题转machine learning engineer。

上一篇:[组队] [第四期活动] 在职刷题打卡,目标工作日一天2题,周末一天5题
下一篇:刷题记录
推荐
 楼主| 452674807 2019-10-5 05:00:07 | 只看该作者
全局:
打卡打卡。

Leetcode 75 Sort Colors.  思路:设置 三个pointer,遇到和中间pointer一样的element,pointer加一,如果element比较大,那么交换pointer所指的element(white 和blue),大的pointer 减一。如果element比较小,交换pointer所指的element(red和white),然后两个pointer都加一。

Leetcode 79 Word Search。 思路:DFS,iterate the matrix,for every element which corresponds to the word, find its neighboring element to check they are the same as the next letter in the word and run dfs again, notice that when run dfs again, assign a rare letter to previous element since the element shouldn't be used more than once.(in solution, they use '#'. eg: temp = board[i][j], board[i][j] = '#', after dfs, board[i][j] = temp)

Leetcode 74 Search a 2-D matrix. idea: binary search. Notice that the middle point in a matrix is matrix[mid/cols][mid%cols] where mid = (rows * cols )/ 2

楼主写这些思路只是为了自己加深记忆,详细答案和思路还请去leetcode官网详查。
回复

使用道具 举报

推荐
 楼主| 452674807 2019-10-8 03:27:59 | 只看该作者
全局:
Leetcode 88 Merge Sorted Array.  Compare two last elements in the list and put what is larger on the last position of nums1, next is m = m -1(or n = n-1). if there are some elements in nums2 left, we set nums1[:n] = nums2[:n]

Leetcode 80. Remove Duplicates from Sorted Array II. set a variable called i , if i <2 or  n > nums[i]-2: nums[i] = n ,  i = i +1

周末好忙,总是在写作业。。。
回复

使用道具 举报

推荐
 楼主| 452674807 2019-10-3 22:10:52 | 只看该作者
全局:
本帖最后由 452674807 于 2019-10-3 22:15 编辑

论坛用不熟练 东西没发出来。昨天做了62,63,64.都是用DP 看了答案之后觉得题不难,比较好写。 还做了73题,是个最优化空间复杂度的题,要掌握基本解法和空间最优解,用最优解的时候(set the first element in that row and column to zero respectively ),要记住顺序,不然会记重。我给朋友说了这个题他说没意思hhhh
回复

使用道具 举报

🔗
 楼主| 452674807 2019-10-2 04:45:51 | 只看该作者
全局:
今天回顾了Leetcode: 11.Container With Most Water  (Two pointer)  。在discussion里面看到一个简单的方法,while(left< right):  之后判断height[left]和height[right]大小,然后直接求max_area。不能只记住思想,还要记住为啥这样可以,
回复

使用道具 举报

🔗
 楼主| 452674807 2019-10-8 23:20:27 | 只看该作者
全局:
Leetcode 78. Subsets. DFS,

Leetcode 152. Maximum Product Subarray DP

Leetcode 120. Triangle DP
回复

使用道具 举报

🔗
 楼主| 452674807 2019-10-15 01:26:39 | 只看该作者
全局:
Leetcode 162. Find Peak Element : binary search. note that mid = l + (r-l)//2

Leetcode 167. Two Sum II: binary search or two pointer. two pointer method would be better in terms of time efficiency.

Leetcode 169. Majority Element.  dictionary or use two variable to keep track of the most frequent element.
回复

使用道具 举报

🔗
 楼主| 452674807 2019-10-15 23:49:00 | 只看该作者
全局:
Leetcode 153 : binary search

Leetcode 189: Rotate Array 三次reverse
Leetcode 209: Minimum Size Subarray Sum. Sliding window?
回复

使用道具 举报

🔗
 楼主| 452674807 2019-10-23 08:48:10 | 只看该作者
全局:
Leetcode :217 ,219 ,287
回复

使用道具 举报

🔗
 楼主| 452674807 2019-10-26 01:41:20 | 只看该作者
全局:
start with tag'string' today. I have finished
Leetcode 3.
Leetcode 14.
回复

使用道具 举报

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

本版积分规则

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