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

[其他] 10月刷题/Mock interview接龙活动(缺米刷题的来)

     关闭
🔗
woshiyizhicha 2020-10-14 00:45:37 | 只看该作者
全局:
10/13
1371 find the longest substring containing vowels in even counts的思路大开眼界了

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

image.png

评分

参与人数 4大米 +4 收起 理由
rockwtr + 1 给你点个赞!
zea7ot + 1 给你点个赞!
biglittlethings + 1 给你点个赞!
Tracy-Cuicui + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
Tracy-Cuicui 2020-10-14 01:22:03 | 只看该作者
全局:
星期二,第九天打卡。Sort List

class Solution {
    // Requirement: sort the linked list in O(n logn) time and using only constant extra space
    // Merge Sort is one of the efficient sorting algorithms
   
    // 1: Divede the problem into subproblems
    // 2: Conque, repeatly solve each subproblem independently and combine the result to form the original problem
    public ListNode sortList(ListNode head) {
        // Check corner case
        if (head == null || head.next == null) {
            return head;
        }
        // Recursively split the original list into two halves. Until only one node left.
        ListNode mid = divide(head);
        // Sort each sublist
        ListNode left = sortList(head);
        ListNode right = sortList(mid);
        // Combine it into a single sorted list
        return merge(left, right);
    }
   
    public ListNode divide(ListNode head) {
        // To split th elist into two halves, find the middle using fast and slow approach
        ListNode midPrev = null;
        while (head != null && head.next != null) {
            if (midPrev == null) {
                midPrev = head;
            }
            else {
                midPrev = midPrev.next;
            }
            head = head.next.next;
        }
        ListNode mid = midPrev.next;
        midPrev.next = null;
        return mid;
    }
   
    public ListNode merge(ListNode l1, ListNode l2) {
        // Sort each sublist and combine it into a single sorted list
        ListNode dummy = new ListNode();
        ListNode tail = dummy;
        while (l1 != null && l2 != null)  {
            if (l1.val < l2.val) {
                tail.next = l1;
                l1 = l1.next;
                tail = tail.next;
            }
            else {
                tail.next = l2;
                l2 = l2.next;
                tail = tail.next;
            }
        }
        if (l1 != null) {
            tail.next = l1;
        }
        else {
            tail.next = l2;
        }
        
        return dummy.next;
    }
}

评分

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

查看全部评分

回复

使用道具 举报

🔗
biglittlethings 2020-10-14 01:44:46 | 只看该作者
全局:
428. Serialize and Deserialize N-ary Tree
297. Serialize and Deserialize Binary Tree
124. Binary Tree Maximum Path Sum
105. Construct Binary Tree from Preorder and Inorder Traversal
106. Construct Binary Tree from Inorder and Postorder Traversal

评分

参与人数 4大米 +7 收起 理由
laonawuli + 3 给你点个赞!
rockwtr + 1 给你点个赞!
titidada + 1 给你点个赞!
zea7ot + 2 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
daining0905 2020-10-14 01:44:48 | 只看该作者
全局:
本帖最后由 daining0905 于 2020-10-14 01:47 编辑

10/13 刷8题7 medium, 1 hard Set Matrix Zeroes, Rotate Image, Generate Parentheses, Container With Most Water, String to Integer (atoi), Longest Palindromic Substring, Median of Two Sorted Arrays, Add Two Numbers
Screen Shot 2020-10-13 at 10.41.39 AM.png.pdf (616.66 KB, 下载次数: 0)



评分

参与人数 4大米 +4 收起 理由
357645829 + 1 给你点个赞!
titidada + 1 给你点个赞!
zea7ot + 1 给你点个赞!
biglittlethings + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
zea7ot 2020-10-14 02:14:56 | 只看该作者
全局:
20201008
3: 0055, 1306
4: 0045, 1143, 1216, 1312, 1458
5:

补交作业

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

image.png

评分

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

查看全部评分

