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

转型刷Leetcode记录帖

🔗
 楼主| Lyuan 2018-10-20 17:41:12 | 只看该作者
全局:
double heap的套路295+480

- 10/19
    - 532E. K-diff Pairs in an Array
        - hash
    - 295H. Find Median from Data Stream
        - double heap
    - 480H. Sliding Window Median
        - a lazy remove heap design
    - 826M. Most Profit Assigning Work
        - binsearch. {buggy} notice lower cost might have higher reward
    - 901M. Online Stock Span
        - stack
    - 100E. 100. Same Tree
        - simple recursion
    - 451M. Sort Characters By Frequency
        - hash
回复

使用道具 举报

🔗
 楼主| Lyuan 2018-10-22 04:34:44 | 只看该作者
全局:
周赛终于进了一把100

- 10/20
        - 928H. Minimize Malware Spread II
        - Dfs
    - 927H. Three Equal Parts
        - constructive
    - 926M. Flip String to Monotone Increasing
        - Prefix
    - 925E. Long Pressed Name
        - two pointers
    - 336H. Palindrome Pairs
        - Trie+Palidorme
回复

使用道具 举报

🔗
 楼主| Lyuan 2018-10-25 15:58:17 | 只看该作者
全局:
沉了有点久,目前在整理一些模板和经典算法。明天面一个startup,也开始约起G家的电面。

- 10/22~10/23
    - 363H. Max Sum of Rectangle No Larger Than K
        - {DNF}. Binary search Tree
    - 471H. Encode String with Shortest Length
        - {DNF} recrusive. Cannot do that bottom to top.
    - 727H. Minimum Window Subsequence
        - DP. {buggy} `min` is slower than `else`
    - 702M. Search in a Sorted Array of Unknown Size
        - Bin search
    - 215M. Kth Largest Element in an Array
        - quick select
回复

使用道具 举报

🔗
 楼主| Lyuan 2018-10-27 01:56:13 | 只看该作者
全局:
面了下tusimple,由于第一次电面太紧张了,自己原来的做法没想出来。但是面试官很好人,最后在提示下写出来了。


- 10/25
    - new:
        - 4H. Median of Two Sorted Arrays
            - binsearch. estimate the final state and binary search the answer
    - review:
        - 863M. All Nodes Distance K in Binary Tree
            - recursion. make use of the return
        - 307M. Range Sum Query - Mutable
            - BIT. SegTree
        - 285M. Inorder Successor in BST
            - Morris. BST property
        - 205E. Isomorphic Strings
            - hash
回复

使用道具 举报

🔗
 楼主| Lyuan 2018-10-27 12:18:25 | 只看该作者
全局:
刷题刷题刷题

- 10/26
    - google:
        - 297H. Serialize and Deserialize Binary Tree
            - encoding
        - 31M. Next Permutation
            - imple
        - 139M. Word Break
            - Trie.
            - dp with hash.
        - 253M. Meeting Rooms II
            - heap.
        - 17M. Letter Combinations of a Phone Number
            - dfs
        - 23H. Merge k Sorted Lists
            - heap
        - 10H. {buggy} Regular Expression Matching
            - mem+dfs
            - bugs:
                - p_pos < m when s_pos >= n
                - s_pos>=n, cannot read s[s_pos]
                - check equality when *
                - check s_pos < n when star == False
        - 56M. Merge Intervals
            - greedy
        - 42H. Trapping Rain Water
            - prefix-sum. S(N)=O(N)
            - two pointers
        - 20E. Valid Parentheses
            - stack
        - 200M. Number of Islands
            - flood fill.
            - -followup: partition, union-find set
        - 4H. Median of Two Sorted Arrays
            - binsearch
        - 146H. LRU Cache
            - dbl link list+hash
        - 253M. Meeting Rooms II
            - heap
回复

使用道具 举报

🔗
 楼主| Lyuan 2018-10-29 16:06:18 | 只看该作者
全局:
27的周赛最后一题做过类似的,但是当时没有想出构造方法,可惜了。这种比较没有规律的构造题很考验脑洞。
28继续刷lc上google的list,打算先刷完这些然后刷面经。

- 10/28
    - google:
        - 341M. Flatten Nested List Iterator
            - recursion. prefetch.
        - 239H. Sliding Window Maximum
            - deque. only maintain necessary elements.
        - 535M. Encode and Decode TinyURL
            - relevant hash (compression) vs irrelevant hash (key gen). System Design
        - 155E. Min Stack
            - stack
        - 224H. Basic Calculator
            - {buggy} imple
        - 128H. Longest Consecutive Sequence
            - hashing
        - 50M. Pow(x, n)
            - imple
        - 173M. Binary Search Tree Iterator
            - generator
            - manual stack
        - 289M. Game of Life
            - mix information with different bits
        - 54M. Spiral Matrix
            - imple
            - oneline (recursive)
        - 22M. Generate Parentheses
            - dfs
