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

在职刷题打卡

全局:

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

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

x
本帖最后由 中心点 于 2019-4-21 13:41 编辑

刷题大概5个月了 但是才刷了290题 进度有点慢。。发个打卡贴求大米求鼓励!
目标:每天能复习1-2个旧题 + 1-2个没做过的新题

之前发错板块了,新手也不懂怎么挪板块,就重新发到这里。争取每天都来更新!
顺便求加分啊!最近要面试,但积分太少好多面经都看不到、真是好着急啊


评分

参与人数 2大米 +6 收起 理由
xz28us + 5 给你点个赞!
giftofgod + 1 赞一个

查看全部评分


上一篇:有预感公司内部政治斗争站错边了。。。刷题以防万一
下一篇:为什么每天只能刷2,3道??
推荐
 楼主| 中心点 2019-4-21 13:44:58 | 只看该作者
全局:
Add and Search Word - Data structure design。 这个trie的解法竟然只比5%的submissions快,难道可以再优化时间吗?

struct Node{
    bool isWord;
    unordered_map<char, Node*> children;
    Node(){
        isWord = false;
    }
};
class WordDictionary {
public:
    /** Initialize your data structure here. */
    WordDictionary() {
        root = new Node();
    }
   
    /** Adds a word into the data structure. */
    void addWord(string word) {
        Node* dummy = root;
        for(char c: word){
            if(!dummy->children[c])
                dummy->children[c] = new Node();
            dummy = dummy->children[c];
        }
        dummy->isWord = true;
    }
   
    /** Returns if the word is in the data structure. A word could contain the dot character '.' to represent any one letter. */
    bool search(string word) {
        Node* dummy = root;
        return help(word, 0, dummy);
    }
   
    bool help(string &word, int id, Node* root){
        if(!root)
            return false;
        if(id == word.size())
            return root->isWord;
        unordered_map<char, Node*> cur_children = root->children;
        char c = word[id];
        if(c != '.')
            return help(word, id + 1, cur_children[c]);
        for(auto it = cur_children.begin(); it != cur_children.end(); it++){
            if(help(word, id + 1, it->second))
                return true;
        }
        return false;
    }
private:
    Node* root;
};
回复

使用道具 举报

推荐
 楼主| 中心点 2019-8-5 01:15:05 | 只看该作者
全局:
8/3
  • Serialize and Deserialize Binary Tree
  • 670        Maximum Swap
  • 986        nterval List Intersections
  • 489        Robot Room Cleaner
  • 199        Tree right view
  • 76        find the minimum window in S which will contain all the characters in T i
  • 239        Sliding Window Maximum
  • 238        Product of Array Except Self
  • 791        Custom Sort String
  • Trapping Rain Water
  • 224        224. Basic Calculator
  • 227        Basic Calculator II

回复

使用道具 举报

推荐
 楼主| 中心点 2019-6-9 13:12:07 | 只看该作者
全局:
6/8
  • 518        coin change2
  • 469        Convex Polygon
  • 257        Binary Tree Paths: Given a binary tree, return all root-to-leaf paths.
  • 124        Given a non-empty binary tree, find the maximum path sum. Doesn't need to go through the root
  • 103        Binary Tree Zigzag Level Order Traversal
  • 101        Symmetric tree
  • 344        Reverse String
  • 268        Missing Number: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array

回复

使用道具 举报

🔗
 楼主| 中心点 2019-4-12 12:27:45 | 只看该作者
全局:
本帖最后由 中心点 于 2019-4-12 12:59 编辑

4/11:
Ugly number II
Reverse Words in a String
Permutations II. 太久没写这题 竟然几遍才过。。。


回复

使用道具 举报

🔗
 楼主| 中心点 2019-4-13 13:33:37 | 只看该作者

又做一题

全局:
本帖最后由 中心点 于 2019-4-26 14:02 编辑

4/12
  • Restore IP Addresses
  • Wildcard Matchin
  • Wiggle Sort






回复

使用道具 举报

🔗
morty_evlever 2019-4-14 05:03:03 | 只看该作者
全局:
中心点 发表于 2019-4-13 13:33
4/12
1. Restore IP Addresses   2. Wildcard Matchin  3. Wiggle Sort

我最近也在刷,我的leetcode好像才刷了几十题.准备开个帖子,共勉.
回复

使用道具 举报

🔗
 楼主| 中心点 2019-4-14 13:42:05 | 只看该作者
全局:
本帖最后由 中心点 于 2019-4-26 14:02 编辑

4/13
  • Path sum I, II;
  • word search I, II
回复

使用道具 举报

🔗
 楼主| 中心点 2019-4-15 14:30:05 | 只看该作者
全局:
4/14
word search II with Trie
回复

使用道具 举报

🔗
 楼主| 中心点 2019-4-16 11:35:56 | 只看该作者
全局:
本帖最后由 中心点 于 2019-4-26 14:03 编辑

4/15
  • Top K Frequent Words: O(n) time
  • Populating Next Right Pointers in Each Node: O(1) space
  • Binary Tree Paths
  • Best Time to Buy and Sell Stock

回复

使用道具 举报

🔗
 楼主| 中心点 2019-4-17 14:02:24 | 只看该作者
全局:
本帖最后由 中心点 于 2019-4-26 14:03 编辑

4/16
  • Binary Search Tree Iterator 不知道为什么第一感觉是用 queue..
  • Add String
  • Multiply Strings
  • Lowest Common Ancestor of a Binary Search Tree
  • Alien Dictionary


回复

使用道具 举报

🔗
 楼主| 中心点 2019-4-18 13:05:04 | 只看该作者
全局:
本帖最后由 中心点 于 2019-4-26 14:04 编辑

4/17:
  • Merge k Sorted Lists
  • Binary Tree Vertical Order Traversal
回复

使用道具 举报

🔗
 楼主| 中心点 2019-4-19 11:25:17 | 只看该作者
全局:
本帖最后由 中心点 于 2019-4-26 14:04 编辑

4/18
  • Find First and Last Position of Element in Sorted Array
  • Serialize and Deserialize Binary Tree
  • Continuous Subarray Sum




回复

使用道具 举报

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

本版积分规则

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