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

[其他] 缺大米的请参加这个刷题/Mock interview活动

     关闭
🔗
Chianti13 2020-6-29 05:19:05 | 只看该作者
全局:
本帖最后由 Chianti13 于 2020-6-29 05:40 编辑

啊啊啊才看到有这么好的活动!已经自己刷了一个多月了 先和lz说声抱歉 时间早一点的记录我可能翻不到或是记录的有点模糊了 在leetcode上开了好几个session太乱了…先把这个月尽力找到的记录发出来吧 先感谢楼主加米5555~我真是太缺米了

一个多月几乎每天都有在leetcode上刷database和algorithms(偶尔因为final没刷)。下面是刷题记录:
6.1: db 6道: Shortest Distance in a Plane, Investments in 2016, Count Student Number in Departments, Get Highest Answer Rate Question, Winning Candidate, Managers with at Least 5 Direct Reports

6.2: algo 2道: House Robber, Best Time to Buy and Sell Stock
       db 3道: Human Traffic of Stadium, Trips and Users, Department Top Three Salaries, Number of Transactions per Visit

6.3: db 4道: Market Analysis II, Students Report By Geography, Find Cumulative Salary of an Employee, Report Contiguous Dates

6.5: algo 3道: Maximum Subarray, Range Sum Query - Immutable, House Robber II
       db 4道: User Purchase Platform, Find the Quiet Students in All Exams, Median Employee Salary, Total Sales Amount by Year

6.7: db 5道: Get the Second Most Recent Activity, Tournament Winners, Game Play Analysis V, Average Salary: Departments VS Company, Find Median Given Frequency of Numbers
       algo 3道: Coin Change, Maximum Product Subarray,Longest Increasing Subsequence

6.8 db 6道: Calculate Salaries, Combine Two Tables, Delete Duplicate Emails, Customers Who Never Order, Employees Earning More Than Their Managers, Second Highest Salary
      algo 1道: Longest Palindromic Substring,

6.11 algo 4道: Palindromic Substrings, Number of Longest Increasing Subsequence, Partition Equal Subset Sum, Partition to K Equal Sum Subsets

6.12 algo 1道: Best Time to Buy and Sell Stock with Cooldown 试了两三种解法

6.13 algo 5道: Middle of the Linked List, Palindrome Linked List, Remove Linked List Elements, Remove Duplicates from Sorted List, Linked List Cycle II

6.14 algo 4道: Add Two Numbers, Remove Nth Node From End of List, Sort List, Reorder List

6.16 algo 3道: Clone Graph, Number of Islands, Graph Valid Tree

6.17 algo 3道: Graph Valid Tree, Number of Connected Components in an Undirected Graph, Reverse Linked List
        db 2道: New Users Daily Count, Project Employees III,

6.18 algo 5道: Reverse Linked List II, Rotate List, Swap Nodes in Pairs, Odd Even Linked List, Reverse Nodes in k-Group
        db 8道: Product Sales Analysis III, Shortest Distance in a Plane, Investments in 2016, Count Student Number in Departments, Get Highest Answer Rate Question, Winning Candidate, Department Top Three Salaries, Trips and Users

6.19 algo 4道: Find K Pairs with Smallest Sums, Merge k Sorted Lists, Merge Two Sorted Lists, Kth Smallest Element in a Sorted Matrix
        db 6道: Human Traffic of Stadium, Number of Transactions per Visit, Median Employee Salary, Find Cumulative Salary of an Employee, User Purchase Platform, Market Analysis II

6.20 algo 2道: Smallest Range Covering Elements from K Lists, Meeting Rooms,
        db 5道: Report Contiguous Dates, Students Report By Geography, Find the Quiet Students in All Exams, Sales by Day of the Week, Total Sales Amount by Year

6.21 db 6道: Average Salary: Departments VS Company, Get the Second Most Recent Activity, Tournament Winners, Game Play Analysis V, Find Median Given Frequency of Numbers, Group Sold Products By The Date
       algo 6道: Non-overlapping Intervals, Meeting Rooms II, Task Scheduler, Minimum Number of Arrows to Burst Balloons, Insert Interval, Employee Free Time

