Let's communicate

This material was recommended by William Bill Blair (August 29th, 1940 - February 7th, 2024), a teacher, a volunteer, a Canadian.

© Let’s Communicate – English Speaking

Asking someone to say something again

Pardon?
I’m sorry I didn’t hear / catch what you said.
Would / Could you say that again, please?
Would / Could you repeat what you said, please?
I’m sorry, what did you say?
What was that?
Informal: What was that again …?
very informal: What? ? Eh? Mm?

Checking you have understood

So, …
Does that mean …?
Do you mean …?
If I understand right …
I’m not sure I understand. Does that mean …?

Saying something another way

In other words, …
That means …
What I mean is …
That’s to say …
…., or rather …
What I’m trying to say is …
What I’m driving at / getting at is …

Giving yourself time to think

…. oh / er / um, …
Let me see / think …
…. just a moment, …
…. you see, …
…. you know, …
How shall I put it?
…. now what’s the word … ?

Checking someone has understood you

Do you know what I mean?
…. if you see what I mean.
I hope that’s clear.
Do I make myself clear?

informal:

Are you with me?
Get it?
Right?

Very informal:

Got the message?

Changing the subject

…., by the way, …
…., before I forget, …
…., I nearly forgot, …

You want to add something

I’d like to make another point.
I’d also like to say …

You need help

I don’t understand, I’m sorry.
I’m not sure I understand what you mean.
What’s the meaning of …?
What does the word … mean?
What’s the French / the English word for …?
I didn’t hear what you said.

Can you / Could you / Would you

repeat, please?
say it again, please?
explain it again, please?
spell that word, please?
write it on the board, please?
speak louder / up, please?
speak more slowly, please?

Could you step aside, please? I can’t see the board.

You want to apologize

Sorry, I’m late.
I apologize for being late.
I’m afraid I’ve forgotten my workbook.

Don’t be dumb

I’m afraid I don’t know.
I haven’t a clue.
I’m afraid I haven’t got the faintest / slightest idea.
I’m terribly sorry but I haven’t understood the question.
Sorry I don’t know what you mean.
I’m not sure I can answer.
I’ve no idea (about) what I am expected to do.
I wish I knew.
I must admit I don’t know much about this problem.
I’m sorry but I don’t know what to say.

Showing you’re interested

Uh, uh (↗↘)
I see … (↗↘)
Really? (↗)
Oh, yes. (↗↘)
How interesting!(↗↘)
I know / see what you mean.

Common Phrases

This material was recommended by William Bill Blair (August 29th, 1940 - February 7th, 2024), a teacher, a volunteer, a Canadian.

© 80 Common English Phrases - by Adriana

Common phrases to ask how someone is:

what’s up?
what’s new?
What have you been up to lately?
How’s it going?
How are things?
How’s life?

Common phrases to say how you are:

I’m fine, thanks. How about you?
Pretty good.
Same as always
Not so great.
Could be better
cant complain

Common phrases to say thank you:

I really appreciate it.
I’m really grateful
That’s so kind of you.
I owe you one.
(this means you want/need to do a favor for the other person in the future)

Common phrases to respond to thank you:

No problem.
No worries
Don’t mention it.
My pleasure.
Anytime.

Common phrases to end a conversation politely:

It was nice chatting with you.
Any way, I should get going.

Common phrases to ask for information:

Do you have any idea…?
Would you happen to know…?
(when you’re not sure if the other person has the information.)
I don’t suppose you(would) know…?
(when you’re not sure if the other person has the information.)

Common phrases to say I don’t know:

I have no idea/clue.
I can’t help you there.
(informal) Beats me.
I’m not really sure.
I’ve been wondering that, too.

Common phrases for not having an opinion:

I’ve never given it much thought.
I don’t have strong feelings either way.
It doesn’t make any difference to me.
I have no opinion on the matter.

Common phrases for agreeing:

Exactly.
Absolutely.
That’s so true.
That’s for sure.
I agree 100%.
I couldn’t agree with you more.
(informal) Tell me about it! / You’re telling me!
(informal) I’ll say!
I suppose so.
(use this phrase for weak agreement - you agree, but reluctantly)

Common phrases for disagreeing:

I’m not so sure about that.
That’s not how I see it.
Not necessarily

Common phrases to respond to great news:

That’s great!
How wonderful!
Awesome!

Common phrases to respond to bad news:

Oh no…
That’s terrible.
Poor you.
(Use this to respond to bad situations that are not too serious)
I’m so sorry to hear that.

Common phrases to invite someone somewhere:

Are you free… [Saturday night?]
Are you doing anything … [Saturday night?]
(informal) Do you wann… [see a movie?]
(formal) Would you like to … [join me for dinner?]

Common phrases for food:

