Competent man

Competent man

A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyse a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. — Robert Heinlein, Time Enough for Love


清华学堂 - 计算机科学实验班、人工智能班 - 课程表

一年级

计算机应用数学

任课教师: 姚期智

该课程面向计算机科学本科专业介绍基本数学技巧,以及这些技巧怎样在计算机科学中应用。现代计算机科学教育需要学生掌握宽阔的数学知识,并能灵活和创新地解决现在和将来的科技挑战。在该课程中,数学技巧主要涵括代数、几何、概率理论,随机模型、信息理论等。这些技巧将应用于不同专题的问题和算法设计,包括互联网、无线传感网、密码学、分布式系统、算法设计和优化等。最后,该课程向学生介绍在计算理论基础方面深层次的科学问题,如不可解性、复杂性和量子计算

人工智能应用数学

任课教师: 姚期智

该课程面向人工智能本科专业介绍基本数学技巧,以及这些技巧怎样在人工智能中应用。人工智能和多学科有紧密联系。因此一个完整的人工智能专业教育需要学生掌握宽阔的数学知识,并能灵活和创新地解决现在和将来的科技挑战。在该课程中,数学技巧主要涵括线性代数、高维几何、统计推断,数学优化,信息理论等。这些技巧将应用于不同专题的问题和算法设计,包括机器学习、大数据,遥感压缩、贝叶斯网络、计算生物和自然语言等。最后, 该课程向学生介绍在计算理论基础方面深层次的科学问题,如复杂性和量子人工智能

普通物理(1)英

任课教师: 马雄峰

该课程是面向大一年级物理专业或对物理有极大兴趣的学生的课程。要求学生具有微积分基础,学生要积极参与到课堂授课中,并能发现问题并提出问题。该课程给学生提供了一个很好的机会来获得一个对物理基本方法热力学的理解,而且了解如何在物理以及其他领域去运用该物理学知识。

抽象代数

任课教师: 邓东灵

抽象代数研究群、环、域等的基本代数结构。它不仅是现代数学的基础,在其他学科领域包括计算机科学,物理学,化学等也有着非常广泛和极为重要的应用。本课程将学习群、环、域的基本理论。主要内容包括子群、群的作用、Sylow定理、同态与同构、同态基本定理、柯西定理、有限生成群的基本定理;多项式环、商环、理想、中国剩余定理,欧几里得整环;主理想整环、唯一因子分解整环;域的扩张、代数扩张、分裂域、代数基本定理、伽罗瓦理论等。最后,本课程还将介绍基本的格理论布尔代数理论

因果和统计学习

任课教师: 于洋

数据技术的蓬勃兴起是二十一世纪最重要的技术进步。为什么数据驱动的方法能够很好的预测、甚至推断因果关系呢?这是数据科学领域最核心也最受人关注的研究问题。本课程将教授学生用于分析这一核心问题的整体性框架。该框架完成于2000年代,涉及统计推断、统计学习、计量经济学、贝叶斯因果网络结构理论等多学科的理论、技术和观点。阐述数据驱动的模型能够完成预测和因果推断的理论、机制和方法。本课程将通过着重阐述不同学科的骨干理论网络和学科间衔接枢纽式理论和技术(包括CEF定理、统计学习的几何功能等),培养学生跨学科视野的形成和学科交叉融合能力。同时,本课程将精选和课程内容紧扣的前沿文献,引导学生阅读和联想,从而培养学生将所学和前沿研究相关联的能力,启发其创新力和批判力。本课程可作为一系列课程的前导课程,包括了概率论、统计学、机器学习、人工智能理论等。

二年级

量子计算机科学

任课教师: 段路明

此课程主要教授学生量子计算机科学的基本知识,从而将学生带向量子计算机研究的前沿,课程不要求学生预先学习量子理论。课程主要内容包括:量子理论框架;量子纠缠理论:纠缠概念、判据、与度量,多体量子纠缠态,量子隐形传态与贝尔不等式等量子计算机模型与复杂性理论;量子算法:包括量子大数分解,量子搜索,量子线性方程算法,量子机器学习等;量子纠错、容错量子计算、拓扑量子计算;量子计算机的物理实现,包括离子与超导量子计算。经过该课程,学生能够掌握量子计算机科学的基本概念与方法,了解各研究方向的发展动态。

计算理论

任课教师: 段然

本课程介绍计算理论的基础知识,包括有穷自动机理论,正则语言,下推自动机,上下文无关文法,图灵机等,以及可计算性,计算难解性(NP完全性,PSPACE,BPP等)专题。