6.22 algo 6道: Binary Search, Longest Palindromic Subsequence, Gas Station, Find Smallest Letter Greater Than Target, Peak Index in a Mountain Array, Find Minimum in Rotated Sorted Array
        db 2道: Trips and Users, Exchange Seats

6.23 algo 3道: Find Peak Element, Search in Rotated Sorted Array, Search in Rotated Sorted Array II

6.24 algo 4道: Search a 2D Matrix, Search a 2D Matrix II, Find K Closest Elements, Count of Range Sum

6.26 algo 4道: Minimum Size Subarray Sum, Fruit Into Baskets, Permutation in String, Longest Repeating Character Replacement

6.27 algo 3道: Sliding Window Maximum, Longest Substring Without Repeating Characters, Minimum Window Substring

以下是一些记录截屏~

关于刷题方面,因为我也是第一次刷……可能没太多的经验建议。
database我是从easy到hard做,这个一开始刷可能会有点慢,等刷到一定量的题就有感觉了会越刷越快。
algorithms我是根据不同类别来刷的,比如我的线路是:Arrays→DFS→Backtracking→Dynamic Programming→BFS→Graph→Fast & Slow Pointers→Sliding Window... 这样能更快的熟悉和更好的把握不同类型的题,东一道西一道很容易把自己的思路打乱
更多图片 小图 大图
组图打开中,请稍候......

评分

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

查看全部评分

回复

使用道具 举报

🔗
tanlion 2020-6-29 05:04:36 | 只看该作者
全局:
打卡第十七天:
112,113,437, 1325, 215

1. 学习了双递归,和带返回值的递归。递归确实是另一种形式的循环。
2. 回溯法我还没太研究明白。
3. 开始刷每日一题

Screen Shot 2020-06-28 at 15.59.21.png (70.07 KB, 下载次数: 2)

Screen Shot 2020-06-28 at 15.59.21.png
回复

使用道具 举报

🔗
1988deandean 2020-6-29 03:58:36 | 只看该作者
全局:
周赛做题打卡
  • Path Crossing 用hashset 记录访问过的点
  • Check If Array Pairs Are Divisible by k 维护一个size k的array,记录更新每个元素k 取余以后的counter
  • Number of Subsequences That Satisfy the Given Sum Condition 排序数组,首尾双指针遍历
  • Max Value of Equation 滑动窗口和最大堆栈维护(y -x)

Screen Shot 2020-06-28 at 12.54.18 PM.png (140.42 KB, 下载次数: 2)

Screen Shot 2020-06-28 at 12.54.18 PM.png

评分

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

查看全部评分

回复

使用道具 举报

🔗
ddrttc 2020-6-29 02:37:58 | 只看该作者
全局:
Leet Code 刷题第六天
基本follow的这个帖子顺序:
https://docs.google.com/document ... iew?pru=AAABcwdKyOM*z4WDJ4a7xOWhw7oLijd9vg

今天完成的是Tre:
208. Implement Trie (Prefix Tree)
211. Add and Search Word - Data structure design

总结一下:
1.LC上的题目往往会备注输入的字符在a - z 之间,这样的话就可以产生一个size = 26 的数字来储存当前node的children,这样可以加快代码的运行速度。
2. 当Tre需要处理带有wildcard的输入时,就要考虑搜索的回溯问题。

评分

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

查看全部评分

回复

使用道具 举报

🔗
rockwtr 2020-6-29 02:26:31 | 只看该作者
全局:
Day 6, solved 6 problems.

Tips:
1. For graph problems, need to get familiar with the algorithm under hood: e.g., LC 332;
2. For coordinates manipulation, a Map/Dict could make codes shorter; for duplicate check, use Set: e.g., LC 1496;
3. Fixed sum of pairs, consider Two sum: e.g., LC 1497.

Workspace 1_006.png (69.03 KB, 下载次数: 2)

Workspace 1_006.png
回复

使用道具 举报

🔗
Twinko 2020-6-28 23:55:04 | 只看该作者
全局:
好像刚才没有发出去,再发一次昨天刷的backtracking。。

