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

学习记录贴

🔗
 楼主| Cabbage1123 2022-5-17 14:54:16 | 只看该作者
全局:
2022.05.16

LC 953. 验证外星语词典
这道题需要按照给定的顺序确定排序顺序,总体而言还是挺好的。看代码吧。
  1. class Solution {
  2. public:
  3.     int ord[26];

  4.     bool compare(string word1, string word2) {
  5.         int n1 = word1.size(), n2 = word2.size();
  6.         for(int i = 0; i < n1 && i < n2; i++) {
  7.             if(ord[word1[i] - 'a'] - ord[word2[i] - 'a'] > 0) { // 如果相应位置的字母,前一个word比后一个word大,那就返回false
  8.                 return false;
  9.             } else if(ord[word1[i] - 'a'] - ord[word2[i] - 'a'] < 0) { // 否则的话,前一个word必比后一个word小,那就返回true
  10.                 return true;
  11.             }
  12.         }
  13.         // 如果前面的字符比较都相同,前一个word比后一个word要长,则返回 false
  14.         if(n1 > n2) {
  15.             return false;
  16.         }
  17.         return true;
  18.     }
  19.     bool isAlienSorted(vector<string>& words, string order) {
  20.         for(int i = 0; i < order.size(); i++) {
  21.             ord[order[i] - 'a'] = i;
  22.         }
  23.         int n = words.size();
  24.         for(int i = 0; i < n - 1; i++) {
  25.             if(!compare(words[i], words[i + 1])) {
  26.                 return false;
  27.             }
  28.         }
  29.         return true;
  30.     }
  31. };
复制代码
此外今天是开学第一天,文学课的workload成功理科大木头,最终除了专业课之外只选了一门粤语。希望可以过啊。
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2022-5-18 15:34:05 | 只看该作者
全局:
本帖最后由 Cabbage1123 于 2022-5-18 01:01 编辑

2022.05.17
今天的主要学习内容为:配置UBC CPEN 522的assignment 环境。
课程官网为:https://gsathish.notion.site/gsa ... 204a0ec296531124d44
之前以为这门课会讲讲单元测试啊之类的(没错就是觉得这门课应该挺水的),结果今天一看发现事情并不简单,可能要学习编译原理相关的知识。对于助教手下留情的情况下只考了七十多的我来讲这实在是有点难啊。
不过在配置环境的时候发现还是挺好玩的,与其说是 software testing 我更倾向于现在配置的环境可以用于 software security,因为配置了 klee 和 afl++。在配置的时候还发现本科膜拜的大佬为 afl++ 的 release 贡献了代码,属实被震惊到了。xxlsyyds!!!!!!
在这里还想分享一个 afl++ 的入门级应用案例,链接在这里:https://blog.51cto.com/u_15060461/4538688
为什么有官方 tutorial 还要找其他的呢,因为官方网站上 tutorial 板块的排版不忍直视,根本无从下手啦哈哈。
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2022-5-25 14:56:50 | 只看该作者
全局:
2022.05.24
今天的software testing主要学了Intermediate representations(IR)。

IR的几个重要属性是:
1. Ease of generation
2. Ease of manipulation
3. Procedure size
4. Freedom of expression
5. Level of abstraction
就目前的学习来看感觉abstraction比较重要?我也不清楚,反正sdn里abstraction是挺重要的。

IR 有三种表示:
1. Stuctural(Trees, DAGs)
2. Linear(3 address code, Stack machine code)
3. Hybrid(SSA form, Control-flow graph(cfg))

除此之外有两种 memory model,分别是 register-to-register model 和 memory-to-memory model,注意 register 和 memory 都是计算机组成中的概念。

下午的时候学了学 sdn,主要是其发展沿革,感觉 sdn 这个东西主要还是因为要实现 cdc technology 而实现的技术,也不知道 571n 这门课的 course project 到底要实现个啥hhh,拭目以待。

LC 打卡 965, 296。296 值得注意的是找中位数的方法,可以用双指针。
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2022-6-13 00:18:22 | 只看该作者
全局:
2022.06.12
这个帖子真的是...玄学打卡啦。

LC 890. 查找和替换模式
本质是创建 word 和 pattern 之间的双射,所以如何创建双射?
1. 创建两个字符串数组,p1[word] = index, p2[index] = word,然后比较这两个数组对于同一个字母,p1 和 p2 的值是否相同。
2. 哈希表,对于每一个字符串,创建一个 hashmap(主要问题在于这题没必要用哈希表,因为元素只包含字母)

