0%

🏆leetcode

记录leetcode中的题目🤡
在此文件中更新🧐

Read more »

若执行ssh-add /path/to/xxx.pem是出现这个错误:Could not open a connection to your authentication agent,则先执行如下命令即可:
  ssh-agent bash
然后执行ssh-add xxx.pem
如果出现ssh “permissions are too open” error,则执行chmod命令修改xx.pem文件权限
chmod 400 ~/.ssh/id_rsa 或者 chmod 600 ~/.ssh/id_rsa

Read more »

修改ECS开机逻辑问题记录

修改原因

之前的ECS开机在enqueue阶段实现。逻辑为:如果作业是pending状态,并且作业所需的资源大于集群的空闲资源。这个时候就为该任务开启一台ECS节点。
假设作业所需的资源为R1,目前集群的空闲资源为R2,在之前的逻辑中会选择一个资源为R3的ECS节点,使得R3 + R2 >= R1。这样就出现了一个问题,我们的想法是使得作业能在新开启的节点上运行的(目前只考虑单机作业), 即新开启的ECS必须满足R3 >= R1, 这样看来,之前的开机逻辑是存在问题的,在实际中我们也碰到了这种情况。
所以我们需要将ECS开机逻辑进行更改。

Read more »

STL-C++

本文是关于c++中STL库中的一些记录,主要是因为之前在网上找到关于STL的资料太过简洁,并且只停留在如何使用函数,对于底层具体实现较少,所以想自己对这些知识记录一下,当然我目前对STL库了解也不深入,以后如果会有新的了解的话,会继续更新。

vector

vector定义

1
2
3
4
5
6
7
8
9
10
11
12
template<class _Ty,
class _Ax>
class vector
: public _Vector_val<_Ty, _Ax>
{ // varying size array of values
public:
/********/
protected:
pointer _Myfirst; // pointer to beginning of array
pointer _Mylast; // pointer to current end of sequence
pointer _Myend; // pointer to end of array
};
Read more »

最近状态很低迷,效率底下,也反思了最近自己的不足。在这里记录一下,一年后再来比较,希望自己能改变不足

不足

抗拒写文档

不管是对于code前的设计文档,或者是code完成之后的总结,对一些知识的总结,内心总会有一种抗拒心里,不愿意去写。

Read more »

其实最近一直有刷题,但是因为题目都比较简单的原因并没有贴到博客上。这样做是因为感觉之前的状态有点像是在为了努力而努力,没有想清楚自己真正想干什么。
最近也一直在思考以后想要做什么,大概率是分布式存储,分布式系统相关的底层架构了。
写这篇博客另一方面也是想激励一下自己,不要再继续颓废下去了,应该想清楚自己该做什么,并且自己应该怎么调节一下自己的心态,让自己不受其他人的影响,尤其是不要跟一些垃圾人多辩解,没有一点好处。
纸上得来终觉浅,绝知此事要躬行,从大佬博客中看到了这句话,一瞬间突然发现自己目前的状态缺了什么,code,多多实践,写一些小项目来更深刻的理解一下。
我想成为什么样?
希望自己能够不焦虑的去努力,一步一步朝着目标前进。
希望自己能够自律,减少耗费在手机与游戏上的时间。
努力吧。

A:Yet Another Dividing into Teams

题目:

You are a coach of a group consisting of 𝑛 students. The 𝑖-th student has programming skill 𝑎𝑖. All students have distinct programming skills. You want to divide them into teams in such a way that:

No two students 𝑖 and 𝑗 such that |𝑎𝑖−𝑎𝑗|=1 belong to the same team (i.e. skills of each pair of students in the same team have the difference strictly greater than 1);
the number of teams is the minimum possible.
You have to answer 𝑞 independent queries.

Read more »

A: Integer Points

题目:

DLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew 𝑛 distinct lines, given by equations 𝑦=𝑥+𝑝𝑖 for some distinct 𝑝1,𝑝2,…,𝑝𝑛.

Then JLS drew on the same paper sheet 𝑚 distinct lines given by equations 𝑦=−𝑥+𝑞𝑖 for some distinct 𝑞1,𝑞2,…,𝑞𝑚.

DLS and JLS are interested in counting how many line pairs have integer intersection points, i.e. points with both coordinates that are integers. Unfortunately, the lesson will end up soon, so DLS and JLS are asking for your help.

Read more »