代码改变世界

[LeetCode] questions conclusion_ Binary Search

2018-08-29 06:49 by Johnson_强生仔仔, 340 阅读, 0 推荐, 收藏, 编辑
摘要:Binary Search T(n) = T(n/2) + O(1) => T(n) = O(lg n) proof: 如果能用iterable , 就用while loop, 可以防止用recursion的时候stack overflow( process in Linux is 8Mb), st 阅读全文

[LeetCode] 610. Triangle Judgement_Easy tag: SQL

2018-08-28 23:59 by Johnson_强生仔仔, 371 阅读, 0 推荐, 收藏, 编辑
摘要:A pupil Tim gets homework to identify whether three line segments could possibly form a triangle. However, this assignment is very heavy because there 阅读全文

[LeetCode] 613. Shortest Distance in a Line_Easy tag: SQL

2018-08-28 23:53 by Johnson_强生仔仔, 388 阅读, 0 推荐, 收藏, 编辑
摘要:Table point holds the x coordinate of some points on x-axis in a plane, which are all integers. Write a query to find the shortest distance between tw 阅读全文

[LeetCode] 422. Valid Word Square_Easy

2018-08-28 23:42 by Johnson_强生仔仔, 263 阅读, 0 推荐, 收藏, 编辑
摘要:Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read th 阅读全文

[LeetCode] 492. Construct the Rectangle_Easy tag: Math

2018-08-28 23:20 by Johnson_强生仔仔, 170 阅读, 0 推荐, 收藏, 编辑
摘要:For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now i 阅读全文

[LeetCode] 619. Biggest Single Number_Easy tag: SQL

2018-08-28 23:13 by Johnson_强生仔仔, 291 阅读, 0 推荐, 收藏, 编辑
摘要:Table number contains many numbers in column num including duplicated ones.Can you write a SQL query to find the biggest number, which only appears on 阅读全文

[LeetCode] 584. Find Customer Referee_Easy tag: SQL

2018-08-28 23:04 by Johnson_强生仔仔, 373 阅读, 0 推荐, 收藏, 编辑
摘要:Given a table customer holding customers information and the referee. + + + + | id | name | referee_id| + + + + | 1 | Will | NULL | | 2 | Jane | NULL 阅读全文

[LeetCode] 603. Consecutive Available Seats_Easy tag: SQL

2018-08-28 21:57 by Johnson_强生仔仔, 626 阅读, 0 推荐, 收藏, 编辑
摘要:Several friends at a cinema ticket office would like to reserve consecutive available seats.Can you help to query all the consecutive available seats 阅读全文

[LeetCode] 607. Sales Person_Easy tag: SQL

2018-08-28 21:40 by Johnson_强生仔仔, 626 阅读, 0 推荐, 收藏, 编辑
摘要:Description Given three tables: salesperson, company, orders.Output all the names in the table salesperson, who didn’t have sales to company 'RED'. Ex 阅读全文

[LeetCode] 506. Relative Ranks_Easy tag: Sort

2018-08-28 12:23 by Johnson_强生仔仔, 147 阅读, 0 推荐, 收藏, 编辑
摘要:Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Sil 阅读全文
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 39 下一页