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

[其他] 8月刷题/Mock interview接龙活动(缺米刷题的来)

   关闭
🔗
gasolnowitzki 2020-8-10 03:03:09 | 只看该作者
全局:

Report for duty

评分

参与人数 1大米 +1 收起 理由
ztamber + 1 很有用的信息!

查看全部评分

回复

使用道具 举报

全局:
8/9 Day9

54
Spiral Matrix
用Layer to Layer 解

36
Valid Sudoku
数独 hashset和对于Array的掌握

38
Count and Say
StringBuilder

评分

参与人数 3大米 +3 收起 理由
拉米丹米 + 1 给你点个赞!
LyanW + 1 给你点个赞!
ztamber + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
ztamber 2020-8-10 03:44:19 | 只看该作者
全局:
打卡
* Path Sum I
* Path Sum II
* Path Sum III
* Postorder (iterative way)
* Closest Binary Search Tree Value

评分

参与人数 3大米 +3 收起 理由
QWERTYUIOPAS + 1 给你点个赞!
拉米丹米 + 1 给你点个赞!
LyanW + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
LyanW 2020-8-10 04:16:22 | 只看该作者
全局:
八月day8:
今天3道题
replace element with the greatest element on the right side: 从后往前
valid mountain array
check if n and its double exist

Screen Shot 2020-08-09 at 3.11.45 PM.png (109.95 KB, 下载次数: 0)

Screen Shot 2020-08-09 at 3.11.45 PM.png

评分

参与人数 3大米 +3 收起 理由
speed_secret20 + 1 给你点个赞!
QWERTYUIOPAS + 1 给你点个赞!
拉米丹米 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
拉米丹米 2020-8-10 04:57:18 | 只看该作者
全局:
本帖最后由 拉米丹米 于 2020-8-10 05:01 编辑

打卡两题(貌似要点大图可以正常显示)~是leetcode facebook prep专区里的medium题

希望各种OA面试顺利 早日上岸啊啊啊啊

真诚求米.jpg
更多图片 小图 大图
组图打开中,请稍候......

评分

参与人数 3大米 +3 收起 理由
htkz + 1 给你点个赞!
speed_secret20 + 1 给你点个赞!
QWERTYUIOPAS + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
QWERTYUIOPAS 2020-8-10 05:19:22 | 只看该作者
全局:
Day 6
最近系统设计,题都有些水。。。

337 House Robber 3
这个题上来就懵了。。。好久不刷题,看见树好像看见鬼一样。连recursion基本的都没写出来。打开答案一秒懂。。。就是recursion + memo,写dp的话要返回两个值用int[2] 存。

375 Guess Number Higher or Lower
这个MinMax第二次写了。写完发现上次根本没有懂。这个之所以要每一轮都特别悲观总也选不对,但是要取每一轮里最小的那个值,因为每次都可以从最小的开始查,比如最后剩下 2 跟 3,肯定猜 2,这样对了就完事,不对的话肯定是3, 也不用再继续给钱了. 所以永远猜小的,省钱。

415 Add Strings
非常水。。。凑个数。。。

评分

参与人数 3大米 +3 收起 理由
zjliu + 1 给你点个赞!
htkz + 1 给你点个赞!
speed_secret20 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

全局:
补昨天的作业:8月8号  day 8

刷题3道
1. Binary search find an element in a sorted matrix
-把二维matrix转化成一个一维array,然后用对应的坐标取值;
2. find common element in two arrays;
-先排序,后用2个pointers分列在A/B两个array当中,然后再同时
从左到右进行扫描
3. Find all anagrams
这个题可以好好说说

Question:
Given string s1 and s2;
Find all the substring of s2 which could be one permutation of s1;

Assumption:
both strings are not null or empty;
all operation can fit in memory;

Analysis && High level:
No matter what the permutation is, for example the permutation string str of s1 can be find as the substring of s2, it must have the same number of characters; so Instead of using recursion to find all permutations of s1(eg: size = M), which could increase the time complexity to M!; in order to decrease the time complexity, so to use a hashMap, which used for storing all elements in s1.
For example: s1: "acdddd" -> hashMap :{ 'a', 1}, {'c', 1}, {'d', 4};
Then use two pointers slow and fast to traverse the string s2, at the same time, maintained a size M as a sliding window, use a list to store all qualified substrings in s2, after the whole traverse, return the list.

Details:
Use a hashMap with <K,V> pair to store all characters(as Key) and its duplicate times(as value);
Then linear scan the string s2 and maintained the size as M as a sliding window by using slow and fast pointers, also combining with an int variable match to record the matching status of the hashMap.
When the size of the sliding window is smaller than M, the substring range from slow to fast can not be the qualified one, so move the fast pointer to fulfill the size of sliding window first and keep tracking of the match status of the hashMap. Besides, if the sliding window is larger than M, it is also impossible to form a string that could be the permutation of s1. so it is necessary to move slow and fast dynamically to maintain a size M sliding window.
If match equals to the size of hashMap which represent already find the matched permutation,and put current substring into the final result.
until the whole string s2 has been traversed, return the result;

评分

参与人数 3大米 +3 收起 理由
wznfls + 1 给你点个赞!
zjliu + 1 给你点个赞!
htkz + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
htkz 2020-8-10 06:16:09 | 只看该作者
全局:
日期: 8/9/2020
题目: [3]
994. Rotting Oranges
1371. Find the Longest Substring Containing Vowels in Even Counts
1539. Kth Missing Positive Number

评分

参与人数 3大米 +3 收起 理由
zea7ot + 1 给你点个赞!
wznfls + 1 给你点个赞!
zjliu + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
zjliu 2020-8-10 06:52:32 | 只看该作者
全局:
8.9 day9
今天头疼只写了每日一题

Screen Shot 2020-08-09 at 6.51.58 PM.png (61.07 KB, 下载次数: 0)

Screen Shot 2020-08-09 at 6.51.58 PM.png

评分

参与人数 3大米 +3 收起 理由
fnwjkm + 1 给你点个赞!
zea7ot + 1 给你点个赞!
wznfls + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
wznfls 2020-8-10 07:16:02 | 只看该作者
全局:
每日三题 day9
Rotting Oranges - 简单的遍历/图的存储,但是错在边界上,数iteration的时候是 while - do 还是 do - until
Merge Two Sorted Lists - 链表的基础操作,但是忘了挪current指针导致一直在刷新head。。。
Find First and Last Position of Element in Sorted Array - 二分查找的变种,算法和想法都没问题,但是又在边界条件上错了N次。。外加又一次把tail打错字成了target。。



评分

参与人数 3大米 +3 收起 理由
abct + 1 给你点个赞!
fnwjkm + 1 给你点个赞!
zea7ot + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

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

本版积分规则

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