楼主: 李浩泉
跳转到指定楼层
上一主题 下一主题
收起左侧

[Leetcode] LC Python 刷题笔记 有志者事竟成

   
🔗
 楼主| 李浩泉 2020-9-1 00:06:41 | 只看该作者
全局:
Q7. Limitations of VLOOKUP

One major limitation of VLOOKUP is that it cannot look to the left. The values to lookup must always be on the left-most column of the range and the values to return must be on the right hand side. You cannot use the standard VLOOKUP to look at the columns and the rows to find an exact match.


VLOOKUP & HLOOKUP for Dynamic Lookups

“V” in VLOOKUP refers to vertical and “H” in HLOOKUP refers to horizontal.

If the data in your table has column headers, use the VLOOKUP function. If the data table has row headers and you need to search horizontally across the rows for a “match,” then use HLOOKUP. The main limitation is that the value looked with VLOOKUP needs to be in the left-most table column and in HLOOKUP it has to be in the top row of the data set.

INDEX-MATCH is much more flexible than Excel's "lookup" functions.
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-1 00:16:07 | 只看该作者
全局:
Q8. How to identify duplicates in Excel

To search for duplicate rows with 1st occurrences, use this formula:
=IF(COUNTIFS($A$2:$A$8,$A2,$B$2:$B$8,$B2,$C$2:$C$8,$C2)>1, "Duplicate row", "")
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-1 00:33:25 | 只看该作者
本帖为密码帖 ,请输入密码 
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-1 00:46:36 | 只看该作者
本帖为密码帖 ,请输入密码 
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-1 12:16:58 | 只看该作者
本帖为密码帖 ,请输入密码 
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-7 07:58:59 | 只看该作者

几道 SQL HARD / INSANE 习题

全局:
隐藏菜单里的比较 INSANE/HARD SQL 题

# 1880



  1. WITH CTE AS (   
  2.       SELECT
  3.           driver_name,
  4.           date,
  5.           SUM(miles_logged) miles,
  6.           SUM(1) AS inspections
  7.       FROM inspections
  8.       GROUP BY driver_name,date
  9.       WITH ROLLUP )

  10. SELECT
  11.   CONCAT(
  12.         if(date,concat('  date: ' , date, '; miles covered: '),
  13.             if(!driver_name,concat(' Name: ', driver_name,'; number of inspections: ', inspections,'; miles driven: '),' Total miles driven by all drivers combined: ')
  14.                  ),
  15.           miles) AS summary              
  16. FROM CTE
  17. ORDER BY driver_name,date
复制代码


1.jpg (97.87 KB, 下载次数: 3)

1.jpg
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-7 08:22:56 | 只看该作者
全局:
CONCAT; GROUP_CONCAT; ARRAY_AGG

  1. SELECT
  2.   CONCAT('date: ' ,start_date,'; miles covered: ',budget) TITLE
  3. FROM projects
  4. ORDER BY start_date ASC;


  5. SELECT ARRAY_AGG(start_date ORDER BY start_date DESC) DATE
  6. FROM projects
  7. GROUP BY EXTRACT(YEAR FROM start_date)
复制代码


回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-8 04:27:52 | 只看该作者
全局:
本帖最后由 李浩泉 于 2020-9-8 04:30 编辑

Given the time allocated to a user's tasks and their daily workingHours, return the minimum number of days necessary for them to complete the given tasks. If there's no way to tackle all of them, return -1 instead.

workingHours = 15

tasks = [4, 15, 6, 3, 13, 4, 7, 14, 8, 15, 5, 8]

Expected Output: 7

DAY1: 15
DAY2: 15
DAY3: 14
DAY4: 13
DAY5: 8 + 7
DAY6:  8 + 4 + 3
DAY7:  6 + 5 + 4


For workingHours = 3 and tasks = [2, 2, 2], the output should be: tasksScheduling(workingHours, tasks) = 3.

DAY1: 2
DAY2: 2
DAY3: 2

Carryover is not allowed

回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-8 04:31:42 | 只看该作者
本帖为密码帖 ,请输入密码 
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-9-12 02:56:56 | 只看该作者
本帖为密码帖 ,请输入密码 
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表