I’m starving!(=I’m very hungry)
Let’s grab a bite to eat.
How about eating out tonight? (eat out = eat at a restaurant)
I’ll have…(use this phrase for ordering in a restaurant)

Common phrases for price:

It cost a fortune.
It cost an arm and a leg.
That’s a rip-off. (=overpriced;far more expensive than it should be)
That’s a bit pricey.
That’s quite reasonable.(=it’s a good price)
That’s a good deal.(=a good value for the amount of money)
It was a real bargain.
It was dirt cheap.(=exremely inexpensive)

Common phrases for weather:

It’s a little chilly.
It’s freezing.(=exremely cold)
Make sure to bundle up.(bundle up = put on warm clothes for protection against the cold)

Common phrases for hot weather:

It’s absolutely boiling!(boiling = extremely hot)
It scorching hot outside

Common phrases for being tired:

I’m exhausted.
I’m dead tired.
I’m beat
I can hardly keep my eyes open
I’m gonna hit the sack.(hit the sack = go to bed)

LeetCode - Algorithms - 19. Remove Nth Node From End of List

Java

Hint: Maintain two pointers and update one with a delay of n steps.
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
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode removeNthFromEnd(ListNode head, int n) {
ListNode fast = head, slow = head;
for(int i=0;i<n;i++)
fast = fast.next;
if (fast==null)
head = head.next;
else {
while(fast.next!=null) {
fast = fast.next;
slow = slow.next;
}
ListNode p = slow.next;
slow.next = p.next;
p.next = null;
}
return head;
}
}

Submission Detail

  • 208 / 208 test cases passed.
  • Runtime: 6 ms, faster than 98.72% of Java online submissions for Remove Nth Node From End of List.
  • Memory Usage: 38 MB, less than 100.00% of Java online submissions for Remove Nth Node From End of List.

ref

LeetCode - Algorithms - 237. Delete Node in a Linked List

Java

How do I delete a node in a linked list?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public void deleteNode(ListNode node) {
ListNode temp = node.next;
node.val = temp.val;
node.next = temp.next;
temp = null;
}
}

Submission Detail

  • 41 / 41 test cases passed.
  • Runtime: 0 ms, faster than 100.00% of Java online submissions for Delete Node in a Linked List.
  • Memory Usage: 37.6 MB, less than 100.00% of Java online submissions for Delete Node in a Linked List.

smartphone, social media and screen time

Your smartphone📱is making you👈 stupid, antisocial 🙅 and unhealthy 😷. So why can’t you put it down❔⁉️
https://www.theglobeandmail.com/technology/your-smartphone-is-making-you-stupid/article37511900/


Steve Jobs Was a Low-Tech Parent
https://www.nytimes.com/2014/09/11/fashion/steve-jobs-apple-was-a-low-tech-parent.html

“So, your kids must love the iPad?” I asked Mr. Jobs, trying to change the subject. The company’s first tablet was just hitting the shelves. “They haven’t used it,” he told me. “We limit how much technology our kids use at home.”


Have Smartphones Destroyed a Generation?
https://www.theatlantic.com/magazine/archive/2017/09/has-the-smartphone-destroyed-a-generation/534198/

More comfortable online than out partying, post-Millennials are safer, physically, than adolescents have ever been. But they’re on the brink of a mental-health crisis.


Why an off-the-grid hour at work is so crucial
http://www.bbc.com/capital/story/20190111-why-an-off-the-grid-hour-at-work-is-so-crucial

Work email, checking social media, streaming video – technology can have toxic effects on your productivity and happiness. Here’s how you can kick the habit for an hour a day.

高效率与幸福感的秘诀:每天离线一小时
https://www.bbc.com/ukchina/simp/vert-cul-46997298


“手机里的恶魔”?硅谷父母对电子产品说不
https://cn.nytimes.com/technology/20181030/phones-children-silicon-valley/

“在糖果和可卡因之间,它更接近于可卡因,”安德森如此评价那些屏幕。

“我们以为能控制它,”安德森说。“但它已经超越了我们的控制能力。它直接被传送到了正在发育的大脑的愉悦中枢。这超越了我们作为普通父母的理解能力。”

苹果(Apple)CEO蒂姆·库克(Tim Cook)今年早些时候表示,他不会让自己的侄子上社交网络。比尔·盖茨(Bill Gates)禁止他的孩子在十几岁之前用手机,而梅琳达·盖茨(Melinda Gates)曾写道,她希望他们可以再晚一些给孩子手机。史蒂夫·乔布斯(Steve Jobs)不会让自己年幼的孩子靠近iPad。


如何摆脱对手机屏幕的狂热迷恋?
https://cn.nytimes.com/technology/20180629/peak-screen-revolution/

屏幕贪得无厌。在认知层面上,它是你注意力的贪婪吸血鬼,只要你看它一眼,基本上就会被它俘获。