最近在学广东话,并领悟真理:语言类就应该多说!如果一门语言不用,那和没学没啥差别。
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2022-6-14 13:36:54 | 只看该作者
全局:
2022.06.13
LC 427. 建立四叉树
其实按照递归建树的方法就可以,不解释。
  1. /*
  2. // Definition for a QuadTree node.
  3. class Node {
  4.     public boolean val;
  5.     public boolean isLeaf;
  6.     public Node topLeft;
  7.     public Node topRight;
  8.     public Node bottomLeft;
  9.     public Node bottomRight;

  10.    
  11.     public Node() {
  12.         this.val = false;
  13.         this.isLeaf = false;
  14.         this.topLeft = null;
  15.         this.topRight = null;
  16.         this.bottomLeft = null;
  17.         this.bottomRight = null;
  18.     }
  19.    
  20.     public Node(boolean val, boolean isLeaf) {
  21.         this.val = val;
  22.         this.isLeaf = isLeaf;
  23.         this.topLeft = null;
  24.         this.topRight = null;
  25.         this.bottomLeft = null;
  26.         this.bottomRight = null;
  27.     }
  28.    
  29.     public Node(boolean val, boolean isLeaf, Node topLeft, Node topRight, Node bottomLeft, Node bottomRight) {
  30.         this.val = val;
  31.         this.isLeaf = isLeaf;
  32.         this.topLeft = topLeft;
  33.         this.topRight = topRight;
  34.         this.bottomLeft = bottomLeft;
  35.         this.bottomRight = bottomRight;
  36.     }
  37. };
  38. */

  39. class Solution {

  40.     public Node quadTree(int[][] grid, int x, int y, int offset) {
  41.         if (offset <= 0) {
  42.             return null;
  43.         }

  44.         for (int i = x; i < x + offset; i++) {
  45.             for (int j = y; j < y + offset; j++) {
  46.                 if (grid[i][j] != grid[x][y]) {
  47.                     return new Node((grid[x][y] == 0 ? false : true), false,
  48.                     quadTree(grid, x, y, offset / 2),
  49.                     quadTree(grid, x, y + offset / 2, offset / 2),
  50.                     quadTree(grid, x + offset / 2, y, offset / 2),
  51.                     quadTree(grid, x + offset / 2, y + offset / 2, offset / 2));
  52.                 }
  53.             }
  54.         }
  55.         return new Node((grid[x][y] == 0 ? false : true), true, null, null, null, null);
  56.     }

  57.     public Node construct(int[][] grid) {
  58.         return quadTree(grid, 0, 0, grid.length);
  59.     }
  60. }
复制代码
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2022-6-15 15:00:33 | 只看该作者
全局:
2022.06.14

今天也是十分忙碌的一天,值得一提的是上了三节课就已经累到不行,于是睡觉睡了很久。
查了一下可能是?心脏病+糖尿病风险?吓死姐了。平时多注意吧没得办法。

另外被唐诗逸圈粉~太美了美若天仙我要被掰弯了~
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2022-6-19 13:13:05 | 只看该作者
全局:
2022.06.18

因为每天学的东西很杂,难以一言蔽之,在下又是个懒人,所以此帖永久停更。
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2023-4-10 05:27:22 | 只看该作者
全局:
2023.04.09
算了,重新开这个帖子,用来监督一下学习。
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2023-5-26 11:46:27 | 只看该作者
全局:
最近打算开始读《Clean Code》开个坑记录一下~
回复

使用道具 举报

🔗
 楼主| Cabbage1123 2023-11-22 15:41:17 | 只看该作者
全局:
本帖最后由 Cabbage1123 于 2023-11-21 23:45 编辑

看起来这个帖子跟凉了没啥区别哇哈哈哈哈哈!!!!
这半年太忙太忙了,每天都在忙,但是每天都不知道在干点啥。。。哈哈哈!
实在是不能这么浑浑噩噩了,人总是要有点理想!!!!
有的时候我在想,其实一直当个摸鱼的L4也挺好的23333 摆烂了有一年多了现在就是个废柴哈哈但是 I don't care ~
生活还是要开心一些~

重开这个帖子,2023年虽然要过完了,也没啥长进,但是23年的最后一个月我要有所进步!!!!(主要是12月应该没啥班要加了,要加也加不动了累!)

12月目标:看会儿网课,复习一下基础知识。

基础知识
书籍:<Operating Systems: Three Easy Pieces> 没错我买了好多英文原版哇嘎嘎嘎嘎嘎!!!!!!
网课:MIT 6.828
AC:看完所有网课,书本看完,完成所有作业。

Rust语言
书籍:
1. <Rust for rustaceans>
2. <Rust in Action>
3. <Programming Rust>
网课:Jon Gjengset 的 Crust of Rust 系列
AC:网课看完,书本看完,网课和书上的代码照着敲一遍。

Leetcode
AC: 100道 hard

System Design
书籍:
1.  Alex Xu 的 <System Design Interview: Volume 2>
2. <Designing Data-Intensive Applications>
3. <Distribute Systems>
网课:Gaurav Sen 的视频。
AC: 书本看完并且做第一遍笔记,网课看完。



Unity
网课:两个Udemy的网课
AC: Deliver 两个 Unity 游戏。



其他
1. 看10个快餐式学习视频。
2. 课外书:《精油之美》,《香水圣经》,《精油化学》全部看完。
3. 10个Ted视频,做笔记。




感觉自己像极了Manager,总是制定不切实际的目标哈哈。不过Let's see!
回复

使用道具 举报

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

本版积分规则

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