当前位置:网站首页>Number conclusion LC skimming review - 1
Number conclusion LC skimming review - 1
2022-07-06 02:16:00 【Forina_ Han】
217. There are duplicate elements
- There are duplicate elements
- Use
SetOfsizeandArrayOflengthJust judge . - At first, we tried to divide and conquer , But the problem cannot be decomposed into the smallest problem , Because there are no duplicate elements in the left array , There are no duplicate elements on the right , It does not mean that there are no duplicate elements in the original array ( That is, when the left and right arrays contain the same elements , Such as [1,2,3,1]
- Traversable arrays , Use
hashMapMark values , If duplicate marks are found, exit the traversal . - You can sort against arrays , Scan whether adjacent elements have the same value , Time for space .
53. Maximum subarray and
Dynamic gauge ,
dp[i]The subscript in the input array isiThe largest subarray and .Divide and conquer , Bisection decomposition array , And derive the parent optimal solution from the child optimal solution
const mid = Math.floor((l + r) / 2); let L_res = R_res= { iSum: 0, lSum: 0, rSum: 0, aSum: 0 }; if(mid - 1 >= l) { L_res = getlmr(arr, l, mid - 1); } if(mid <= r) { R_res = getlmr(arr, mid, r) } const { iSum: L_iSum, lSum: L_lSum, rSum: L_rSum, aSum: L_aSum} = L_res const { iSum: R_iSum, lSum: R_lSum, rSum: R_rSum, aSum: R_aSum} = R_res; return { iSum: Math.max(L_iSum, R_iSum, L_rSum + R_lSum), lSum: Math.max(L_lSum, L_aSum + R_lSum), rSum: Math.max(R_rSum, R_aSum + L_rSum), aSum: L_aSum + R_aSum, }
边栏推荐
- Ali test open-ended questions
- A basic lintcode MySQL database problem
- Global and Chinese markets for single beam side scan sonar 2022-2028: Research Report on technology, participants, trends, market size and share
- Derivation of Biot Savart law in College Physics
- RDD conversion operator of spark
- PHP campus movie website system for computer graduation design
- [robot library] awesome robots Libraries
- [eight part essay] what is the difference between unrepeatable reading and unreal reading?
- Leetcode sum of two numbers
- vs code保存时 出现两次格式化
猜你喜欢

Unity learning notes -- 2D one-way platform production method

Minecraft 1.18.1, 1.18.2 module development 22 Sniper rifle

【社区人物志】专访马龙伟:轮子不好用,那就自己造!

Minecraft 1.16.5 biochemical 8 module version 2.0 storybook + more guns

NumPy 数组索引 切片

Redis list

Campus second-hand transaction based on wechat applet

2022 PMP project management examination agile knowledge points (8)

Numpy array index slice

Online reservation system of sports venues based on PHP
随机推荐
Computer graduation design PHP college student human resources job recruitment network
抓包整理外篇——————状态栏[ 四]
Using SA token to solve websocket handshake authentication
Audio and video engineer YUV and RGB detailed explanation
Card 4G industrial router charging pile intelligent cabinet private network video monitoring 4G to Ethernet to WiFi wired network speed test software and hardware customization
Global and Chinese markets of screw rotor pumps 2022-2028: Research Report on technology, participants, trends, market size and share
Prepare for the autumn face-to-face test questions
selenium 元素定位(2)
通过PHP 获取身份证相关信息 获取生肖,获取星座,获取年龄,获取性别
vs code保存时 出现两次格式化
VIM usage guide
Regular expressions: examples (1)
Spark accumulator
Paper notes: graph neural network gat
[eight part essay] what is the difference between unrepeatable reading and unreal reading?
2 power view
NumPy 数组索引 切片
2022 edition illustrated network pdf
Global and Chinese markets of general purpose centrifuges 2022-2028: Research Report on technology, participants, trends, market size and share
RDD creation method of spark