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

刷题打卡贴

🔗
 楼主| sly-- 2019-12-19 05:49:58 | 只看该作者
全局:
python 217 Contains Duplicate
set(list) O(n)

242. Valid Anagram
The question means the two words have the same components but not orders.
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-20 09:50:20 | 只看该作者
全局:
sql 1294. Weather Type in Each Country

178. Rank Scores

python 13. Roman to Integer
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-21 03:36:44 | 只看该作者
全局:
sql 574. Winning Candidate

180. Consecutive Numbers
don't filter variable in the subquery u assign values but name alias

python 122. Best Time to Buy and Sell Stock II

don't think too complicately. If the second day is higher than previous one, then sell and then buy  and add up the whole transaction
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-22 06:33:44 | 只看该作者
全局:
python Excel Sheet Column Number
actually calculate hex so subtitute 10 with 26

sql 578. Get Highest Answer Rate Question
get the highest rate

1132. Reported Posts II
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-23 04:11:38 | 只看该作者
全局:
python 387. First Unique Character in a String
class Solution:
    def firstUniqChar(self, s: str) -> int:
        c = collections.Counter(s)
        for idx, ch in enumerate(s):
            if c[ch] == 1:
                return idx
        return -1

sql 184. Department Highest Salary
SELECT d.name as Department, e.name as Employee, Salary
FROM employee e join department d on e.departmentid = d.id
WHERE (departmentid, salary) in (SELECT departmentid, max(salary)
     FROM employee
     GROUP BY 1)
   177. Nth Highest Salary
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-25 06:26:49 | 只看该作者
全局:
python 371. Sum of Two Integers

sql 614. Second Degree Follower
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-27 02:01:07 | 只看该作者
全局:
sql. 1194. Tournament Winners
we can also leverage a trick based on how MySQL handles aggregates when sql_mode=only_full_group_by is disabled (which is the case in leetcode). MySQL simple picks the first item in a row when a column is in the SELECT clause but not the GROUP BY clause. Other databases would throw an error. Therefore we can simply get the players' scores (ps) like we did in Solution 1 along with the group_id of each player by joining the subquery with the Players table. Then order them to make sure the first item of each group is what we are looking for

1225. Report Contiguous Dates


python 21. Merge Two Sorted Lists
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-27 14:25:36 | 只看该作者
全局:
python 350. Intersection of Two Arrays II
how should i handle duplicates?
use hash map to get each nums' values' frequency and then use built in intersection operation to get the overlaping values.
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-29 08:06:58 | 只看该作者
全局:
sql 1097. Game Play Analysis V

python         268        Missing Number   
回复

使用道具 举报

🔗
 楼主| sly-- 2019-12-31 11:47:02 | 只看该作者
全局:
118. Pascal's Triangle
first extend the original list, then shorten the list for calculation

121       
Best Time to Buy and Sell Stock   

SQL 1303. Find the Team Size

1098. Unpopular Books
in the join clause don't use between use datediff
回复

使用道具 举报

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

本版积分规则

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