GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — LeetCode/Two_Pointers/923.3Sum-With-Multiplicity at master · wisdompeak/LeetCode

Expand file tree

/

923.3Sum-With-Multiplicity

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

923.3Sum-With-Multiplicity

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
923.3Sum-With-Multiplicity.cpp
923.3Sum-With-Multiplicity.cpp
 
 
Readme.md
Readme.md
 
 

Readme.md

923.3Sum-With-Multiplicity

我们可以在第一层循环中枚举中间的元素k,再用双指针的思想来遍历{i,j}配对。第二层循环里枚举元素i,然后从右往左移动指针j来寻找arr[i]+arr[k]+arr[j]==target.

这里需要注意的是,两个指针移动时需要考虑与arr[i]相同的元素个数count1,与arr[j]相同的元素个数count2。统计时需要加上count1*count2.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.