“你陷入的不只是那件引起你注意的事——短信、推文什么的,”科技研究公司创意策略(Creative Strategies)的分析师卡罗琳娜·米拉内西(Carolina Milanesi)说。只要打开手机,你就会很快地、几乎是无意识地陷入数字世界不可抗拒的光芒之中——在里面沉浸了30分钟后,你会变得昏昏沉沉,头晕目眩。

“只要打开这个难以抗拒的盒子,你就输了,”她说。


How much is harmful?: New guidelines released on screen time for young children
https://www.theglobeandmail.com/life/parenting/misadventures-in-babysitting-new-guidelines-released-on-screen-time-for-young-children/article35168281/


Are Smartphones Making Us Stupid?

https://www.psychologytoday.com/intl/blog/the-athletes-way/201706/are-smartphones-making-us-stupid

The mere presence of your smartphone can reduce cognitive capacity, study finds.


Your Smartphone Is Making You Stupid
https://lifehacker.com/your-smartphone-is-making-you-stupid-1796449887


Social Media Is The New Smoking
https://theroamingmind.com/2017/03/06/social-media-is-the-new-smoking/


The vital time you shouldn’t be on social media
http://www.bbc.com/future/story/20180110-the-vital-time-you-really-shouldnt-be-on-social-media

Social media is having a worrying impact on sleep; we reveal the crucial time to stay away from it.


电子阅读设备是如何“杀死”你的睡眠的
https://cn.nytimes.com/health/20180529/how-nighttime-tablet-and-phone-use-disturbs-sleep/


Half the world’s population will be short-sighted in 30 years, with one in five at risk of BLINDNESS- and experts blame lack of daylight and too much screen time
https://www.dailymail.co.uk/health/article-3452600/Half-world-s-population-short-sighted-30-years-one-five-risk-BLINDNESS-experts-blame-lack-daylight-screen-time.html

LeetCode - Algorithms - 326. Power of Three

Java

1 Integer.Max_Value

1
2
3
4
5
class Solution {
public boolean isPowerOfThree(int n) {
return n>0 && 1162261467%n==0?true:false;
}
}

Submission Detail

  • Runtime: 12 ms, faster than 99.94% of Java online submissions for Power of Three.
  • Memory Usage: 38.1 MB, less than 0.99% of Java online submissions for Power of Three.
  • 21038 / 21038 test cases passed.

2 Logarithm

1
2
3
4
5
6
7
class Solution {
public boolean isPowerOfThree(int n) {
if (n<=0) return false;
double power = Math.log10(n)/Math.log10(3);
return power==Math.ceil(power)?true:false;
}
}

Submission Detail

  • Runtime: 15 ms, faster than 52.50% of Java online submissions for Power of Three.
  • Memory Usage: 37.3 MB, less than 0.99% of Java online submissions for Power of Three.
  • 21038 / 21038 test cases passed.

LeetCode - Algorithms - 28. Implement strStr()

Java

1 KMP algorithm

北京大学信息科学与技术学院《数据结构与算法》 之 KMP模式匹配算法 ©版权所有
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
class Solution {
public int[] nextVector(String P) {
int[] arr = new int[P.length()];
arr[0] = 0;
int k = 0;
for (int i = 1; i < P.length(); i++) {
k = arr[i - 1];

while (k > 0 && P.charAt(i) != P.charAt(k)) {
k = arr[k - 1];
}

if (P.charAt(i) == P.charAt(k))
arr[i] = k + 1;
else
arr[i] = 0;
}
return arr;
}

public int findPat_KMP(String S, String P, int[] N, int startIndex) {
int lastIndex = S.length() - P.length();
if (lastIndex < startIndex)
return -1;
int i = startIndex, j = 0;
for (; i < S.length(); i++) {
while (P.charAt(j) != S.charAt(i) && j > 0)
j = N[j - 1];
if (S.charAt(i) == P.charAt(j))
j++;
if (j == P.length())
return i - j + 1;
}
return -1;
}

public int strStr(String haystack, String needle) {
if (needle.isEmpty()) return 0;
int[] arr = nextVector(needle);
if (needle.isEmpty()) return 0;
return findPat_KMP(haystack,needle,arr,0);
}
}

Submission Detail

  • 74 / 74 test cases passed.
  • Runtime: 9 ms, faster than 26.57% of Java online submissions for Implement strStr().
  • Memory Usage: 38.5 MB, less than 0.98% of Java online submissions for Implement strStr().

2 JDK String indexOf

1
2
3
4
5
6
class Solution {
public int strStr(String haystack, String needle) {
if (needle.isEmpty()) return 0;
return haystack.indexOf(needle);
}
}

