📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
楼主: smilelin
跳转到指定楼层
上一主题 下一主题
收起左侧

[其他] 九月刷题给米接龙活动(小伙伴们冲冲冲)

   关闭
全局:
9.8 打卡 三道题保个底,勤能补拙,举一反三的基础是那个一得熟练。。。

评分

参与人数 3大米 +3 收起 理由
cyx20180512 + 1 给你点个赞!
ztamber + 1 给你点个赞!
yguozhen90 + 1 赞一个

查看全部评分

回复

使用道具 举报

全局:
【刷题汇报】9/8 3题 #19 #160 #206
今天发现一个对于integer 只能直接比较-128到127
大于这个范围要用equals()方法

评分

参与人数 4大米 +4 收起 理由
okaytobenot + 1 给你点个赞!
hlbt + 1 给你点个赞!
cyx20180512 + 1 给你点个赞!
ztamber + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
ztamber 2020-9-9 05:24:13 | 只看该作者
全局:
打卡
Flatten Binary Tree to Linked List
remove linked list element
Moving Average from Data Stream
Sum of Root To Leaf Binary Numbers

评分

参与人数 3大米 +3 收起 理由
二月的逆流 + 1 给你点个赞!
hlbt + 1 给你点个赞!
cyx20180512 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
cyx20180512 2020-9-9 05:46:14 | 只看该作者
全局:
9.8打卡
做了7道题,都是有关Linked List,最近在总结Linked List
要注意及时断链,和NPE

评分

参与人数 3大米 +3 收起 理由
okaytobenot + 1 给你点个赞!
二月的逆流 + 1 给你点个赞!
hlbt + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
fourteen_ljw 2020-9-9 05:58:38 | 只看该作者
全局:
9.8日, 刷了4道题

image.png (44.25 KB, 下载次数: 0)

image.png

评分

参与人数 3大米 +3 收起 理由
okaytobenot + 1 给你点个赞!
二月的逆流 + 1 给你点个赞!
hlbt + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
hlbt 2020-9-9 06:14:54 | 只看该作者
全局:
1 DP + 3 topological sort

评分

参与人数 3大米 +3 收起 理由
okaytobenot + 1 给你点个赞!
titidada + 1 给你点个赞!
二月的逆流 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

全局:
9/8 继续打卡,今日4题

Capture.PNG (45.76 KB, 下载次数: 0)

Capture.PNG

评分

参与人数 4大米 +4 收起 理由
okaytobenot + 1 给你点个赞!
GibbsEnsemble + 1 给你点个赞!
titidada + 1 给你点个赞!
ann要加油啊 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
okaytobenot 2020-9-9 07:06:21 | 只看该作者
全局:
day4  复习2道hard,3道medium,好累,加油, 米不够了,晚会过来补加!
Compress String II
Decompress String II
Longest Substring Without Repeating Characters
All Anagrams
Longest subarray contains only 1s

评分

参与人数 4大米 +4 收起 理由
JLSeagull + 1 给你点个赞!
GibbsEnsemble + 1 给你点个赞!
titidada + 1 给你点个赞!
ann要加油啊 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

全局:
9月8,
38Count and Say
except for the 1st is number 1, the rest of n(s) are count and say, which are not pure number, but the way to say the number, so for n is bigger than 1, we loop the whole int and count how many same numbers and so on:
var countAndSay = function(n) {
    if (n === 1) { return '1'; }
    let prev = '1';
    for (let i = 2; i <= n; i++) {
        let item = '', cur = prev[0], cnt = 0, j = 0;
        while (j < prev.length) {
            while (j < prev.length && cur === prev[j]) { cnt++; j++; }
            item += cnt + cur;
            cur = prev[j];
            cnt = 0;
        }
        prev = item        
    }
    return prev;
};
39Combination Sum:
var combinationSum = function(candidates, target) {
    // we don't need to consider numbers > target
    const sorted = candidates.filter(e => e <= target).sort((a,b) => a-b);
    const results = [];
    const helper = (arr, sum, i) => {
        if (i >= sorted.length || sum + sorted[i] > target) {
            return;
        }
        const arrIfTake = [...arr, sorted[i]];
        const sumIfTake = sum + sorted[i];
        if (sumIfTake === target) {
            results.push(arrIfTake);
            return;
        }
        // take, we have the option of taking again
        helper(arrIfTake, sumIfTake, i);
        // leave, we no longer need to consider this number
        helper(arr, sum, i+1);
    }  
    // start with empty array, 0 sum, index 0
    helper([], 0, 0);
    return results;
};
40Combination Sum II:
var combinationSum2 = function(candidates, target) {
    // we don't need to consider numbers > target
    const c = candidates.filter(e => e <= target).sort((a,b) => a-b);
    let res = [];
    helper(target, [], 0);
    function helper(need, tmp, start) {
        if(need === 0) {
            res.push(tmp.slice());
        } else {
            for(var i=start; i<c.length; i++) {
                if(c[i] > need) continue;
                if(i > start && c[i-1] == c[i]) continue;
                tmp.push(c[i]);
                helper(need-c[i], tmp, i+1);
                tmp.pop();
            }
        }
    }
    return res;
};

评分

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

查看全部评分

回复

使用道具 举报

🔗
titidada 2020-9-9 08:34:07 | 只看该作者
全局:
練習一下heap

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

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

评分

参与人数 3大米 +4 收起 理由
TimLee + 2 给你点个赞!
JLSeagull + 1 给你点个赞!
GibbsEnsemble + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

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

本版积分规则

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