计算机系统结构

任课教师: 高鸣宇

本课程讲授现代计算机系统结构,主要研究计算机硬件和软件接口及系统内部组成方式。课程将讨论计算机系统中的主要硬件结构和常用设计技术,包括系统性能效率指标、指令格式和指令集、处理器结构、存储层次、输入输出设备、以及专用硬件技术。课程从计算机整体系统的角度,以各组成部分的功能和交互为核心,抽象底层实现细节,展示如何通过理解硬件结构来优化软件性能和效率。同时鉴于并行计算和专用计算的广泛应用,课程将在基本内容之上进一步讨论现代计算机系统对并行化技术和专用硬件技术的支持以作为拓展内容。课程也将简要介绍计算机系统结构领域最新研究方向的进展。课程实验将涉及程序汇编分析及优化、处理器流水线仿真、缓存功能实现等。通过本课程的学习,学生将理解系统中各个组成部分的基本概念、主要功能和交互方式,学习计算机系统的分析方法和设计原理,并初步体会系统性能、效率与成本之间的权衡关系。

密码学基础

任课教师: 陈一镭

本课程的主要目的是介绍现代密码学的一些基本概念。与数字内容分布有关的两个主要问题是信息的隐秘性和数据来源。在简短介绍代数之后,将会在现代私钥和公钥加密的背景下讨论隐私问题及其解决方案。之后将回顾一下使用散列函数数字签名来实现数字内容认证的一些工具。其中所提出的结构是建立设计安全系统和实际应用协议。同时,本课程也将涉及加密方案和协议的攻击和安全分析等内容。

计算机视觉

任课教师: 高阳

本课程介绍计算机视觉的基础以及高级的内容,从基础的成像原理、图像处理,到近期的特征提取、三维视觉,以及 最近有较大突破的深度学习、图像识别、物体检测等知识。本课程注重基础知识,同时也涉及最新的技术。希望在打好基础的同时,也让同学们对计算机视觉产生浓厚的兴趣。

深度学习

任课教师: 吴翼

深度学习是现代人工智能领域的核心技术之一,也是在大数据时代下处理海量数据的基本工具。本课程旨在从建模和算法的角度,全面的介绍深度学习的基本思想,方法和技术,并通过课程作业和项目实践将深度学习技术应用到具体问题中。课程内容涵盖监督学习,生成模型,序列模型,非监督学习,元学习,安全性与可解释性等。

博弈论

任课教师: 房智轩

本课程建议学生掌握线性代数基础知识及微积分基本技巧,但不是硬性要求。本课程拟介绍相关材料并培养学生的数学技巧。本课程是博弈论入门课程,拟从博弈论基础知识着手。课程将介绍纳什均衡等重要概念,旨在引导学生学习演化博弈论、博弈图等更为复杂的课题。

自动驾驶

任课教师: 楼天城

本课程覆盖自动驾驶的整体技术路线和主要模块的设计及算法,包括:1、绪论:自动驾驶系统的整体架构,自动驾驶产业的发展现状与展望;2、硬件:传感器(多传感器融合),计算硬件,GPS硬件; 3、感知:计算机视觉技术与深度学习;4、地图:道路信息,以及静态元素进行高清三维建模;5、定位:基于差分全球导航卫星系统和计算机视觉的定位;6、决策规划:全局最优路径选择,局部运动轨迹规划;7、控制:使用反馈控制机制操纵车辆准确实现驾驶动作;8、系统架构与模拟系统:系统可靠性,稳定性和实时性,包括实际道路和仿真环境中的测试。

三年级

分布式与区块链系统

任课教师: 周冬,房智轩

本课程讲授分布式系统与区块链的基础概念、机制、算法与原理。具体内容包括分布式系统的时钟、通讯等机制;分布式系统的共识机制;比特币的基本原理;矿池机制;网络通讯;支付网络等。课程将覆盖分布式系统与区块链系统的基本原理与设计思想,系统地介绍相关系统中被广泛应用的算法与技术。此外,课程还结合最新的科研、应用进展,将当前分布式、区块链系统中的实际挑战以专题的形式进行细化讨论,介绍其背景、难点以及相关技术方案。

多媒体计算

任课教师: 赵行

