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

一天十道题,走起!

🔗
 楼主| Algo 2020-4-15 11:08:54 | 只看该作者
全局:
another wasted day
1. all problem by search two sum on LC
2. min path sum - dp
3. path sum

您好!
本帖隐藏的内容需要积分高于 9999 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 9999 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
回复

使用道具 举报

🔗
 楼主| Algo 2020-4-19 23:17:40 | 只看该作者
全局:
写project。。。。
LC contest昨天作出的最后一题
  1. class Solution {
  2.     public int minNumberOfFrogs(String s) {
  3.         if (s == null || s.length() == 0 || !s.startsWith("c")) {
  4.             return -1;
  5.         }

  6.         Map<Character, Integer> indexMap = new HashMap<>();
  7.         indexMap.put('c', 1);
  8.         indexMap.put('r', 2);
  9.         indexMap.put('o', 3);
  10.         indexMap.put('a', 4);
  11.         indexMap.put('k', 5);

  12.         //这个map存的是以这个数字结尾有多少个,<ending character, freqeuency>
  13.         Map<Integer, Integer> map = new HashMap<>();

  14.         //the map store the ending char, and number of the same ending char.
  15.         //for each char, if not a continous sequence
  16.         int res = 0;
  17.         for (char c : s.toCharArray()) {
  18.             int curCharInt = indexMap.get(c);
  19.             int prevCharInt = curCharInt - 1;
  20.             if (c == 'c') {
  21.                 map.put(curCharInt, map.getOrDefault(curCharInt, 0) + 1);
  22.                 continue;
  23.             }
  24.             if (!map.containsKey(prevCharInt)) {
  25.                 return -1;
  26.             }
  27.             map.putIfAbsent(curCharInt, 0); // init r
  28.             map.put(curCharInt, map.getOrDefault(curCharInt, 0) + 1); //and update r
  29.             map.put(prevCharInt, map.getOrDefault(prevCharInt, 0) - 1); //dec freq c
  30.             
  31.             if (map.get(prevCharInt) == 0) { //freq = 0,remove
  32.                 map.remove(prevCharInt);
  33.             }
  34.             
  35.             int tmp = 0;
  36.             for (int key : map.keySet()) {
  37.                 tmp += map.get(key); //看看现在开了多少分支
  38.             }

  39.            if (curCharInt == 5) { //croak一个系列已经完成, remove避免重复count
  40.                map.remove(curCharInt);
  41.            }

  42.             res = Math.max(res, tmp);
  43.         }

  44.         for (int key : map.keySet()) {
  45.             if (key != 5) {
  46.                 return -1;
  47.             }
  48.         }
  49.         
  50.         return res;
  51.     }
  52. }

复制代码
回复

使用道具 举报

全局:
我看了一下群主的刷题进度 很适合我们的组织 有兴趣可以加我
回复

使用道具 举报

🔗
 楼主| Algo 2020-4-22 04:52:28 | 只看该作者
全局:
path sum
first-time interactive problem:   Leftmost Column with at Least a One
829. Consecutive Numbers Sum
build tree from traversal: inorder + postorder/preorder,       postorder + preorder?????马上做
334. Increasing Triplet Subsequence O(1)time/space, if require to output index, use extra O(n) space, and still O(n) time

回复

使用道具 举报

🔗
 楼主| Algo 2020-4-24 07:26:06 | 只看该作者
全局:
这周不打卡了,期末大作业写不完了,我干嘛要选这么难的课
回复

使用道具 举报

🔗
wangdiao01 2020-4-24 12:38:23 | 只看该作者
全局:
楼主的每天10道题还在坚持吗?
and intel实习好像没取消啊,楼主这么积极的刷题是为了啥。。
回复

使用道具 举报

🔗
madan000 2020-4-24 13:22:13 | 只看该作者
全局:
楼主好有干劲。。加油加油
回复

使用道具 举报

🔗
 楼主| Algo 2020-5-1 12:29:43 | 只看该作者
全局:
复习tree + 终于自己会做backtrack的题目了
回复

使用道具 举报

🔗
 楼主| Algo 2020-5-10 06:35:43 | 只看该作者
全局:
Generate Parentheses       
Letter Combinations of a Phon
Permutations
Regular Expression Match
Combination sum
Sudoku Solver
path sum2
jump game2
word search - 傻了还想用bfs
subset
回复

使用道具 举报

🔗
 楼主| Algo 2020-5-11 07:24:33 | 只看该作者
全局:
n queen
next permutation
kth permutation
restore ip address
sqrt - binary search (forget about newton )
剩下晚上在刷把
  Find the Town Judge
frog jump
...
回复

使用道具 举报

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

本版积分规则

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