XingXing Park

猩猩的乐园


  • Home

  • Archives

  • Tags

  • Job Info

  • Search

东北大学(NEU)博士如何获得谷歌和亚麻的大包

Posted on 2020-11-15 | In career | Comments:
这篇文章是一位PKU,NEU CS Phd师兄的求职经历,文中会提及职业发展建议,技术面试准备,以及行为面试应该如何作答。
Read more »

[Leetcode 1084] Sales Analysis III

Posted on 2020-08-12 | In leetcode | Comments:

原题说明

Table: Product

+————–+———+
| Column Name | Type |
+————–+———+
| product_id | int |
| product_name | varchar |
| unit_price | int |
+————–+———+
product_id is the primary key of this table.

Table: Sales

+————-+———+
| Column Name | Type |
+————-+———+
| seller_id | int |
| product_id | int |
| buyer_id | int |
| sale_date | date |
| quantity | int |
| price | int |
+—— ——+———+
This table has no primary key, it can have repeated rows.
product_id is a foreign key to Product table.

 

Write an SQL query that reports the products that were only sold in spring 2019. That is, between 2019-01-01 and 2019-03-31 inclusive.

The query result format is in the following example:

Product table:
+————+————–+————+
| product_id | product_name | unit_price |
+————+————–+————+
| 1 | S8 | 1000 |
| 2 | G4 | 800 |
| 3 | iPhone | 1400 |
+————+————–+————+

Sales table:
+———–+————+———-+————+———-+——-+
| seller_id | product_id | buyer_id | sale_date | quantity | price |
+———–+————+———-+————+———-+——-+
| 1 | 1 | 1 | 2019-01-21 | 2 | 2000 |
| 1 | 2 | 2 | 2019-02-17 | 1 | 800 |
| 2 | 2 | 3 | 2019-06-02 | 1 | 800 |
| 3 | 3 | 4 | 2019-05-13 | 2 | 2800 |
+———–+————+———-+————+———-+——-+

Result table:
+————-+————–+
| product_id | product_name |
+————-+————–+
| 1 | S8 |
+————-+————–+
The product with id 1 was only sold in spring 2019 while the other two were sold after.


Read more »

[Leetcode 1082] Sales Analysis I

Posted on 2020-08-12 | In leetcode | Comments:

原题说明

Table: Product

+————–+———+
| Column Name | Type |
+————–+———+
| product_id | int |
| product_name | varchar |
| unit_price | int |
+————–+———+
product_id is the primary key of this table.

Table: Sales

+————-+———+
| Column Name | Type |
+————-+———+
| seller_id | int |
| product_id | int |
| buyer_id | int |
| sale_date | date |
| quantity | int |
| price | int |
+—— ——+———+
This table has no primary key, it can have repeated rows.
product_id is a foreign key to Product table.

 

Write an SQL query that reports the best seller by total sales price, If there is a tie, report them all.

The query result format is in the following example:

Product table:
+————+————–+————+
| product_id | product_name | unit_price |
+————+————–+————+
| 1 | S8 | 1000 |
| 2 | G4 | 800 |
| 3 | iPhone | 1400 |
+————+————–+————+

Sales table:
+———–+————+———-+————+———-+——-+
| seller_id | product_id | buyer_id | sale_date | quantity | price |
+———–+————+———-+————+———-+——-+
| 1 | 1 | 1 | 2019-01-21 | 2 | 2000 |
| 1 | 2 | 2 | 2019-02-17 | 1 | 800 |
| 2 | 2 | 3 | 2019-06-02 | 1 | 800 |
| 3 | 3 | 4 | 2019-05-13 | 2 | 2800 |
+———–+————+———-+————+———-+——-+

Result table:
+————-+
| seller_id |
+————-+
| 1 |
| 3 |
+————-+
Both sellers with id 1 and 3 sold products with the most total price of 2800.


Read more »

[Leetcode 1080] Insufficient Nodes in Root to Leaf Paths

Posted on 2020-08-12 | In leetcode | Comments:

原题说明

Given the root of a binary tree, consider all root to leaf paths: paths from the root to any leaf.  (A leaf is a node with no children.)

A node is insufficient if every such root to leaf path intersecting this node has sum strictly less than limit.

Delete all insufficient nodes simultaneously, and return the root of the resulting binary tree.

 

Example 1:


Input:
root = [1,2,3,4,-99,-99,7,8,9,-99,-99,12,13,-99,14], limit = 1

Output:
[1,2,3,4,null,null,7,8,9,null,14]

Example 2:


Input:
root = [5,4,8,11,null,17,4,7,1,null,null,5,3], limit = 22

Output:
[5,4,8,11,null,17,4,7,null,null,null,5]

 

Example 3:


Input:
root = [1,2,-3,-5,null,4,null], limit = -1

Output:
[1,null,-3,4]

 

Note:

  1. The given tree will have between 1 and 5000 nodes.
  2. -10^5 <= node.val <= 10^5
  3. -10^9 <= limit <= 10^9

Read more »

[Leetcode 1078] Occurrences After Bigram

Posted on 2020-08-12 | In leetcode | Comments:

原题说明

Given words first and second, consider occurrences in some text of the form “first second third“, where second comes immediately after first, and third comes immediately after second.

For each such occurrence, add “third“ to the answer, and return the answer.

 

Example 1:

Input: text = “alice is a good girl she is a good student”, first = “a”, second = “good”
Output: [“girl”,”student”]