随着互联网的发展,多媒体数据已经变得唾手可得,如图像,音频,视频,文本等;近十年的人工神经网络的进展也让这些数据的处理变得越来越容易。本课程涉及的应用领域包括图像和视频处理、声音和语音处理、自然语 言处理等。课程旨在介绍人工智能领域中常见的媒体的信号处理和机器学习方法,如数据表征,数据压缩,频域变换,卷积神经网络,序列模型,数据合成,多模态融合等。课程通过理论教学与项目实践,让学生了解不同数据与信号的特性,处理方式,以及共通与交叉融合之处。该课程可作为计算机视觉,自然语言处理等课程的前置课程。

四年级

综合论文训练

任课教师: 徐葳

本课程采用导师与学生一对一指导的形式,通过对当今计算机学科的最前沿问题或基础理论问题的研究,使学生学会如何着手开展科研工作,培养提出、分析与解决问题的能力,加强学生从事论文(研究)工作的书面和口头表达能力,以及协调组织能力。通过本环节的训练,学生应对计算机学科的科研工作有较全面的了解,并具有开展科学研究或研发工作的能力。论文题目在导师的指导下通过前期文献调研后确定。本课程要求学生在期末提交研究论文并进行口头报告和答辩,由多名教师组成的答辩委员会根据论文工作的质量和答辩的情况给出成绩。本课程要求学生至少将一篇有关的外文文献译成中文。


The science of snowflakes - Maruša Brada - TED-Ed - Transcript

If you ever find yourself gazing at falling snow, why not catch a few snowflakes on your glove and examine their shapes? You might notice that they look symmetrical, and if you look closely, you’ll see they have six sides. You could say a snowflake is simply frozen water, but compare one with an ice cube from the freezer, and you’ll realize they’re very different things. Unlike ice cubes, formed when liquid freezes into a solid, snowflakes form when water vapor turns straight into ice. But that still doesn’t explain why snowflakes have six sides. To understand that, we need to delve deeper into the physics of water. Water is made out of two hydrogen atoms and one oxygen atom. A single water molecule thus has ten protons and ten electrons, eight from oxygen and one from each hydrogen atom. The two electrons from oxygen’s outer shell are shared with two electrons from both hydrogens as they bond together, and the remaining four outer shell electrons from oxygen form two pairs. We call the bonds between these atoms covalent bonds. The pairs of electrons are all negatively charged. Similar charges repel, so they tend to stay as far away from each other as possible. The pairs form four electron clouds, two of which are where the hydrogen and oxygen share electrons. The repulsion between the unbonded pairs is even stronger than repulsion between the shared pairs, so the two hydrogens get pushed a little further to an angle of 104.5 degrees. The water molecule as a whole is electrically neutral, but oxygen gets a larger share of electrons, making it slightly negative and the hydrogens slightly positive. Due to its negative charge, the oxygen in one molecule is attracted to the positive charge of the hydrogen in another molecule. And so a weak bond between the two molecules, called a hydrogen bond, is formed. When water freezes, this bonding occurs on repeat, ultimately forming a hexagonal structure due to the angle between hydrogens and oxygen within each molecule. This is the seed of a snowflake, and it retains a hexagonal shape as it grows. As the snowflake moves through the air, water vapor molecules stick to the six sharp edges and expand the snowflake outwards, bit by bit. A snowflake’s developing shape depends on atmospheric conditions, like humidity and temperature. As a snowflake falls, changes in weather conditions can affect how it grows, and even small differences in the paths two snowflakes take will differentiate their shapes. However, since conditions at the six sharp edges of one snowflake are similar, a symmetric snowflake can grow. Weather conditions affect snow on the ground, as well. Warmer ground temperatures produce a wetter snow that is easier to pack because liquid water molecules help snowflakes stick to each other. Melted snow also plays a critical role in another wintry activity, skiing. Completely dry snow is very difficult to ski on because there’s too much friction between the jagged snowflakes and the ski surface. So what’s happening is that as skis move, they rub the surface of the snow and warm it up, creating a thin layer of water, which helps them slide along. So technically, it’s not really snow skiing, but water skiing. But it is true that no matter how hard you look, you’re almost definitely not going to find two identical snowflakes, and that’s a mystery that scientists are still trying to solve, though we know that it has to do with the many possible branching points in snowflake formation, and the differences in temperature and humidity, and while we wait for the answer, we can enjoy watching these tiny fractals falling from the sky.

Snow-Flakes

by Henry Wadsworth Longfellow

Out of the bosom of the Air,
Out of the cloud-folds of her garments shaken,
Over the woodlands brown and bare,
Over the harvest-fields forsaken,
Silent, and soft, and slow
Descends the snow.