- 10/27
    - Weekly contest
        - 932M. Beautiful Array
            - {DNF}. constructive answer
        - 931M. Minimum Falling Path Sum
            - DP.
        - 930M. Binary Subarrays With Sum
            - imple
            - three pointer solution with O(1) space
        - 929E. Unique Email Addresses
            - hash
回复

使用道具 举报

🔗
 楼主| Lyuan 2018-10-31 17:15:54 | 只看该作者
全局:
leetcode 336对Ptyton有剧毒,Trie+KMP写了几个小时都没过。很影响刷题节奏
406的nlogn做法很巧妙。
315和406似乎揭示了某个规律?就是除非题目是有很浓重的segtree色彩(dynamic insert/query),要不然divide-and-conquer就能解决许多segtree的问题。
merge:
关键就是(1)队列拥有的性质(2)merge的优先级,也就是两个队首先选哪个。
这里的优先级有点类似贪心,通常可以用反证法来证明其正确性(如果不这样选,会违背xx性质)
是一个divide and conquer的思路
segtree:
技巧在于怎么利用logn的sum/min/max去解决原问题
segtree通常来说是一个一个元素处理的,处理完一个就update区间,然后处理下一个

PS: 个人觉得还是比较喜欢divide and conquer,segtree有点太暴力,用久了segtree人会变傻


- 10/29+10/30
    - 735M. Asteroid Collision
        - stack
    - google
        - 406M. Queue Reconstruction by Height
            - sort and insert: O(N^2)
            - {DNF} O(Nlogn): modified merge-sort
            - {DNF} segtree?
        - 140H. Word Break II
            - DP
        - 315H. Count of Smaller Numbers After Self
            - divide and conquer
            - bit
        - 240M. Search a 2D Matrix II
            - grid divide and conquer
        - 295H. Find Median from Data Stream
            - double heap
        - 312H. Burst Balloons
            - rangeDP
        - 387E. First Unique Character in a String
            - hash
回复

使用道具 举报

🔗
 楼主| Lyuan 2018-11-2 01:04:09 | 只看该作者
全局:
很多stack都可以变成Hard

- 10/31
    - 231E. Power of Two
        - imple. corner cases
    - 345E. Reverse Vowels of a String
        - imple
    - 421M. Maximum XOR of Two Numbers in an Array
        - Trie
    - 448M. Find All Numbers Disappeared in an Array
        - use negation as hash
    - 657E. Robot Return to Origin
        - imple
    - 316H. Remove Duplicate Letters
        - hashset + recursion
        - {DNF} stack
    - 280M. Wiggle Sort
        - imple
    - 228M. Summary Ranges
        - imple
    - 463E. Island Perimeter
        - imple
    - 832E. Flipping an Image
        - imple
    - 208M. Implement Trie (Prefix Tree)
        - Trie
    - 66E. Plus One
        - imple
    - 218H. The Skyline Problem
        - {buggy} overlapped boundary. merge
    - 162M. Find Peak Element
        - binary search
    - 739M Daily Temperatures
        - stack
回复

使用道具 举报

🔗
nerve90 2018-11-2 10:01:06 | 只看该作者
全局:
楼主很强!👍

评分

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

查看全部评分

回复

使用道具 举报

🔗
 楼主| Lyuan 2018-11-3 16:36:57 | 只看该作者
全局:
843这种脑洞题,还是蛮有趣的
开始稳定1pass一些Medium+Hard,加油加油


- 11/01~11/02
    - 857H. Minimum Cost to Hire K Workers
        - sort, heap
    - 853M. Car Fleet
        - greedy, sort
    - 855M. Exam Room
        - heap (override comparator `__lt__`)
    - 489H. Robot Room Cleaner
        - recursive
    - 498M. Diagonal Traverse
        - shifting
    - 890M. Find and Replace Pattern
        - mapping equality
    - 843M. Guess the Word
        - {DNF} Good problem. creative question.
    - 62M. Unique Paths
        - simple DP
    - 685H. Redundant Connection II
        - two in degree
    - 684M. Redundant Connection
        - union find set
    - 399M. Evaluate Division
        - DFS
    - 760E. Find Anagram Mappings
        - hash
    - 326E. Power of Three
        - mod trick
    - 388M. Longest Absolute File Path
        - stack
回复

使用道具 举报

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

本版积分规则

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