Example 2:

Input: text = “we will we will rock you”, first = “we”, second = “will”
Output: [“we”,”rock”]

 

Note:

  1. 1 <= text.length <= 1000
  2. text consists of space separated words, where each word consists of lowercase English letters.
  3. 1 <= first.length, second.length <= 10
  4. first and second consist of lowercase English letters.

Read more »

[Leetcode 1079] Letter Tile Possibilities

Posted on 2020-08-09 | In leetcode | Comments:

原题说明

You have a set of tiles, where each tile has one letter tiles[i] printed on it.  Return the number of possible non-empty sequences of letters you can make.

 

Example 1:

Input: “AAB”
Output: 8
Explanation: The possible sequences are “A”, “B”, “AA”, “AB”, “BA”, “AAB”, “ABA”, “BAA”.

Example 2:

Input: “AAABBC”
Output: 188

Note:

  1. 1 <= tiles.length <= 7
  2. tiles consists of uppercase English letters.

Read more »

[Leetcode 1077] Project Employees III

Posted on 2020-08-09 | In leetcode | Comments:

原题说明

SQL Schema

Table: Project

+————-+———+
| Column Name | Type |
+————-+———+
| project_id | int |
| employee_id | int |
+————-+———+
(project_id, employee_id) is the primary key of this table.
employee_id is a foreign key to Employee table.

Table: Employee

+——————+———+
| Column Name | Type |
+——————+———+
| employee_id | int |
| name | varchar |
| experience_years | int |
+——————+———+
employee_id is the primary key of this table.

 

Write an SQL query that reports the most experienced employees in each project. In case of a tie, report all employees with the maximum number of experience years.

The query result format is in the following example:

Project table:
+————-+————-+
| project_id | employee_id |
+————-+————-+
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 1 |
| 2 | 4 |
+————-+————-+
Employee table:
+————-+——–+——————+
| employee_id | name | experience_years |
+————-+——–+——————+
| 1 | Khaled | 3 |
| 2 | Ali | 2 |
| 3 | John | 3 |
| 4 | Doe | 2 |
+————-+——–+——————+
Result table:
+————-+—————+
| project_id | employee_id |
+————-+—————+
| 1 | 1 |
| 1 | 3 |
| 2 | 1 |
+————-+—————+
Both employees with id 1 and 3 have the most experience among the employees of the first project. For the second project, the employee with id 1 has the most experience.

Read more »

机械系PhD如何转行成为程序员

Posted on 2020-08-02 | In career | Comments:
"大猩猩"给大家带来的非CS专业PHD毕业转行做码农的总结。算不上⼀次非常成功的经历,但其中的经验教训希望能给有相似背景的同学带来⼀点帮助。主要针对在北美非CS专业的PhD学⽣,想在美国转行做软件工程相关行业的的同学。
Read more »

[Leetcode 1075] Project Employees I

Posted on 2020-08-02 | In leetcode | Comments:

原题说明

SQL Schema

Table: Project

+————-+———+
| Column Name | Type |
+————-+———+
| project_id | int |
| employee_id | int |
+————-+———+
(project_id, employee_id) is the primary key of this table.
employee_id is a foreign key to Employee table.

Table: Employee

+——————+———+
| Column Name | Type |
+——————+———+
| employee_id | int |
| name | varchar |
| experience_years | int |
+——————+———+
employee_id is the primary key of this table.

 

Write an SQL query that reports the average experience years of all the employees for each project, rounded to 2 digits.

The query result format is in the following example:

Project table:
+————-+————-+
| project_id | employee_id |
+————-+————-+
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 1 |
| 2 | 4 |
+————-+————-+
Employee table:
+————-+——–+——————+
| employee_id | name | experience_years |
+————-+——–+——————+
| 1 | Khaled | 3 |
| 2 | Ali | 2 |
| 3 | John | 1 |
| 4 | Doe | 2 |
+————-+——–+——————+
Result table:
+————-+—————+
| project_id | average_years |
+————-+—————+
| 1 | 2.00 |
| 2 | 2.50 |
+————-+—————+
The average experience years for the first project is (3 + 2 + 1) / 3 = 2.00 and for the second project is (3 + 2) / 2 = 2.50

Read more »

[Leetcode 1073] Adding Two Negabinary Numbers

Posted on 2020-08-02 | In leetcode | Comments:

原题说明

Given two numbers arr1 and arr2 in base -2, return the result of adding them together.

Each number is given in array format:  as an array of 0s and 1s, from most significant bit to least significant bit.  For example, arr = [1,1,0,1] represents the number (-2)^3 + (-2)^2 + (-2)^0 = -3.  A number arr in array format is also guaranteed to have no leading zeros: either arr == [0] or arr[0] == 1.

Return the result of adding arr1 and arr2 in the same format: as an array of 0s and 1s with no leading zeros.

Example 1:

Input: arr1 = [1,1,1,1,1], arr2 = [1,0,1]
Output: [1,0,0,0,0]
Explanation: arr1 represents 11, arr2 represents 5, the output represents 16.

Note:

  1. 1 <= arr1.length <= 1000
  2. 1 <= arr2.length <= 1000
  3. arr1 and arr2 have no leading zeros
  4. arr1[i] is 0 or 1
  5. arr2[i] is 0 or 1

Read more »
12…13

猩猩的乐园

技术面试问题详解
123 posts
2 categories
69 tags
RSS
© 2018 – 2020 猩猩的乐园
|