Even as our cloudy fancies take
Suddenly shape in some divine expression,
Even as the troubled heart doth make
In the white countenance confession,
The troubled sky reveals
The grief it feels.

This is the poem of the air,
Slowly in silent syllables recorded;
This is the secret of despair,
Long in its cloudy bosom hoarded,
Now whispered and revealed
To wood and field.


【repost】In the Time of Pandemic

© In the Time of Pandemic

by Kitty O’Meara

And the people stayed home.

And they listened, and read books, and rested, and exercised, and made art, and played games, and learned new ways of being, and were still.

And they listened more deeply. Some meditated, some prayed, some danced. Some met their shadows. And the people began to think differently.

And the people healed.

And, in the absence of people living in ignorant, dangerous, and heartless ways, the earth began to heal.

And when the danger passed, and the people joined together again, they grieved their losses, and made new choices, and dreamed new images, and created new ways to live and heal the earth fully, as they had been healed.


© Copyright of all visual and written materials on The Daily Round belongs solely to Catherine M. O’Meara, 2011-Present. Unauthorized use is strictly prohibited, without Catherine O’Meara’s written approval. No one is authorized to use Catherine O’Meara’s copyrighted material for material gain without the author’s engagement and written permission. All other visual, written, and linked materials are credited to their authors.


LeetCode - Algorithms - 1275. Find Winner on a Tic Tac Toe Game

Problem

1275. Find Winner on a Tic Tac Toe Game

Tic-tac-toe

Java

my solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class Solution {
public String tictactoe(int[][] moves) {
final int len = moves.length;
List<int[]> listX = new ArrayList<int[]>();
List<int[]> listO = new ArrayList<int[]>();
for (int i = 0; i < len; i++) {
if (i % 2 == 0)
listX.add(moves[i]);
else
listO.add(moves[i]);
}
String r = "";
if (hasWin(listX))
r = "A";
else if (hasWin(listO))
r = "B";
else if (len == 9)
r = "Draw";
else
r = "Pending";
return r;
}

private boolean realContain(List<int[]> list, int[][] arr) {
boolean b = true;
for (int i = 0; i < arr.length; i++) {
boolean b2 = false;
for (int j = 0; j < list.size(); j++) {
b2 = b2 || ((arr[i][0] == list.get(j)[0]) && (arr[i][1] == list.get(j)[1]));
}
b = b && b2;
}
return b;
}

private boolean hasWin(List<int[]> list) {
int[][] a1 = {{0, 0},{0, 1},{0, 2}};
int[][] a2 = {{1, 0},{1, 1},{1, 2}};
int[][] a3 = {{2, 0},{2, 1},{2, 2}};
int[][] a4 = {{0, 0},{1, 0},{2, 0}};
int[][] a5 = {{0, 1},{1, 1},{2, 1}};
int[][] a6 = {{0, 2},{1, 2},{2, 2}};
int[][] a7 = {{0, 0},{1, 1},{2, 2}};
int[][] a8 = {{0, 2},{1, 1},{2, 0}};
boolean r = realContain(list, a1) || realContain(list, a2) || realContain(list, a3)
|| realContain(list, a4) || realContain(list, a5) || realContain(list, a6)
|| realContain(list, a7) || realContain(list, a8);
return r;
}
}

Submission Detail

  • 100 / 100 test cases passed.
  • Runtime: 2 ms, faster than 8.21% of Java online submissions for Find Winner on a Tic Tac Toe Game.
  • Memory Usage: 38.9 MB, less than 6.40% of Java online submissions for Find Winner on a Tic Tac Toe Game.

The Death of the Moth

by Virginia Woolf

Moths that fly by day are not properly to be called moths; they do not excite that pleasant sense of dark autumn nights and ivy-blossom which the commonest yellow-underwing asleep in the shadow of the curtain never fails to rouse in us. They are hybrid creatures, neither gay like butterflies nor sombre like their own species. Nevertheless the present specimen, with his narrow hay-coloured wings, fringed with a tassel of the same colour, seemed to be content with life. It was a pleasant morning, mid-September, mild, benignant, yet with a keener breath than that of the summer months. The plough was already scoring the field opposite the window, and where the share had been, the earth was pressed flat and gleamed with moisture. Such vigour came rolling in from the fields and the down beyond that it was difficult to keep the eyes strictly turned upon the book. The rooks too were keeping one of their annual festivities; soaring round the tree tops until it looked as if a vast net with thousands of black knots in it had been cast up into the air; which, after a few moments sank slowly down upon the trees until every twig seemed to have a knot at the end of it. Then, suddenly, the net would be thrown into the air again in a wider circle this time, with the utmost clamour and vociferation, as though to be thrown into the air and settle slowly down upon the tree tops were a tremendously exciting experience.

