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

[高频题] 记录贴,互勉

🔗
 楼主| 微信用户_b99d1cc 2023-9-1 08:51:22 | 只看该作者
全局:
154. Find Minimum in Rotated Sorted Array II
For this question same as previous, but we need to take care the number that repeated, which we need to search both side of the array, and also prevent from overflow, we need to use l + ( r -l ) /2 instead of  (r + l) /2

image.png (18.94 KB, 下载次数: 2)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-2 07:15:07 | 只看该作者
全局:
912. Sort an Array (Merge sort)
time complexity: O(n*(logn))     每层排序n个数take O(n). 有log(n)层

image.png (44.22 KB, 下载次数: 3)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-3 07:54:33 | 只看该作者
全局:
315. Count of Smaller Numbers After Self  //Hard
MergeSort solution
1. Create a class to store the value and its index on the array
2. Use an array to store the mapping of the index and counter for smaller values on the right
3. Use the merge sort method to count the value as smaller
4. Because the left array is sorted in ascending order, we can count how many smaller numbers prevent repeating checks.

image.png (58.39 KB, 下载次数: 1)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-3 07:55:27 | 只看该作者
全局:
Divide and conquer(分治)

image.png (17.92 KB, 下载次数: 0)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-3 08:08:21 | 只看该作者
全局:
List(链表)
2. Add Two Numbers (Medium

image.png (33.76 KB, 下载次数: 1)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-3 10:39:03 | 只看该作者
全局:
445. Add Two Numbers II
ReverLinkList.

image.png (59.62 KB, 下载次数: 1)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-3 11:29:49 | 只看该作者
全局:
24. Swap Nodes in Pairs  Medium

image.png (27.48 KB, 下载次数: 0)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-3 14:31:15 | 只看该作者
全局:
206. Reverse Linked List

image.png (13.55 KB, 下载次数: 2)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-4 10:45:14 | 只看该作者
全局:
141. Linked List Cycle
two pointer

image.png (17.82 KB, 下载次数: 1)

image.png
回复

使用道具 举报

🔗
 楼主| 微信用户_b99d1cc 2023-9-4 12:05:22 | 只看该作者
全局:
142. Linked List Cycle II
Find a cycle and the fast and slow meet point

image.png (27.79 KB, 下载次数: 2)

image.png
回复

使用道具 举报

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

本版积分规则

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