Submission Detail

  • 74 / 74 test cases passed.
  • Runtime: 3 ms, faster than 99.58% of Java online submissions for Implement strStr().
  • Memory Usage: 38.1 MB, less than 0.98% of Java online submissions for Implement strStr().

LeetCode - Algorithms - 26. Remove Duplicates from Sorted Array

Java

The size of a Java array is fixed when you allocate it, and cannot be changed.

You’ve to provide a fixed size for that Array, You can neither EXPAND or SHRINK that array.

1

26.[圖解]Remove Duplicates from Sorted Array

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class Solution {
public int removeDuplicates(int[] nums) {
if (nums.length<2) return nums.length;
int x=0,y=1;
while (y<nums.length) {
if (nums[x]==nums[y]) {
y+=1;
}
else {
x+=1;
nums[x]=nums[y];
y+=1;
}
}
return x+1;
}
}

Submission Detail

  • 161 / 161 test cases passed.
  • Runtime: 6 ms
  • Memory Usage: 39.8 MB
  • Your runtime beats 97.51 % of java submissions.

2

5 lines Java solution

1
2
3
4
5
6
7
8
9
10
11
class Solution {
public int removeDuplicates(int[] nums) {
if (nums.length==0) return 0;
int j=0;
for(int i=0;i<nums.length;i++) {
if (nums[i]!=nums[j])
nums[++j]=nums[i];
}
return ++j;
}
}

Submission Detail

  • 161 / 161 test cases passed.
  • Runtime: 7 ms
  • Memory Usage: 42 MB
  • Your runtime beats 61.11 % of java submissions.

JavaScript

1
2
3
4
5
6
7
8
9
10
11
12
/**
* @param {number[]} nums
* @return {number}
*/
var removeDuplicates = function(nums) {
if (nums.length < 2) return nums.length;
for (var i = 0; i < nums.length; i++) {
while (nums[i] === nums[i-1])
nums.splice(i, 1);
}
return nums.length;
};

Submission Detail

  • 161 / 161 test cases passed.
  • Runtime: 84 ms, faster than 42.35% of JavaScript online submissions for Remove Duplicates from Sorted Array.
  • Memory Usage: 37.7 MB, less than 22.92% of JavaScript online submissions for Remove Duplicates from Sorted Array.

Resources

LeetCode - Algorithms - 13. Roman to Integer

Java

JAVA—————-Easy Version To Understand!!!!

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
class Solution {
public int romanToInt(String s) {
if (s==null || s.isEmpty()) return -1;
Map<Character, Integer> map = new HashMap<Character, Integer>();
map.put('I',1);
map.put('V',5);
map.put('X',10);
map.put('L',50);
map.put('C',100);
map.put('D',500);
map.put('M',1000);
char[] arr = s.toCharArray();
int len = arr.length;
int sum = map.get(arr[len-1]);
for(int i=0;i<len-1;i++) {
if (map.get(arr[i])>=map.get(arr[i+1])) {
sum += map.get(arr[i]);
}
else {
sum -= map.get(arr[i]);
}
}
return sum;
}
}

Submission Detail

  • 3999 / 3999 test cases passed.
  • Runtime: 91 ms
  • Your runtime beats 20.92 % of java submissions.

LeetCode - Algorithms - 21. Merge Two Sorted Lists

I am confused with pointer and linked list since I tounched computer as freshman in university.

just verify solution of other guys.

Java

Iterative

© LeetCode – Merge Two Sorted Lists (Java)

The key to solve the problem is defining a fake head. Then compare the first elements from each list. Add the smaller one to the merged list. Finally, when one of them is empty, simply append it to the merged list, since it is already sorted.

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
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
ListNode head = new ListNode(0);
ListNode p = head;

ListNode p1 = l1;
ListNode p2 = l2;
while (p1 != null && p2 != null) {
if (p1.val < p2.val) {
p.next = p1;
p1 = p1.next;
} else {
p.next = p2;
p2 = p2.next;
}
p = p.next;
}

if (p1 != null) {
p.next = p1;
}

if (p2 != null) {
p.next = p2;
}

return head.next;
}
}

Submission Detail

  • 208 / 208 test cases passed.
  • Runtime: 1 ms, faster than 20.84% of Java online submissions for Merge Two Sorted Lists.
  • Memory Usage: 40.2 MB, less than 12.09% of Java online submissions for Merge Two Sorted Lists.

Recursive

Java, 1 ms, 4 lines codes, using recursion

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if (l1==null) return l2;
if (l2==null) return l1;
if (l1.val<l2.val) {
l1.next = mergeTwoLists(l1.next,l2);
return l1;
}
else {
l2.next = mergeTwoLists(l1,l2.next);
return l2;
}
}
}

Submission Detail

  • 208 / 208 test cases passed.
  • Runtime: 13 ms
  • Your runtime beats 34.74 % of java submissions.