The same energy which inspired the rooks, the ploughmen, the horses, and even, it seemed, the lean bare-backed downs, sent the moth fluttering from side to side of his square of the window-pane. One could not help watching him. One was, indeed, conscious of a queer feeling of pity for him. The possibilities of pleasure seemed that morning so enormous and so various that to have only a moth’s part in life, and a day moth’s at that, appeared a hard fate, and his zest in enjoying his meagre opportunities to the full, pathetic. He flew vigorously to one corner of his compartment, and, after waiting there a second, flew across to the other. What remained for him but to fly to a third corner and then to a fourth? That was all he could do, in spite of the size of the downs, the width of the sky, the far-off smoke of houses, and the romantic voice, now and then, of a steamer out at sea. What he could do he did. Watching him, it seemed as if a fibre, very thin but pure, of the enormous energy of the world had been thrust into his frail and diminutive body. As often as he crossed the pane, I could fancy that a thread of vital light became visible. He was little or nothing but life.

Yet, because he was so small, and so simple a form of the energy that was rolling in at the open window and driving its way through so many narrow and intricate corridors in my own brain and in those of other human beings, there was something marvellous as well as pathetic about him. It was as if someone had taken a tiny bead of pure life and decking it as lightly as possible with down and feathers, had set it dancing and zig-zagging to show us the true nature of life. Thus displayed one could not get over the strangeness of it. One is apt to forget all about life, seeing it humped and bossed and garnished and cumbered so that it has to move with the greatest circumspection and dignity. Again, the thought of all that life might have been had he been born in any other shape caused one to view his simple activities with a kind of pity.

After a time, tired by his dancing apparently, he settled on the window ledge in the sun, and, the queer spectacle being at an end, I forgot about him. Then, looking up, my eye was caught by him. He was trying to resume his dancing, but seemed either so stiff or so awkward that he could only flutter to the bottom of the window-pane; and when he tried to fly across it he failed. Being intent on other matters I watched these futile attempts for a time without thinking, unconsciously waiting for him to resume his flight, as one waits for a machine, that has stopped momentarily, to start again without considering the reason of its failure. After perhaps a seventh attempt he slipped from the wooden ledge and fell, fluttering his wings, on to his back on the window sill. The helplessness of his attitude roused me. It flashed upon me that he was in difficulties; he could no longer raise himself; his legs struggled vainly. But, as I stretched out a pencil, meaning to help him to right himself, it came over me that the failure and awkwardness were the approach of death. I laid the pencil down again.

The legs agitated themselves once more. I looked as if for the enemy against which he struggled. I looked out of doors. What had happened there? Presumably it was midday, and work in the fields had stopped. Stillness and quiet had replaced the previous animation. The birds had taken themselves off to feed in the brooks. The horses stood still. Yet the power was there all the same, massed outside indifferent, impersonal, not attending to anything in particular. Somehow it was opposed to the little hay-coloured moth. It was useless to try to do anything. One could only watch the extraordinary efforts made by those tiny legs against an oncoming doom which could, had it chosen, have submerged an entire city, not merely a city, but masses of human beings; nothing, I knew, had any chance against death. Nevertheless after a pause of exhaustion the legs fluttered again. It was superb this last protest, and so frantic that he succeeded at last in righting himself. One’s sympathies, of course, were all on the side of life. Also, when there was nobody to care or to know, this gigantic effort on the part of an insignificant little moth, against a power of such magnitude, to retain what no one else valued or desired to keep, moved one strangely. Again, somehow, one saw life, a pure bead. I lifted the pencil again, useless though I knew it to be. But even as I did so, the unmistakable tokens of death showed themselves. The body relaxed, and instantly grew stiff. The struggle was over. The insignificant little creature now knew death. As I looked at the dead moth, this minute wayside triumph of so great a force over so mean an antagonist filled me with wonder. Just as life had been strange a few minutes before, so death was now as strange. The moth having righted himself now lay most decently and uncomplainingly composed. O yes, he seemed to say, death is stronger than I am.


  • The Death of the Moth, and Other Essays
  • Woolf battled mental illnesses throughout her life, and eventually committed suicide by drowning herself in 1941, a year before this essay was published.
  • Virginia Woolf, after a vain effort imagining how Shakespeare “coined his words,” writes in her diary: Indeed, I could say that Shakespeare surpasses literature altogether, if I knew what it meant. (Shakespeare, Newton, and Beethoven: Or, Patterns of Creativity, by Subrahmanyan Chandrasekhar)

