里面有一些雷军的讲话很有道理,值得学习。
摘录几条在下面自己经常看看。
1. 计算机搞懂精髓以后,所有的东西都很简单。计算机不是一门理论性很强的学科,强调的是实践。
2. 雷军的工作任务是按半小时来定的,当时雷军有一个笔记本记着每半小时干了什么。“如果浪费了半小时时间,我就觉得很惭愧。后来我看到很多人不珍惜时间的时候,我就觉得这样的人真没出息。时间是自己的,你到一个公司打工的时候,偷懒,老板没有看见,就觉得自己又蒙了一下,玩猫和老鼠的游戏,真是没有必要。公司所付的那么一点钱,就买下了你一个月的青春?学会的东西首先是自己的,其次才是公司的。没有多少人真正计算过自己一个小时值多少钱。”
3. 最让雷军佩服的程序员是现在中文之星的核心程序员陈波。“他写程序全是在上班时间,他每天按时上班按时下班,从不加班,但上班时间他时间利用率很高,连水都不喝,女朋友的电话都是中午去接。像这样的人就是为写程序而生的,就像李昌镐是为下棋而生的一样。”
4. 雷军承认自己写程序不如陈波。“我有杂念,而真正第一流的程序员是没有杂念的。我曾经72小时不睡觉连续写程序,但这有什么了不起呢?别人也可以三天三夜在麻将桌上不下来,难的是早上8点钟开始打牌,打到12点,下午1点再开始打,打到下午5点,这样一直坚持一年。”
5. 写了这么多年程序,雷军感触最深的有两点:第一,程序不仅仅是核心程序员的,同时也应该是用户和同事参与完成的,所以,功劳应该属于大家,不能把光环套在一个人头上;第二,程序员要有方便别人,麻烦自己的精神。因为,程序员花两天改进的一个小模块,就有可能会省却了用户数以百万计的麻烦。雷军最烦听到有程序员对他讲,程序改起来太麻烦,这个小错误凑合算了的话。“程序员发现自己的程序中有一个小小bug没有改,就应该睡不着觉。”
6. 在雷军看来,公司里面一个人干一个半人的工作最理想。“一个人干一个人工作的公司是不行的,在这么激烈的竞争中,无法降低成本;一个人干两个人的工作,人员没有任何冗余,任何一个人走,都会对公司结构造成致命的损失,组织不能够安全运行。”
另外从文章里看到,雷军是一个很能表达的人,不光是说,而且文章也写的好。所以可以看出,交流,表达能力是非常非常重要的。
Thursday, May 17, 2018
Wednesday, April 5, 2017
Amazon
Leetcode 146 LRU Cache
Leetcode 403 Frog Jump
Leetcode 403 Frog Jump
Tuesday, January 31, 2017
K closest points
Find the K closest points to the origin in a 2D plane, given an array containing N points.
Method1, use a priority queue. Because it takes constant time to retrieve the smallest one always.
Method1, use a priority queue. Because it takes constant time to retrieve the smallest one always.
/*
public class Point {
public int x;
public int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
*/
public List<Point> findKClosest(Point[] p, int k) {
PriorityQueue<Point> pq = new PriorityQueue<>(10, new Comparator<Point>() {
@Override
public int compare(Point a, Point b) {
return (b.x * b.x + b.y * b.y) - (a.x * a.x + a.y * a.y);
}
});
for (int i = 0; i < p.length; i++) {
if (i < k)
pq.offer(p[i]);
else {
Point temp = pq.peek();
if ((p[i].x * p[i].x + p[i].y * p[i].y) - (temp.x * temp.x + temp.y * temp.y) < 0) {
pq.poll();
pq.offer(p[i]);
}
}
}
List<Point> x = new ArrayList<>();
while (!pq.isEmpty())
x.add(pq.poll());
return x;
}
Max points on a line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
public int maxPoints(Point[] points) {
if(points == null || points.length == 0) return 0;
HashMap<Double, Integer> result = new HashMap<Double, Integer>();
int max=0;
for(int i=0; i<points.length; i++){
int duplicate = 1;//
int vertical = 0;
for(int j=i+1; j < points.length; j++){
//handle duplicates and vertical
if(points[i].x == points[j].x){
if(points[i].y == points[j].y){
duplicate++;
}else{
vertical++;
}
}else{
double slope = points[j].y == points[i].y ? 0.0
: (1.0 * (points[j].y - points[i].y))
/ (points[j].x - points[i].x);
if(result.get(slope) != null){
result.put(slope, result.get(slope) + 1);
}else{
result.put(slope, 1);
}
}
}
for(Integer count: result.values()){
if(count+duplicate > max){
max = count+duplicate;
}
}
max = Math.max(vertical + duplicate, max);
result.clear();
}
return max;
}
Wednesday, December 7, 2016
Scala - 1. Setup
Need:
1. JDK 1.8
2. Scala Build Tool (sbt), version 0.13x
3. IDE. Scala IDE for Eclipse or Intellij IDEA
1. JDK 1.8
Install JDK and set PATH of the bin direcotry
Check version: java -version
2. sbt
Install sbt.
Check version: sbt about
Compile and run: sbt
then run
3. Intellij IDEA
Install community edition.
Install Scala plugin.
go to Configure → Project defaults → Project structure and add the JDK
To use it, click Create New Project on the Welcome Screen, then select Scala, and finally SBT Project.
1. JDK 1.8
2. Scala Build Tool (sbt), version 0.13x
3. IDE. Scala IDE for Eclipse or Intellij IDEA
1. JDK 1.8
Install JDK and set PATH of the bin direcotry
Check version: java -version
2. sbt
Install sbt.
Check version: sbt about
Compile and run: sbt
then run
3. Intellij IDEA
Install community edition.
Install Scala plugin.
go to Configure → Project defaults → Project structure and add the JDK
To use it, click Create New Project on the Welcome Screen, then select Scala, and finally SBT Project.
Tuesday, October 11, 2016
Friday, September 30, 2016
Selenium Learning Notes
Selenium IDE
Working and Handling multiple windows
storeTitle i
openWindow
selectWindow
selectWindow ${i}
close i
close
Selenium Webdriver
Working and Handling multiple windows
storeTitle i
openWindow
selectWindow
selectWindow ${i}
close i
close
Selenium Webdriver
Subscribe to:
Posts (Atom)