回复

使用道具 举报

🔗
Letitfall 2020-10-14 02:23:39 | 只看该作者
全局:
本帖最后由 Letitfall 于 2020-10-14 02:25 编辑

感恩节长周末 +2题
763. label patition
8. String to Integer

  1. class Solution:
  2. def partitionLabels(self, S: str) -> List[int]:
  3. # store index of letter in a hashtable
  4. # iterate over the list, when the index of current letter equal to the
  5. # index in hashtable, store index to the result
  6. n = len(S)
  7. map = {}
  8. res = []
  9. anchor = 0
  10. cnt = 0
  11. for i in range(n):
  12. map[S[i]] = i
  13. for i in range(n):
  14. cnt += 1
  15. ch = S[i]
  16. anchor = max(anchor, map[ch])
  17. if i == anchor:
  18. res.append(cnt)
  19. cnt = 0
  20. return res
复制代码

[/i][/i]
[i]
  1. class Solution {
  2.     public int myAtoi(String s) {
  3.         int i = 0;
  4.         int sign = 1;
  5.         int result = 0;
  6.         if(s.length() == 0) return 0;
  7.         
  8.         // discard white space
  9.         while(i < s.length() && s.charAt(i) == ' ') i++;
  10.         if(i < s.length() && (s.charAt(i) == '+' || s.charAt(i) == '-')) {
  11.             sign = (s.charAt(i++) == '+') ? 1 : -1;
  12.         }
  13.         while(i < s.length() && s.charAt(i) >= '0' && s.charAt(i) <= '9') {
  14.             if(result > Integer.MAX_VALUE / 10 ||
  15.                (result == Integer.MAX_VALUE / 10 && s.charAt(i) - '0' > Integer.MAX_VALUE % 10)) return (sign == 1) ? Integer.MAX_VALUE : Integer.MIN_VALUE;
  16.         result = result * 10 + (s.charAt(i++) - '0');
  17.         }
  18.         return result * sign;
  19.         
  20.     }
  21. }
复制代码

[/i]

评分

参与人数 4大米 +4 收起 理由
zlydh + 1 给你点个赞!
rockwtr + 1 给你点个赞!
357645829 + 1 给你点个赞!
titidada + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
titidada 2020-10-14 02:38:00 | 只看该作者
全局:
週二加油~~~~~

Screen Shot 2020-10-13 at 11.37.27 AM.png (27.09 KB, 下载次数: 0)

Screen Shot 2020-10-13 at 11.37.27 AM.png

评分

参与人数 4大米 +4 收起 理由
ztamber + 1 给你点个赞!
zlydh + 1 给你点个赞!
rockwtr + 1 禁止公开留微信、邮箱或者拉群
357645829 + 1 很有用的信息!

查看全部评分

回复

使用道具 举报

🔗
357645829 2020-10-14 02:40:52 | 只看该作者
全局:
10/13打卡,今天复习breadth first search还有best first search,希望下午面试不要很难……

Screen Shot 2020-10-13 at 11.39.48 AM.png (115.58 KB, 下载次数: 0)

Screen Shot 2020-10-13 at 11.39.48 AM.png

评分

参与人数 2大米 +2 收起 理由
zlydh + 1 给你点个赞!
rockwtr + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
zlydh 2020-10-14 02:54:33 | 只看该作者
全局:
打卡, Regular Expression Matching, Reverse Integer

评分

参与人数 4大米 +4 收起 理由
EzraYang + 1 给你点个赞!
Millie2020 + 1 赞一个!
ztamber + 1 很有用的信息!
rockwtr + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
飘去了飘来 2020-10-14 03:00:00 | 只看该作者
全局:
xinerbro 发表于 2020-10-13 14:22
继续SQL。。。 另外有没有好的办法提醒那些只回复不给别人加米的。。

想问下lz这是什么网站呀?我也在刷sql
回复

使用道具 举报

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

本版积分规则

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