Rules Kids Won’t Learn in School

  1. Life is not fair. Get used to it.

  2. The real world won’t care as much about your self-esteem as much as your school does. It’ll expect you to accomplish something before you feel good about yourself.

  3. Sorry, you won’t make $40,000 a year right out of high school. And you won’t be a vice president or have a car phone either. You may even have to wear a uniform that doesn’t have a Gap label.

  4. If you think your teacher is tough, wait till you get a boss. He doesn’t have tenure, so he tends to be a bit edgier. When you screw up, he’s not going to ask you how you feel about it.

  5. Flipping burgers is not beneath your dignity. Your grandparents had a different word for burger flipping. They called it opportunity. They weren’t embarrassed making minimum wage either. They would have been embarrassed to sit around talking about Kurt Cobain all weekend.

  6. It’s not your parents’ fault. If you screw up, you are responsible. This is the flip side of “It’s my life,” and “You’re not the boss of me,” and other eloquent proclamations of your generation. When you turn 18, it’s on your dime. Don’t whine about it, or you’ll sound like a baby boomer.

  7. Before you were born your parents weren’t as boring as they are now. They got that way paying your bills, cleaning up your room and listening to you tell them how idealistic you are. And by the way, before you save the rain forest from the blood-sucking parasites of your parents’ generation, try delousing the closet in your bedroom.

  8. Your school may have done away with winners and losers. Life has not. In some schools, they’ll give you as many times as you want to get the right answer. Failing grades have been abolished and class valedictorians scrapped, lest anyone’s feelings be hurt. Effort is as important as results. This, of course, bears not the slightest resemblance to anything in real life.

  9. Life is not divided into semesters, and you don’t get summers off. Not even Easter break. They expect you to show up every day. For eight hours. And you don’t get a new life every 10 weeks. It just goes on and on. While we’re at it, very few jobs are interested in fostering your self-expression or helping you find yourself. Fewer still lead to self-realization.

  10. Television is not real life. Your life is not a sitcom. Your problems will not all be solved in 30 minutes, minus time for commercials. In real life, people actually have to leave the coffee shop to go to jobs. Your friends will not be as perky or pliable as Jennifer Aniston.

  11. Be nice to nerds. You may end up working for them. We all could.

  12. Smoking does not make you look cool. It makes you look moronic. Next time you’re out cruising, watch an 11-year-old with a butt in his mouth. That’s what you look like to anyone over 20. Ditto for “expressing yourself” with purple hair and/or pierced body parts.

  13. You are not immortal. (See Rule No. 12.) If you are under the impression that living fast, dying young and leaving a beautiful corpse is romantic, you obviously haven’t seen one of your peers at room temperature lately.

  14. Enjoy this while you can. Sure parents are a pain, school’s a bother, and life is depressing. But someday you’ll realize how wonderful it was to be a kid. Maybe you should start now. You’re welcome.


This list was the work of Charlie Sykes, author of the 1996 book Dumbing Down Our Kids: Why American Children Feel Good About Themselves But Can’t Read, Write, Or Add. Sykes’ rule list form the meat of Sykes’ 2007 book, 50 Rules Kids Won’t Learn in School: Real-World Antidotes to Feel-Good Education.


LeetCode - Algorithms - 1492. The kth Factor of n

Problem

1492. The kth Factor of n

Java

simple

© https://leetcode.com/problems/the-kth-factor-of-n/discuss/993800/Java-100-Fast-or-Easy-Solution

1
2
3
4
5
6
7
8
9
10
11
12
class Solution {
public int kthFactor(int n, int k) {
int count = 0;
for (int i = 1; i <= n; i++) {
if (n % i == 0)
count++;
if (count == k)
return i;
}
return -1;
}
}

Submission Detail

  • 207 / 207 test cases passed.
  • Runtime: 1 ms, faster than 43.12% of Java online submissions for The kth Factor of n.
  • Memory Usage: 35.5 MB, less than 90.14% of Java online submissions for The kth Factor of n.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.ArrayList;
import java.util.List;