Screen Shot 2020-06-28 at 10.43.27.png (36.34 KB, 下载次数: 2)

Screen Shot 2020-06-28 at 10.43.27.png

评分

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

查看全部评分

回复

使用道具 举报

🔗
Twinko 2020-6-28 23:45:07 | 只看该作者
全局:
昨天刷的几道backtracking题,发掘了backtrack/DFS和DP的思路

Screen Shot 2020-06-28 at 10.43.27.png (36.34 KB, 下载次数: 2)

Screen Shot 2020-06-28 at 10.43.27.png

评分

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

查看全部评分

回复

使用道具 举报

全局:
本帖最后由 speed_secret20 于 2020-6-28 23:29 编辑
speed_secret20 发表于 2020-6-28 23:27
06.27.2020
打卡第16天,刷题第16天
总结复习8道题
总结:这周主要做了String的题目,对 Compress,decompress还掌握的不够熟练,下周要继续巩固,然后准备扫荡一下DP和DFS两个类型的题目,加油!

评分

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

查看全部评分

回复

使用道具 举报

全局:
06.27.2020
打卡第16天,刷题第16天
总结复习8道题
1. Leetcode:
1275
Find winner on TicTacToe
用n替换3(容易cover到follow up),然后检查四个方向;

2. Leetcode:
1179
reformat department table;
Select ID,
SUM(IF(MONTH = 'JAN', REVENUE, NULL)) AS JAN_REVENUE;
...
SUM(IF(MONTH = 'DEC', REVENUE, NULL)) AS DEC_REVENUE;
From
Department(table name)
Group By
ID


3.Leetcode:
617 Merge Two Binary Tree

Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.

You need to merge them into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwise, the NOT null node will be used as the node of new tree.

recursion;
分左边右边然后分别搞;

core code:
if (t1 == null && t2 == null) {
  return null;
} else if (t1 == null) {
  return t2;
} else if (t2 == null) {
  return t1;
}
//要新建一个root的
TreeNode root = new TreeNode(t1.val + t2.val);
t1.left = mergeTree(t1.left, t1.left);
t1.right = mergeTree(t2.right, t2.right);
return root;
}
就检查一下谁是null谁不是null这样,没啥难的;

https://leetcode.com/problems/merge-two-binary-trees/

4. Ransom Node(int[26] 要是有-1的就不对,没有就算了);
//数组A是否能够装下数组b
//或者反过来也一样
//用一个int[]array就好;

5. Leetcode
1313. Decompress Run-Length Encoded List
We are given a list nums of integers representing a list compressed with run-length encoding.

//mindset:
新建一个new array 然后size 是每个偶数位的总和;
然后再根据原来的array来逐个填充新的array的值

6.Leetcode
443 compress string
      8888个d
aaabccd...dddeef

//还是inplace;
//假设原来给的array足够长就好了


7.Leetcode724. Find Pivot Index
Mindset:用prefix sum搞懂它的物理意义再做题 一定能够把题目有信心的做出来;
//先找everything sum(sum)
//然后再用一个leftSum拿到左边的值
//然后linear scan从左往右分步推进;
//在每一步的过程当中,就需要对leftSum/sum分别更新;
//找到相等return i,最终扫描完了都找不到,就return -1;

8.665 Non-Decreasing Array
Mindset:关键是要现在index对应的这个要小于等于前面的;
然后分两种情况讨论;
1.改变现状的,最简单,容易操作的;
2.改变前一个的,其他的情况(更高的风险,特殊情况才需要改变);
if (nums[i] < nums[i - 1]) {
ct++;
then if ( i < 2 || nums[i - 2] <= nums[i]) {
  nums[i - 1] = nums[i];
} else {
  nums[i] = nums[i - 1];
}
return ct <= 1;
}

评分

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

查看全部评分

回复

使用道具 举报

🔗
fenger8 2020-6-28 21:35:36 | 只看该作者
全局:
感觉有五天咯。。。。。

image.png (29.42 KB, 下载次数: 2)

image.png

评分

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

查看全部评分

回复

使用道具 举报

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

本版积分规则

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