class Solution {
public int kthFactor(int n, int k) {
List<Integer> list = new ArrayList<Integer>();
for (int i = 1; i <= n; i++) {
if (n % i == 0)
list.add(i);
}
if (list.size() < k)
return -1;
else
return list.get(k-1);
}
}

Submission Detail

  • 207 / 207 test cases passed.
  • Runtime: 1 ms, faster than 43.15% of Java online submissions for The kth Factor of n.
  • Memory Usage: 35.8 MB, less than 48.68% of Java online submissions for The kth Factor of n.

Canadian English Slangs & Phrases

Canadian English is in some ways midway between British and American varieties. The written standard is very close to that of British English, but American spellings are quite common. Informal speech has a distinctly American flavour and pronunciation is fairly close to that of the northern United states. Canadian vocabulary naturally includes words reflecting the local environment and culture, many of them taken from the native American languages spoken in Canada: for instance husky, moose, toboggan, anorak, kayak. French, the mother tongue of around one third of Canadians, has also given words to Canadian English vocabulary, e.g. cache(a hiding place). — Michael Swan, Practical English Usage, Fourth Edition

© Moving To Canada? Here Are 75 Canadian English Slangs & Phrases You Must Know

Are You Hungry?

Double Double

an oversized cup of coffee with 2 creams and 2 sugars

homo milk

homogenised/whole milk

Tim Hortons’ Timbits

bite-sized fried-dough confectionery similar to American doughnuts but uniquely Canadian (they’ve been around since the 70s!)

serviettes

paper napkins

A napkin, serviette or face towelette is a rectangle of cloth used at the table for wiping the mouth and fingers while eating. It is usually small and folded, sometimes in intricate designs and shapes.

icing sugar

Powdered sugar, also called confectioners’ sugar, 10X sugar or icing sugar, is a finely ground sugar produced by milling granulated sugar into a powdered state.

two four

Canadian informal a box containing 24 bottles of beer

a case of 24 beers – cans or bottles

Mickey

A half-sized non-EU Standard Liquor Bottle, considered a US metric “pint”. Called a mickey in Canada. -> Alcohol measurements

A 13-ounce bottle of hard alcohol (give or take)

chocolate bars

A chocolate bar (Commonwealth English) or candy bar (some dialects of American English) is a confection containing chocolate, which may also contain layerings or mixtures that include nuts, fruit, caramel, nougat, and wafers. A wide variety of chocolate bar brands are sold. A popular example is a Snickers bar, which consists of nougat mixed with caramel and peanuts, covered in milk chocolate.

Chocolate candy

Molson muscle

beer belly

Kraft Dinner (or KD!)

The product known as Kraft Dinner (KD) in Canada, Kraft Macaroni & Cheese Dinner or Kraft Mac & Cheese in the United States and Australia, and Macaroni Cheese or Cheesey Pasta in the United Kingdom is a nonperishable, packaged dry macaroni and cheese product by Kraft Foods, traditionally cardboard-boxed with dried macaroni pasta and a packet of processed cheese powder. It was first introduced under the Kraft Dinner name simultaneously in both Canada and the U.S. in 1937.

macaroni-and-cheese

freezie

A freezie (Canada), freeze pop (United States), zooper-dooper, juice pop, freezer pop, otter pop, ice-pole, pop stick, icy-pole (Australia), ice pop, popsicle, tip top, lolly (UK), marciano or chupps (Peru), chihiro (Cayman Islands), ice candy (Philippines, Japan), chup-chup, sacolé, geladinho, gelinho, dindim (Brazil), or ais batu Malaysia(Malaysia) is a water-based frozen confection. It is made by freezing flavored liquid such as sugar water, fruit juice or purée inside a plastic casing or tube, either round or flat.

freeze (ice) pop

dépanneur

A convenience store, convenience shop, or corner store is a small retail business that stocks a range of everyday items such as coffee, groceries, snack foods, confectionery, soft drinks, tobacco products, over-the-counter drugs, toiletries, newspapers, and magazines.

A convenience store may also be called a c-store[citation needed], cold store, party store (Michigan), bodega, tienda de barrio (Latin America), carry out, mini-market, mini-mart, konbini (Japan), corner shop, deli or milk bar (Australia), dairy (New Zealand), superette (New Zealand and parts of USA), corner store (many part of English-speaking Canada and New England) depanneur or dep (the last two are loanwords from the French term used in parts of Canada).

convenience store

Rotten Ronnie’s

McDonald’s

booze can

illegal after-hours bar

Caesar

cocktail (not a salad!) similar to a Bloody Mary but made with clamato juice

Clamato juice

clam and tomato juice

poutine

French fries (thin potato chips) covered with cheese curds and gravy

Tortière/tourtière

Meat pie

beavertail/whale’s tail

fried pastry dough smothered in toppings like Nutella chocolate spread

Nanaimo bar

multilayered brownie with icing

Butter tart

Sweet pastry shell tart with a filling of butter, sugar, syrup and egg, baked to get a semi-solid filling and crunchy top

Peameal bacon

Wet-cured, un-smoked back bacon made from trimmed lean boneless pork loin and rolled in cornmeal

Bumbleberry pie

Mixed berry pie (there is no such berry as a bumbleberry!)

Mind Your Habits & Manners!

Canadian tuxedo

informal outfit consisting of a blue denim jacket and blue jeans

Pop

carbonated soft drink/soda

Washroom

Bathroom, restroom, toilet

Queue

Lineup

Tap

faucet

Canuck

Canadian person

kerfuffle

commotion, fuss or disagreement

keener

brown-noser, sycophant

beauty

exceptionally great person

Life’s Good In Canada

Loonie

1-dollar coin

Toonie

2-dollar coin

parkade

parking garage

gas bar

petrol station

chinook

the warm wind that comes over the mountain during winter to melt the snow and raise the temperature

hydro bill

electricity bill

Toque (or tuque)

knitted hat

snowbirds

Canadians who head south to sandy beaches and tropical waters to escape winter

Toboggan

Snow sledge

writing a test

Taking a test, giving an exam

In Canada, the testee writes a test, not the tester!

Just Hanging Out

knapsack

backpack

klicks

kilometres

6ix

Toronto

track pants

Comfortable sweat pants

runners

Comfortable running shoes/sneakers

thongs

Slippers, often worn to the beach

housecoat

Bathrobe or dressing gown

Stag

Bachelor party (US), Stag do (UK)

Stagette

Bachelorette party (US), Hen do (UK)

Darts

Cigarettes (not the bar game!)

Bill

Check (US)

Chesterfield

Sofa, couch

pencil crayons

Coloured pencils

What you sayin’ tonight

What are your plans for tonight? (informal)

True

Okay, fine

Home & Away!

Hang a Larry

Turn left while driving

Hang a Roger

Turn right while driving

dinged

Fined money (not damage to a car in an accident!)

Mountie

member of the highly-respected Royal Canadian Mounted Police (RCMP)

eavestroughs

rain gutters on the roof of a house

garburator

Garbage disposal, usually installed under a kitchen sink

fire hall

Fire station

deke

physical outmanoeuvring of an opponent in ice hockey

stickhandle

skilful controlling of the puck in ice hockey

pogie

On Government welfare assistance

give’r

Go for it, give it your best shot

Elementary school

Grades KG-5

Middle school

Grades 6-8

High school

Grades 9-12

University

After-school college (different from ‘community college’)
Time measured in Years – First Year, Third Year, etc

Grade

School class

拾人牙慧,鹦鹉学舌

书不尽言,言不尽意
言者所以在意,得意而忘言
书到用时方恨少,
事非经过不知难

见者易,学者难
纸上得来终觉浅,
绝知此事要躬行

路不行不到,事不为不成
为事在人,成事在天
人在做,天在看
举头三尺有神明
不畏人知畏己知

谁人背后无人说,
哪个人前不说人,
人无千日好,花无百日红
莫笑他人老,终须还到老
人有八疵,事有四患,不可不察也,
责人之心责己,
恕己之心恕人,
己所不欲,勿施于人

山河大地尚属微尘
而况尘中之尘
事实上我们全都是些集体性人物
我们所特有的东西是微乎其微的
就像我们个人是微乎其微的一样
我们的发展要归功于广大世界千丝万缕的影响

人是条件的产物
不可能是理想的化身
生活可以彻底改变一个人

花开花落春不管
水寒水暖鱼自知
生于忧患,死于安乐
夫大块载我以形,劳我以生,佚我以老,息我以死

世事如棋局局新
生活本来就是由一个接一个意想不到的事件组成的
如果它不是那样的话
那么它就不值得我们去体验

天人合一,物我两忘
天地与我并生
万物与我为一

阴阳于人,不啻于父母
天地者,万物之父母也
巍巍乎,惟天为大
获罪于天,无所祷也
自天佑之,吉无不利