Compare commits

...

10 Commits

Author SHA1 Message Date
355ac33a49 新增设计模式和算法题目
- 添加了抽象工厂模式、适配器模式、桥接模式、建造者模式、组合模式、装饰器模式、享元模式、外观模式和工厂方法模式的实现
- 新增了交替打印、LeetCode算法题目(包括LCS、最长递增子序列、子序列判断、矩阵最长公共子数组等)的实现
- 优化了Semaphore实现的交替打印程序

Default Changelist
AbstractFactoryPattern.java
AdapterPattern.java
Alternate_printing.java
BridgingPattern.java
BuildPattern.java
ComboPattern.java
DecoratorPattern.java
EnjoyPattern.java
FacadePattern.java
FactoryMethodPattern.java
FunctionInterfaceDemo.java
FunctionInterfaceDemo.java
LCR155.java
LCR186.java
LeetCode115.java
LeetCode155.java
LeetCode230.java
LeetCode300.java
LeetCode392.java
LeetCode718.java
LeetCode912.java
PrototypePattern.java
ProxyPattern.java
rustDesk.yaml
SocketDemo.java
SpringFactoryBean.java
ThreadConnect.java
2024-10-05 23:15:32 +08:00
00672efdc8 Default Changelist
FindAbsMinItem.java
LeetCode33.java
LeetCode48.java
LeetCode69.java
LeetCode72.java
LeetCode75.java
LeetCode309.java
LeetCode739.java
LeetCode912.java
P241001.java
2024-10-03 15:02:06 +08:00
a1524dde27 Default Changelist
2024_3_30.md
AbsoluteBeiBao.java
AbstractFactoryPattern.java
AffinityThreadPoolTest.java
AioServer.java
Alternate_printing.java
AppTest.java
AppTest.java
AtomicStampedReferenceDemo.java
BeiBao.java
ByteDance.java
byteStream.java
c2.java
cd.java
cglib.java
cglib.java
ChainPattern.java
CRC16_ARC.java
Custom.java
DePattern.java
DePatternTest.java
DirectoryToMarkdown.java
FactoryAndStrategy.java
FanxinTest.java
func.java
FutureRelative.java
FutureTask.java
hashDB.java
HS.java
IOCDemo.java
Jinshan.java
KaMa47.java
Kama55.java
LambdaClass.java
LC15.java
LCR001.java
LCR001.java
LCR001.java
LCR001.java
LCR089.java
LCR090.java
LCR090.java
LCR155.java
LCR181.java
LeeCode146.java
LeetCode1.java
LeetCode2.java
LeetCode002.java
LeetCode3.java
LeetCode3.java
LeetCode003.java
LeetCode4.java
LeetCode5.java
LeetCode5.java
LeetCode5.java
LeetCode5.java
LeetCode005.java
LeetCode6.java
LeetCode10.java
LeetCode11.java
LeetCode11.java
LeetCode11.java
LeetCode11.java
LeetCode12.java
LeetCode13.java
LeetCode14.java
LeetCode15.java
LeetCode15.java
LeetCode15.java
LeetCode15.java
LeetCode15_$.java
LeetCode17.java
LeetCode17_12BiNode.java
LeetCode18.java
LeetCode18.java
LeetCode18.java
LeetCode19.java
LeetCode19.java
LeetCode20.java
LeetCode20.java
LeetCode21.java
LeetCode21.java
LeetCode21.java
LeetCode22.java
LeetCode22.java
LeetCode22.java
LeetCode23.java
LeetCode23.java
LeetCode23.java
LeetCode24.java
LeetCode25.java
LeetCode26.java
LeetCode27.java
LeetCode28.java
LeetCode28.java
LeetCode28.java
LeetCode28.java
LeetCode28.java
LeetCode28.java
LeetCode28_false.java
LeetCode29.java
LeetCode31.java
LeetCode31.java
LeetCode31.java
LeetCode32.java
LeetCode32.java
LeetCode32.java
LeetCode32.java
LeetCode33.java
LeetCode33.java
LeetCode33.java
LeetCode34.java
LeetCode35.java
LeetCode36.java
LeetCode39.java
LeetCode40.java
LeetCode40.java
LeetCode40.java
LeetCode40.java
LeetCode42.java
LeetCode42.java
LeetCode42.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode46.java
LeetCode46.java
LeetCode46.java
LeetCode47.java
LeetCode47.java
LeetCode47.java
LeetCode48.java
LeetCode48.java
LeetCode49.java
LeetCode51.java
LeetCode51.java
LeetCode51.java
LeetCode53.java
LeetCode53.java
LeetCode53.java
LeetCode53.java
LeetCode53.java
LeetCode53.java
LeetCode54.java
LeetCode55.java
LeetCode55.java
LeetCode55.java
LeetCode56.java
LeetCode57.java
LeetCode58.java
LeetCode59.java
LeetCode61.java
LeetCode62.java
LeetCode63.java
LeetCode64.java
LeetCode69.java
LeetCode69.java
LeetCode69.java
LeetCode69.java
LeetCode70.java
LeetCode71.java
LeetCode72.java
LeetCode72.java
LeetCode72.java
LeetCode73.java
LeetCode75.java
LeetCode75.java
LeetCode75.java
LeetCode77.java
LeetCode77.java
LeetCode77.java
LeetCode77.java
LeetCode78.java
LeetCode80.java
LeetCode82.java
LeetCode84.java
LeetCode84.java
LeetCode84.java
LeetCode84_1.java
LeetCode88.java
LeetCode90.java
LeetCode90.java
LeetCode90.java
LeetCode92.java
LeetCode93.java
LeetCode93.java
LeetCode94.java
LeetCode94.java
LeetCode94.java
LeetCode94.java
LeetCode94_145_144_102.java
LeetCode96.java
LeetCode96.java
LeetCode96.java
LeetCode96.java
LeetCode96.java
LeetCode98.java
LeetCode100.java
LeetCode101.java
LeetCode101.java
LeetCode101.java
LeetCode101.java
LeetCode102.java
LeetCode102.java
LeetCode104.java
LeetCode105.java
LeetCode105.java
LeetCode105.java
LeetCode105_106.java
LeetCode106.java
LeetCode107.java
LeetCode108.java
LeetCode110.java
LeetCode110.java
LeetCode110.java
LeetCode110.java
LeetCode110.java
LeetCode111.java
LeetCode112.java
LeetCode113.java
LeetCode114.java
LeetCode115.java
LeetCode115.java
LeetCode116.java
LeetCode121.java
LeetCode121.java
LeetCode121.java
LeetCode122.java
LeetCode122.java
LeetCode122.java
LeetCode124.java
LeetCode125.java
LeetCode128.java
LeetCode131.java
LeetCode131.java
LeetCode131.java
LeetCode131.java
LeetCode131.java
LeetCode134.java
LeetCode134.java
LeetCode134.java
LeetCode134.java
LeetCode134.java
LeetCode135.java
LeetCode135.java
LeetCode135.java
LeetCode135.java
LeetCode138.java
LeetCode139.java
LeetCode141.java
LeetCode142.java
LeetCode142.java
LeetCode144.java
LeetCode145.java
LeetCode145.java
LeetCode146.java
LeetCode150.java
LeetCode151.java
LeetCode151.java
LeetCode151.java
LeetCode151.java
LeetCode155.java
LeetCode160.java
LeetCode165.java
LeetCode167.java
LeetCode169.java
LeetCode189.java
LeetCode198.java
LeetCode199.java
LeetCode199.java
LeetCode199.java
LeetCode199.java
LeetCode202.java
LeetCode202.java
LeetCode202.java
LeetCode202.java
LeetCode202.java
LeetCode203.java
LeetCode203.java
LeetCode203.java
LeetCode203.java
LeetCode203.java
LeetCode203_false.java
LeetCode205.java
LeetCode206.java
LeetCode206.java
LeetCode206.java
LeetCode206.java
LeetCode206.java
LeetCode206.java
LeetCode206_false.java
LeetCode207.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209_false.java
LeetCode210.java
LeetCode215.java
LeetCode216.java
LeetCode216.java
LeetCode216.java
LeetCode216.java
LeetCode219.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode225.java
LeetCode225.java
LeetCode225.java
LeetCode225.java
LeetCode226.java
LeetCode228.java
LeetCode232.java
LeetCode232.java
LeetCode232.java
LeetCode232.java
LeetCode234.java
LeetCode235.java
LeetCode236.java
LeetCode236.java
LeetCode236.java
LeetCode236.java
LeetCode236.java
LeetCode236.java
LeetCode238.java
LeetCode239.java
LeetCode239_false.java
LeetCode242.java
LeetCode246.java
LeetCode257.java
LeetCode257.java
LeetCode257.java
LeetCode257.java
LeetCode274.java
LeetCode276.java
LeetCode277.java
LeetCode279.java
LeetCode279.java
LeetCode279.java
LeetCode279.java
LeetCode287.java
LeetCode287.java
LeetCode287.java
LeetCode287.java
LeetCode287.java
LeetCode287_false.java
LeetCode289.java
LeetCode290.java
LeetCode300.java
LeetCode300.java
LeetCode300.java
LeetCode309.java
LeetCode322.java
LeetCode322.java
LeetCode322.java
LeetCode322.java
LeetCode332difficult.java
LeetCode337.java
LeetCode337.java
LeetCode337.java
LeetCode337.java
LeetCode337_1.java
LeetCode343.java
LeetCode343.java
LeetCode343.java
LeetCode343.java
LeetCode344.java
LeetCode347.java
LeetCode347.java
LeetCode347.java
LeetCode347.java
LeetCode349.java
LeetCode350.java
LeetCode367.java
LeetCode376.java
LeetCode376.java
LeetCode376.java
LeetCode376.java
LeetCode376.java
LeetCode377.java
LeetCode377.java
LeetCode377.java
LeetCode380.java
LeetCode383.java
LeetCode392.java
LeetCode392.java
LeetCode392.java
LeetCode404.java
LeetCode406.java
LeetCode406.java
LeetCode406.java
LeetCode406.java
LeetCode415.java
LeetCode416.java
LeetCode416.java
LeetCode416.java
LeetCode416.java
LeetCode416.java
LeetCode429.java
LeetCode435.java
LeetCode435.java
LeetCode435.java
LeetCode435.java
LeetCode450.java
LeetCode450.java
LeetCode450.java
LeetCode450.java
LeetCode450.java
LeetCode452.java
LeetCode452.java
LeetCode452.java
LeetCode453.java
LeetCode454.java
LeetCode455.java
LeetCode459.java
LeetCode462.java
LeetCode468.java
LeetCode474.java
LeetCode474.java
LeetCode474.java
LeetCode491.java
LeetCode491.java
LeetCode491.java
LeetCode491.java
LeetCode494.java
LeetCode494.java
LeetCode494.java
LeetCode496.java
LeetCode496.java
LeetCode496.java
LeetCode501.java
LeetCode501.java
LeetCode501.java
LeetCode501.java
LeetCode503.java
LeetCode503.java
LeetCode503.java
LeetCode509.java
LeetCode509.java
LeetCode509.java
LeetCode513.java
LeetCode515.java
LeetCode516.java
LeetCode518.java
LeetCode530.java
LeetCode538.java
LeetCode541.java
LeetCode559.java
LeetCode583.java
LeetCode583.java
LeetCode617.java
LeetCode637.java
LeetCode647.java
LeetCode647.java
LeetCode647.java
LeetCode647.java
LeetCode647_1.java
LeetCode654.java
LeetCode669.java
LeetCode674.java
LeetCode674.java
LeetCode674.java
LeetCode698.java
LeetCode700.java
LeetCode701.java
LeetCode701.java
LeetCode701.java
LeetCode703.java
LeetCode704.java
LeetCode704.java
LeetCode705.java
LeetCode707.java
LeetCode707_2.java
LeetCode713.java
LeetCode713.java
LeetCode713.java
LeetCode713.java
LeetCode714.java
LeetCode718.java
LeetCode718.java
LeetCode718.java
LeetCode718.java
LeetCode738.java
LeetCode738.java
LeetCode738.java
LeetCode738.java
LeetCode738.java
LeetCode739.java
LeetCode739.java
LeetCode739.java
LeetCode746.java
LeetCode763.java
LeetCode763.java
LeetCode763.java
LeetCode763.java
LeetCode763.java
LeetCode860.java
LeetCode860.java
LeetCode860.java
LeetCode912.java
LeetCode912_SortArrays.java
LeetCode946.java
LeetCode968.java
LeetCode968.java
LeetCode968.java
LeetCode968.java
LeetCode968.java
LeetCode977.java
LeetCode989.java
LeetCode1005.java
LeetCode1005.java
LeetCode1005.java
LeetCode1005.java
LeetCode1035.java
LeetCode1047.java
LeetCode1049.java
LeetCode1049.java
LeetCode1049.java
LeetCode1049.java
LeetCode1143.java
LeetCode1143.java
LeetCode1143.java
LeetCode2487.java
LeetCode2487.java
LeetCode2487.java
LeetCode2487.java
LeetCode2487.java
LeetCode2487_false.java
LeetCode2602.java
LeetCode2602.java
LeetCode2602.java
LeetCode_0207_IntersectionNode.java
LeetCodeQuickSort.java
Line.java
ListNode.java
listSeries.java
MapUtils.java
MeiTuan24_3_9.java
MeiTuan24QiuZhao.java
meituan810.java
meituan824.java
Metituan2.java
MT.java
MT3_39.java
MyHashMap.java
MyHeap.java
Node.java
NoIElse.java
NoIfElse.java
Offer03.java
OptimisticLock.java
P1.java
P1.java
P1.java
P1.java
p1.java
p1.java
p1.java
p1.java
p1.java
p1.java
p2.java
PaLouTi.java
pom.xml
pom.xml
pom.xml
PriorityQueue.java
Problem310.java
Proxy.java
QueryTask.java
RateLimitingRequestSplitter.java
README.md
Review.java
ScheduledThreadPoolTest.java
SelfDefiniteThreadPool.java
ShapleyValueDemo.java
SingletonPattern.java
SocketDemo.java
ss.java
StackForQueue.java
StampedLockDemo.java
StaticObjTest.java
Stock.java
StrategyPattern.java
TC1.java
Tes1.java
Test.java
test.java
Test01.java
Test02.java
TestCacheThreadPool.java
TestDemo.java
TestInteger.java
testTry.java
ThreadDemo1.java
ThreadLocalExample.java
ThreadTest.java
TreeNode.java
tse.java
tx01.java
Write.java
xc328.java
Xie3_13.java
Unversioned Files
2024-09-29 23:44:30 +08:00
0f6a5b723f Default Changelist
2024_3_30.md
AbsoluteBeiBao.java
AbstractFactoryPattern.java
AffinityThreadPoolTest.java
AioServer.java
Alternate_printing.java
AppTest.java
AppTest.java
AtomicStampedReferenceDemo.java
BeiBao.java
ByteDance.java
byteStream.java
c2.java
cd.java
cglib.java
cglib.java
ChainPattern.java
CRC16_ARC.java
Custom.java
DePattern.java
DePatternTest.java
DirectoryToMarkdown.java
FactoryAndStrategy.java
FanxinTest.java
func.java
FutureRelative.java
FutureTask.java
hashDB.java
HS.java
IOCDemo.java
Jinshan.java
KaMa47.java
Kama55.java
LambdaClass.java
LC15.java
LCR001.java
LCR001.java
LCR001.java
LCR001.java
LCR089.java
LCR090.java
LCR090.java
LCR155.java
LCR181.java
LeeCode146.java
LeetCode1.java
LeetCode2.java
LeetCode002.java
LeetCode3.java
LeetCode3.java
LeetCode003.java
LeetCode4.java
LeetCode5.java
LeetCode5.java
LeetCode5.java
LeetCode5.java
LeetCode005.java
LeetCode6.java
LeetCode10.java
LeetCode11.java
LeetCode11.java
LeetCode11.java
LeetCode11.java
LeetCode12.java
LeetCode13.java
LeetCode14.java
LeetCode15.java
LeetCode15.java
LeetCode15.java
LeetCode15.java
LeetCode15_$.java
LeetCode17.java
LeetCode17_12BiNode.java
LeetCode18.java
LeetCode18.java
LeetCode18.java
LeetCode19.java
LeetCode19.java
LeetCode20.java
LeetCode20.java
LeetCode21.java
LeetCode21.java
LeetCode21.java
LeetCode22.java
LeetCode22.java
LeetCode22.java
LeetCode23.java
LeetCode23.java
LeetCode23.java
LeetCode24.java
LeetCode25.java
LeetCode26.java
LeetCode27.java
LeetCode28.java
LeetCode28.java
LeetCode28.java
LeetCode28.java
LeetCode28.java
LeetCode28.java
LeetCode28_false.java
LeetCode29.java
LeetCode31.java
LeetCode31.java
LeetCode31.java
LeetCode32.java
LeetCode32.java
LeetCode32.java
LeetCode32.java
LeetCode33.java
LeetCode33.java
LeetCode33.java
LeetCode34.java
LeetCode35.java
LeetCode36.java
LeetCode39.java
LeetCode40.java
LeetCode40.java
LeetCode40.java
LeetCode40.java
LeetCode42.java
LeetCode42.java
LeetCode42.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode45.java
LeetCode46.java
LeetCode46.java
LeetCode46.java
LeetCode47.java
LeetCode47.java
LeetCode47.java
LeetCode48.java
LeetCode48.java
LeetCode49.java
LeetCode51.java
LeetCode51.java
LeetCode51.java
LeetCode53.java
LeetCode53.java
LeetCode53.java
LeetCode53.java
LeetCode53.java
LeetCode53.java
LeetCode54.java
LeetCode55.java
LeetCode55.java
LeetCode55.java
LeetCode56.java
LeetCode57.java
LeetCode58.java
LeetCode59.java
LeetCode61.java
LeetCode62.java
LeetCode63.java
LeetCode64.java
LeetCode69.java
LeetCode69.java
LeetCode69.java
LeetCode69.java
LeetCode70.java
LeetCode71.java
LeetCode72.java
LeetCode72.java
LeetCode72.java
LeetCode73.java
LeetCode75.java
LeetCode75.java
LeetCode75.java
LeetCode77.java
LeetCode77.java
LeetCode77.java
LeetCode77.java
LeetCode78.java
LeetCode80.java
LeetCode82.java
LeetCode84.java
LeetCode84.java
LeetCode84.java
LeetCode84_1.java
LeetCode88.java
LeetCode90.java
LeetCode90.java
LeetCode90.java
LeetCode92.java
LeetCode93.java
LeetCode93.java
LeetCode94.java
LeetCode94.java
LeetCode94.java
LeetCode94.java
LeetCode94_145_144_102.java
LeetCode96.java
LeetCode96.java
LeetCode96.java
LeetCode96.java
LeetCode96.java
LeetCode98.java
LeetCode100.java
LeetCode101.java
LeetCode101.java
LeetCode101.java
LeetCode101.java
LeetCode102.java
LeetCode102.java
LeetCode104.java
LeetCode105.java
LeetCode105.java
LeetCode105.java
LeetCode105_106.java
LeetCode106.java
LeetCode107.java
LeetCode108.java
LeetCode110.java
LeetCode110.java
LeetCode110.java
LeetCode110.java
LeetCode110.java
LeetCode111.java
LeetCode112.java
LeetCode113.java
LeetCode114.java
LeetCode115.java
LeetCode115.java
LeetCode116.java
LeetCode121.java
LeetCode121.java
LeetCode121.java
LeetCode122.java
LeetCode122.java
LeetCode122.java
LeetCode124.java
LeetCode125.java
LeetCode128.java
LeetCode131.java
LeetCode131.java
LeetCode131.java
LeetCode131.java
LeetCode131.java
LeetCode134.java
LeetCode134.java
LeetCode134.java
LeetCode134.java
LeetCode134.java
LeetCode135.java
LeetCode135.java
LeetCode135.java
LeetCode135.java
LeetCode138.java
LeetCode139.java
LeetCode141.java
LeetCode142.java
LeetCode142.java
LeetCode144.java
LeetCode145.java
LeetCode145.java
LeetCode146.java
LeetCode150.java
LeetCode151.java
LeetCode151.java
LeetCode151.java
LeetCode151.java
LeetCode155.java
LeetCode160.java
LeetCode165.java
LeetCode167.java
LeetCode169.java
LeetCode189.java
LeetCode198.java
LeetCode199.java
LeetCode199.java
LeetCode199.java
LeetCode199.java
LeetCode202.java
LeetCode202.java
LeetCode202.java
LeetCode202.java
LeetCode202.java
LeetCode203.java
LeetCode203.java
LeetCode203.java
LeetCode203.java
LeetCode203.java
LeetCode203_false.java
LeetCode205.java
LeetCode206.java
LeetCode206.java
LeetCode206.java
LeetCode206.java
LeetCode206.java
LeetCode206.java
LeetCode206_false.java
LeetCode207.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209.java
LeetCode209_false.java
LeetCode210.java
LeetCode215.java
LeetCode216.java
LeetCode216.java
LeetCode216.java
LeetCode216.java
LeetCode219.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode222.java
LeetCode225.java
LeetCode225.java
LeetCode225.java
LeetCode225.java
LeetCode226.java
LeetCode228.java
LeetCode232.java
LeetCode232.java
LeetCode232.java
LeetCode232.java
LeetCode234.java
LeetCode235.java
LeetCode236.java
LeetCode236.java
LeetCode236.java
LeetCode236.java
LeetCode236.java
LeetCode236.java
LeetCode238.java
LeetCode239.java
LeetCode239_false.java
LeetCode242.java
LeetCode246.java
LeetCode257.java
LeetCode257.java
LeetCode257.java
LeetCode257.java
LeetCode274.java
LeetCode276.java
LeetCode277.java
LeetCode279.java
LeetCode279.java
LeetCode279.java
LeetCode279.java
LeetCode287.java
LeetCode287.java
LeetCode287.java
LeetCode287.java
LeetCode287.java
LeetCode287_false.java
LeetCode289.java
LeetCode290.java
LeetCode300.java
LeetCode300.java
LeetCode300.java
LeetCode309.java
LeetCode322.java
LeetCode322.java
LeetCode322.java
LeetCode322.java
LeetCode332difficult.java
LeetCode337.java
LeetCode337.java
LeetCode337.java
LeetCode337.java
LeetCode337_1.java
LeetCode343.java
LeetCode343.java
LeetCode343.java
LeetCode343.java
LeetCode344.java
LeetCode347.java
LeetCode347.java
LeetCode347.java
LeetCode347.java
LeetCode349.java
LeetCode350.java
LeetCode367.java
LeetCode376.java
LeetCode376.java
LeetCode376.java
LeetCode376.java
LeetCode376.java
LeetCode377.java
LeetCode377.java
LeetCode377.java
LeetCode380.java
LeetCode383.java
LeetCode392.java
LeetCode392.java
LeetCode392.java
LeetCode404.java
LeetCode406.java
LeetCode406.java
LeetCode406.java
LeetCode406.java
LeetCode415.java
LeetCode416.java
LeetCode416.java
LeetCode416.java
LeetCode416.java
LeetCode416.java
LeetCode429.java
LeetCode435.java
LeetCode435.java
LeetCode435.java
LeetCode435.java
LeetCode450.java
LeetCode450.java
LeetCode450.java
LeetCode450.java
LeetCode450.java
LeetCode452.java
LeetCode452.java
LeetCode452.java
LeetCode453.java
LeetCode454.java
LeetCode455.java
LeetCode459.java
LeetCode462.java
LeetCode468.java
LeetCode474.java
LeetCode474.java
LeetCode474.java
LeetCode491.java
LeetCode491.java
LeetCode491.java
LeetCode491.java
LeetCode494.java
LeetCode494.java
LeetCode494.java
LeetCode496.java
LeetCode496.java
LeetCode496.java
LeetCode501.java
LeetCode501.java
LeetCode501.java
LeetCode501.java
LeetCode503.java
LeetCode503.java
LeetCode503.java
LeetCode509.java
LeetCode509.java
LeetCode509.java
LeetCode513.java
LeetCode515.java
LeetCode516.java
LeetCode518.java
LeetCode530.java
LeetCode538.java
LeetCode541.java
LeetCode559.java
LeetCode583.java
LeetCode583.java
LeetCode617.java
LeetCode637.java
LeetCode647.java
LeetCode647.java
LeetCode647.java
LeetCode647.java
LeetCode647_1.java
LeetCode654.java
LeetCode669.java
LeetCode674.java
LeetCode674.java
LeetCode674.java
LeetCode698.java
LeetCode700.java
LeetCode701.java
LeetCode701.java
LeetCode701.java
LeetCode703.java
LeetCode704.java
LeetCode704.java
LeetCode705.java
LeetCode707.java
LeetCode707_2.java
LeetCode713.java
LeetCode713.java
LeetCode713.java
LeetCode713.java
LeetCode714.java
LeetCode718.java
LeetCode718.java
LeetCode718.java
LeetCode718.java
LeetCode738.java
LeetCode738.java
LeetCode738.java
LeetCode738.java
LeetCode738.java
LeetCode739.java
LeetCode739.java
LeetCode739.java
LeetCode746.java
LeetCode763.java
LeetCode763.java
LeetCode763.java
LeetCode763.java
LeetCode763.java
LeetCode860.java
LeetCode860.java
LeetCode860.java
LeetCode912.java
LeetCode912_SortArrays.java
LeetCode946.java
LeetCode968.java
LeetCode968.java
LeetCode968.java
LeetCode968.java
LeetCode968.java
LeetCode977.java
LeetCode989.java
LeetCode1005.java
LeetCode1005.java
LeetCode1005.java
LeetCode1005.java
LeetCode1035.java
LeetCode1047.java
LeetCode1049.java
LeetCode1049.java
LeetCode1049.java
LeetCode1049.java
LeetCode1143.java
LeetCode1143.java
LeetCode1143.java
LeetCode2487.java
LeetCode2487.java
LeetCode2487.java
LeetCode2487.java
LeetCode2487.java
LeetCode2487_false.java
LeetCode2602.java
LeetCode2602.java
LeetCode2602.java
LeetCode_0207_IntersectionNode.java
LeetCodeQuickSort.java
Line.java
ListNode.java
listSeries.java
MapUtils.java
MeiTuan24_3_9.java
MeiTuan24QiuZhao.java
meituan810.java
meituan824.java
Metituan2.java
MT.java
MT3_39.java
MyHashMap.java
MyHeap.java
Node.java
NoIElse.java
NoIfElse.java
Offer03.java
OptimisticLock.java
P1.java
P1.java
P1.java
P1.java
p1.java
p1.java
p1.java
p1.java
p1.java
p1.java
p2.java
PaLouTi.java
pom.xml
pom.xml
pom.xml
PriorityQueue.java
Problem310.java
Proxy.java
QueryTask.java
RateLimitingRequestSplitter.java
README.md
Review.java
ScheduledThreadPoolTest.java
SelfDefiniteThreadPool.java
ShapleyValueDemo.java
SingletonPattern.java
SocketDemo.java
ss.java
StackForQueue.java
StampedLockDemo.java
StaticObjTest.java
Stock.java
StrategyPattern.java
TC1.java
Tes1.java
Test.java
test.java
Test01.java
Test02.java
TestCacheThreadPool.java
TestDemo.java
TestInteger.java
testTry.java
ThreadDemo1.java
ThreadLocalExample.java
ThreadTest.java
TreeNode.java
tse.java
tx01.java
Write.java
xc328.java
Xie3_13.java
Unversioned Files
2024-09-29 23:42:34 +08:00
64ea4c89f0 Default Changelist
AioServer.java
SelfDefiniteThreadPool.java
2024-09-28 12:31:53 +08:00
574e99f373 Default Changelist
LCR001.java
LeetCode11.java
LeetCode277.java
LeetCode279.java
LeetCode322.java
LeetCode713.java
LeetCode1049.java
Tc.md
2024-09-27 20:42:08 +08:00
61d92b60d5 feat: 添加了LeetCode96, LeetCode416, LeetCode53, LeetCode135, LeetCode219, LeetCode406, LeetCode36四个Java类,分别对应LeetCode题目中的解法;
feat: 添加了FutureRelative类,用于演示Java中的Future和CompletableFuture用法;
feat: 添加了Solution1和Solution两个类,分别对应LeetCode36题目的两种解法;

Default Changelist
AffinityThreadPoolTest.java
FutureRelative.java
LeetCode36.java
LeetCode45.java
LeetCode53.java
LeetCode96.java
LeetCode134.java
LeetCode135.java
LeetCode219.java
LeetCode406.java
LeetCode416.java
LeetCode763.java
LeetCode968.java
LeetCode1005.java
P1.java
SocketDemo.java
2024-09-27 11:00:46 +08:00
2219024e1b 文档添加关于字符串、字节和void数据类型的说明
在NumPy文档中,常规介绍部分现在包含了关于字符串、字节和void数据类型的信息,以及现有的数值类型。

Default Changelist
LC15.java
LeetCode40.java
LeetCode55.java
LeetCode94.java
LeetCode131.java
LeetCode209.java
LeetCode222.java
LeetCode276.java
p1.java
2024-09-24 22:59:28 +08:00
6d49b27147 Default Changelist
AioServer.java
FactoryAndStrategy.java
LeetCode25.java
LeetCode49.java
LeetCode61.java
LeetCode71.java
LeetCode73.java
LeetCode114.java
LeetCode141.java
LeetCode228.java
LeetCode289.java
LeetCode290.java
LeetCode703.java
SingletonPattern.java
ThreadDemo1.java

AndStrategy类,使用策略模式优化支付方式。

这些更改包括对单例模式的实现、线程控制的改进、LeetCode问题的解决以及设计模式的应用。
2024-09-24 10:09:45 +08:00
33dffb6b07 文档更新:字符串、字节和void数据类型信息已添加到NumPy文档的常规介绍部分,与现有的数值类型信息并列。
错误修复:用户创建操作现在将正确分配UUID,由于SQL查询中参数顺序的问题已得到解决,确保用户可以成功创建。

功能优化:EntityClass的重新加载机制将遵循`flush`参数的指示,防止在刷新设置为false时刷新新实体。
2024-09-21 23:21:56 +08:00
661 changed files with 7449 additions and 284 deletions

76
ForJdk17/pom.xml Normal file
View File

@ -0,0 +1,76 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.example</groupId>
<artifactId>LeetCode</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>ForJdk17</artifactId>
<packaging>jar</packaging>
<name>ForJdk17</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<!-- JPA API -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.github.phantomthief</groupId>
<artifactId>simple-pool</artifactId>
<version>0.1.17</version>
</dependency>
<!--spring-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.3.18</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>5.8.18</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,58 @@
package cn.whaifree.designPattern.Factory;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/22 21:14
* @注释
*/
public class FactoryAndStrategy {
public static void main(String[] args) {
Factory factory = new Factory();
Pay pay = factory.getPay(PayType.WX);
pay.pay(100);
Pay pay2 = factory.getPay(PayType.WX);
pay2.pay(200);
}
interface Pay{
void pay(int price);
}
static class WxPay implements Pay {
@Override
public void pay(int price) {
System.out.println("微信支付:" + price);
}
}
static class AliPay implements Pay {
@Override
public void pay(int price) {
System.out.println("支付宝支付:" + price);
}
}
static class Factory{
public Pay getPay(PayType payType){
return payType.pay;
}
}
enum PayType {
WX(new WxPay()),
ALI(new AliPay()), // 单例
;
private Pay pay;
PayType(Pay pay) {
this.pay = pay;
}
}
}

View File

@ -3,12 +3,41 @@ package cn.whaifree.designPattern;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
import java.util.function.BiConsumer;
public class SingletonPattern {
static class LazySingleton {
private static LazySingleton instance;
private LazySingleton() {
}
public static LazySingleton getInstance() {
if (instance == null) {
instance = new LazySingleton();
}
return instance;
}
}
static class HungrySingleton {
private static final HungrySingleton instance = new HungrySingleton();
private HungrySingleton() {
}
public static HungrySingleton getInstance() {
return instance;
}
}
}
class Main{
public static void main(String[] args) {

View File

@ -1,4 +1,5 @@
package cn.whaifree.designPattern;
package cn.whaifree.designPattern.kama.CreateType.AbstractFactoryPattern;
public class AbstractFactoryPattern {
@ -60,12 +61,12 @@ class ModernChair implements Chair{
interface AbstractFactory{
Sofa generateSofa();
Chair generateChair();
}
// 现代工厂可以创建多种商品
class ModernFactory implements AbstractFactory {
@Override

View File

@ -0,0 +1,93 @@
package cn.whaifree.designPattern.kama.CreateType.BuildPattern;
import java.util.Scanner;
/**
*
* 构造器模式
* public BCycle build() {
* return new BCycle(this);
* }
* @version 1.0
* @Author whai文海
* @Date 2024/10/4 18:18
* @注释
*/
public class BuildPattern {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int i = scanner.nextInt();
for (int i1 = 0; i1 < i; i1++) {
String next = scanner.next();
BCycle bCycle = RoadType.getBCycle(next);
System.out.println(bCycle);
}
}
}
enum RoadType{
MOUNTAIN("mountain",BCycle.newBuilder().setFrame("Aluminum Frame").setTries("Knobby Tires").build()),
ROAD("road",BCycle.newBuilder().setFrame("Carbon Frame").setTries("Slim Tires").build());
String key;
BCycle bCycle;
RoadType(String road, BCycle build) {
this.key = road;
this.bCycle = build;
}
public static BCycle getBCycle(String key){
for (RoadType roadType : RoadType.values()) {
if(roadType.key.equals(key)){
return roadType.bCycle;
}
}
return null;
}
}
class BCycle{
private String frame;
private String tires;
public BCycle(Builder builder) {
this.frame = builder.frame;
this.tires = builder.tires;
}
static Builder newBuilder(){
return new Builder();
}
static class Builder{
private String frame;
private String tires;
public BCycle build() {
return new BCycle(this);
}
public Builder setFrame(String frame) {
this.frame = frame;
return this;
}
public Builder setTries(String tries) {
this.tires = tries;
return this;
}
}
@Override
public String toString() {
return frame + " " + tires;
}
}

View File

@ -0,0 +1,132 @@
package cn.whaifree.designPattern.kama.CreateType.FactoryMethodPattern;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
/**
*
* 工厂方法模式
*
* 工厂方法模式
* 单一产品工厂方法模式主要用于创建单一类型的产品它定义了一个创建对象的接口但允许子类决定实例化哪一个类
* 单一责任原则工厂方法模式中的工厂类只负责创建一种产品
*
* 扩展性当需要增加新的产品时需要新增具体的工厂类
* 代码结构
* 定义一个创建产品的接口
* 具体工厂实现这个接口来创建对应的具体产品
*
*
* 抽象工厂模式
* 产品族抽象工厂模式用于创建一组相关或依赖的对象即产品族而无需指定它们具体的类
* 多产品一个工厂可以创建多个相关的对象
* 扩展性当需要增加新的产品族时需要新增具体的工厂类但当需要增加新的产品种类时不需要修改现有的工厂类
* 代码结构
* 定义一个创建一系列相关产品的接口
* 具体工厂实现这个接口来创建对应的一系列具体产品
*
*
* @version 1.0
* @Author whai文海
* @Date 2024/10/4 16:28
* @注释
*/
public class FactoryMethodPattern {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int i = scanner.nextInt();
for (int i1 = 0; i1 < i; i1++) {
String next = scanner.next();
int j = scanner.nextInt();
// for (int i2 = 0; i2 < j; i2++) {
// Context.getFactory(next).produce();
// }
for (int k = 0; k < j; k++) {
FactoryContext.getiFactory(next).produce();
}
}
}
}
enum FactoryContext {
Circle("Circle", new CircleFactory()),
Square("Square", new SquareFactory()),
;
String name;
IFactory iFactory;
FactoryContext(String name, IFactory iFactory) {
this.name = name;
this.iFactory = iFactory;
}
public static IFactory getiFactory(String key) {
for (FactoryContext value : values()) {
if (value.name.equals(key)) {
return value.iFactory;
}
}
return null;
}
}
class Context{
static Map<String, IFactory> map = new HashMap<>();
static {
map.put("Circle", new CircleFactory());
map.put("Square", new SquareFactory());
}
public static IFactory getFactory(String key){
if (map.containsKey(key)) {
return map.get(key);
}
return new IFactory() {
@Override
public Shape produce() {
System.out.println("No Factory");
return null;
}
};
}
}
class Shape{
}
class Circle extends Shape{
}
class Square extends Shape{
}
interface IFactory{
Shape produce();
}
class CircleFactory implements IFactory{
@Override
public Shape produce() {
System.out.println("Circle Block");
return new Circle();
}
}
class SquareFactory implements IFactory{
@Override
public Shape produce() {
System.out.println("Square Block");
return new Square();
}
}

View File

@ -0,0 +1,50 @@
package cn.whaifree.designPattern.kama.CreateType.PrototypePattern;
import java.util.Scanner;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/4 18:35
* @注释
*/
public class PrototypePattern {
public static void main(String[] args) throws CloneNotSupportedException {
Scanner scanner = new Scanner(System.in);
String color = scanner.next();
int height = scanner.nextInt();
int width = scanner.nextInt();
int num = scanner.nextInt();
Shape shape = new Shape(color, width, height);
for (int i = 0; i < num; i++) {
System.out.println(shape.clone());
}
}
}
class Shape implements Cloneable{
String color;
int width;
int height;
@Override
public String toString() {
// Color: Red, Width: 10, Height: 5
return "Color: " + color + ", Width: " + width + ", Height: " + height;
}
public Shape(String color, int width, int height) {
this.color = color;
this.width = width;
this.height = height;
}
@Override
protected Shape clone() throws CloneNotSupportedException {
return (Shape) super.clone();
}
}

View File

@ -0,0 +1,68 @@
package cn.whaifree.designPattern.kama.StructureType.AdapterPattern;
import java.util.Scanner;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/4 18:58
* @注释
*/
public class AdapterPattern {
public static void main(String[] args) {
USBAdapter usbAdapter = new USBAdapter();
Computer computer = new Computer();
Scanner scanner = new Scanner(System.in);
int i = scanner.nextInt();
for (int i1 = 0; i1 < i; i1++) {
int i2 = scanner.nextInt();
if (i2 == 1) {
System.out.println(computer.inject(new TypeCInterface()));
}else if (i2 == 2){
USBInterface usbInterface = new USBInterface(); // USB接口
TypeCInterface adapt = usbAdapter.adapt(usbInterface);// 适配器转换为TypeC
System.out.println(computer.inject(adapt));
}
}
}
}
class Computer{
public String inject(TypeCInterface in) {
return in.data;
}
}
abstract class Interface{
String data;
}
class USBAdapter {
public TypeCInterface adapt(USBInterface usbInterface) {
return new TypeCInterface(usbInterface.data + " Adapter");
}
}
class USBInterface extends TypeCInterface {
public USBInterface() {
this.data = "USB";
}
}
class TypeCInterface extends Interface {
public TypeCInterface() {
this.data = "TypeC";
}
public TypeCInterface(String data) {
this.data = data;
}
}

View File

@ -0,0 +1,84 @@
package cn.whaifree.designPattern.kama.StructureType.BridgingPattern;
import java.util.Scanner;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/5 18:36
* @注释
*/
public class BridgingPattern {
interface TEL{
public void showBrand();
}
static class Sony implements TEL{
public void showBrand(){
System.out.print("Sony TV");
}
}
static class TCL implements TEL{
public void showBrand(){
System.out.print("TCL TV");
}
}
static abstract class Operation{
protected TEL tel;
public void setTel(TEL tel){
this.tel = tel;
}
public abstract void operation();
}
static class Open extends Operation{
public void operation(){
tel.showBrand();
System.out.println(" is ON");
}
}
static class Close extends Operation{
public void operation(){
tel.showBrand();
System.out.println(" is OFF");
}
}
static class Switch extends Operation{
public void operation(){
System.out.print("Switching ");
tel.showBrand();
System.out.println(" channel");
}
}
class Main{
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int nums = sc.nextInt();
TEL tel;
Operation opera;
while(nums-- > 0){
int type = sc.nextInt();
int move = sc.nextInt();
if(type == 0){
tel = new Sony();
}else{
tel = new TCL();
}
if(move == 2){
opera = new Open();
opera.setTel(tel);
opera.operation();
}else if(move == 3){
opera = new Close();
opera.setTel(tel);
opera.operation();
}else{
opera = new Switch();
opera.setTel(tel);
opera.operation();
}
}
}
}
}

View File

@ -0,0 +1,102 @@
package cn.whaifree.designPattern.kama.StructureType.ComboPattern;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/5 19:11
* @注释
*/
public class ComboPattern {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
CompanyComposite company = new CompanyComposite(sc.next());
DepartmentComposite departmentComposite = null;
int n = sc.nextInt();
while(n > 0){
String type = sc.next();
if(type.equals("D")){
String department = sc.next();
departmentComposite = new DepartmentComposite(department);
company.add(departmentComposite);
}else{
String personnel = sc.next();
PersonnelLeaf personnelLeaf = new PersonnelLeaf(personnel);
if(departmentComposite != null) {
departmentComposite.add(personnelLeaf);
}
}
n--;
}
System.out.println("Company Structure:");
company.print();
}
// Component
interface Component{
void print();
}
// Leaf
static class PersonnelLeaf implements Component{
private String name;
public PersonnelLeaf(String name){
this.name = name;
}
@Override
public void print() {
System.out.println(" "+name);
}
}
// Composite
// 部门
static class DepartmentComposite implements Component{
private String name;
private List<Component> list = new ArrayList<>();
public DepartmentComposite(String name){
this.name = name;
}
public void add(Component component){
list.add(component);
}
@Override
public void print() {
System.out.println(" " + name);
for(Component component : list){
component.print();
}
}
}
// 公司-- 下面包括多个子类部门-->员工
static class CompanyComposite implements Component{
private String name;
private List<Component> list = new ArrayList<>();
public CompanyComposite(String name){
this.name = name;
}
public void add(Component component){
list.add(component);
}
@Override
public void print() {
System.out.println(name);
for(Component component : list){
component.print();
}
}
}
}

View File

@ -0,0 +1,81 @@
package cn.whaifree.designPattern.kama.StructureType.DecoratorPattern;
import java.util.Scanner;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/5 16:43
* @注释
*/
public class DecoratorPattern {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int a = scanner.nextInt();
int b = scanner.nextInt();
if (a == 1) {
Coffee blackCoffee = new BlackCoffee();
CoffeeDecorator coffeeDecorator = new CoffeeDecorator(blackCoffee);
coffeeDecorator.decorate(blackCoffee, b);
} else {
Coffee latte = new Latte();
CoffeeDecorator coffeeDecorator = new CoffeeDecorator(latte);
coffeeDecorator.decorate(latte, b);
}
}
}
}
interface Coffee {
void addCoffeeBeans();
}
class BlackCoffee implements Coffee {
@Override
public void addCoffeeBeans() {
System.out.println("Brewing Black Coffee");
}
}
class Latte implements Coffee {
@Override
public void addCoffeeBeans() {
System.out.println("Brewing Latte");
}
}
class CoffeeDecorator {
private final Coffee coffee;
public CoffeeDecorator(Coffee coffee) {
this.coffee = coffee;
}
public Coffee decorate(Coffee coffee, int add) {
if (add == 1) {
addMilk(coffee);
} else {
addSugar(coffee);
}
return coffee;
}
public void addMilk(Coffee coffee) {
coffee.addCoffeeBeans();
System.out.println("Adding Milk");
}
public void addSugar(Coffee coffee) {
coffee.addCoffeeBeans();
System.out.println("Adding Sugar");
}
}

View File

@ -0,0 +1,53 @@
package cn.whaifree.designPattern.kama.StructureType.EnjoyPattern;
import java.util.HashMap;
import java.util.Map;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/5 19:17
* @注释
*/
public class EnjoyPattern {
class Shape{
private String id;
private int x;
private int y;
public Shape(String id, int x, int y) {
this.id = id;
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
}
class ShareFactory{
Map<String, Shape> map;
public ShareFactory() {
this.map = new HashMap<>();
}
public Shape setAndGetShape(String id,int x,int y){
Shape shape = map.get(id);
if (shape == null) {
shape = new Shape(id, x, y);
}
return shape;
}
}
}

View File

@ -0,0 +1,79 @@
package cn.whaifree.designPattern.kama.StructureType.FacadePattern;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/5 18:15
* @注释
*/
public class FacadePattern {
// 提供了一个统一的接口用于访问子系统中的一群接口
public class Facade {
private Switch ac;
private Switch lamp;
private Switch tv;
public Facade(Switch ac, Switch lamp, Switch tv) {
this.ac = ac;
this.lamp = lamp;
this.tv = tv;
}
public void turnOffAll() {
ac.off();
lamp.off();
tv.off();
}
public void turnOff(int o) {
switch (o) {
case 1:
ac.off();
break;
case 2:
lamp.off();
break;
case 3:
tv.off();
break;
default:
System.out.println("Invalid option.");
}
}
}
// SubSystemClasses
// 开关
interface Switch{
void off();
}
//空调
class AirConditioning implements Switch {
@Override
public void off() {
System.out.println("Air Conditioner is turned off.");
}
}
//台灯
class DeskLamp implements Switch {
@Override
public void off() {
System.out.println("Desk Lamp is turned off.");
}
}
//电视机
class Television implements Switch {
@Override
public void off() {
System.out.println("Television is turned off.");
}
}
}

View File

@ -0,0 +1,54 @@
package cn.whaifree.designPattern.kama.StructureType.FacadePattern;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/5 18:33
* @注释
*/
public class SpringFactoryBean {
}
//class ProxyFactoryBean extends ProxyCreatorSupport implements FactoryBean<Object>, BeanClassLoaderAware, BeanFactoryAware {
//
//
// /**
// * 门面模式的获取对象
// * @return
// * @throws BeansException
// */
// @Nullable
// public Object getObject() throws BeansException {
// this.initializeAdvisorChain();
// if (this.isSingleton()) {
// return this.getSingletonInstance();
// } else {
// if (this.targetName == null) {
// this.logger.info("Using non-singleton proxies with singleton targets is often undesirable. Enable prototype proxies by setting the 'targetName' property.");
// }
//
// return this.newPrototypeInstance();
// }
// }
//
// private synchronized Object getSingletonInstance() {
// if (this.singletonInstance == null) {
// this.targetSource = this.freshTargetSource();
// if (this.autodetectInterfaces && this.getProxiedInterfaces().length == 0 && !this.isProxyTargetClass()) {
// Class<?> targetClass = this.getTargetClass();
// if (targetClass == null) {
// throw new FactoryBeanNotInitializedException("Cannot determine target class for proxy");
// }
//
// this.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, this.proxyClassLoader));
// }
//
// super.setFrozen(this.freezeProxy);
// this.singletonInstance = this.getProxy(this.createAopProxy());
// }
//
// return this.singletonInstance;
// }
//
//}

View File

@ -0,0 +1,69 @@
package cn.whaifree.designPattern.kama.StructureType.ProxyPattern;
import lombok.Data;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/5 16:30
* @注释
*/
public class ProxyPattern {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int i = scanner.nextInt();
Integer[] sizes = new Integer[i];
for (int i1 = 0; i1 < i; i1++) {
sizes[i1] = scanner.nextInt();
}
User user = new User();
Proxy proxy = new Proxy(sizes);
proxy.rent(user);
}
@Data
static class House{
int size;
public House(int size) {
this.size = size;
}
}
static class Proxy {
List<House> housee;
// 所有房源
public Proxy(Integer... integers) {
housee = Arrays.stream(integers).map(House::new).collect(Collectors.toList());
}
public void rent(User user) {
housee.forEach(
house -> {
if (house.size < 100) {
System.out.println("No");
}else {
user.rent();
}
}
);
}
}
static class User{
public void rent() {
System.out.println("YES");
}
}
}

View File

@ -0,0 +1,61 @@
package cn.whaifree.interview.HKWS;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/10/1 11:25
* @注释
*/
public class P241001 {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int left;
left = Integer.parseInt(in.nextLine().trim());
int right;
right = Integer.parseInt(in.nextLine().trim());
int[] res = new P241001().getPrimes(left, right);
if(res==null||res.length==0){
System.out.print("-1");
}
for(int res_i=0; res_i < res.length; res_i++) {
System.out.print(String.valueOf(res[res_i])+" ");
}
}
/* Write Code Here */
public int[] getPrimes(int left, int right) {
List<Integer> res = new ArrayList<>();
while (left <= right) {
if (isPrime(left)) {
res.add(left);
}
left++;
}
int[] re = new int[res.size()];
for (int i = 0; i < re.length; i++) {
re[i] = res.get(i);
}
return re;
}
public static boolean isPrime(int n) {
if (n <= 1) {
return false;
}
for (int i = 2; i * i <= n; i++) {
if ( n % i == 0){
return false;
}
}
return true;
}
}

View File

@ -0,0 +1,64 @@
package cn.whaifree.interview.HS.Qz;
import java.util.Scanner;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/26 18:56
* @注释
*/
public class P1 {
public static void main(String[] args) {
// a + b = c 一只c a*b 的最大值
Scanner scanner = new Scanner(System.in);
long i = scanner.nextLong();
long maxProduct = 0;
for (int j = 0; j <= i; j++) {
long b = i - j;
long product = b * j;
maxProduct = Math.max(product, maxProduct);
}
System.out.println(maxProduct);
}
}
class p2{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext hasNextLine 的区别
int n = in.nextInt();
int k = in.nextInt();
if (n <= 1) {
System.out.println(-1);
return;
}
int[] nums = new int[n];
for (int i = 0; i < nums.length; i++) {
nums[i] = in.nextInt();
}
int tmp = 0;
for (int i = 1; i < nums.length; i++) {
int search = search(nums[i], nums[i - 1]);
if (search != -1) {
tmp = Math.max(search, tmp);
}
}
System.out.println(tmp);
}
public static int search(int a, int b) {
int tmp = Math.min(a, b);
while (tmp > 0) {
if (a % tmp == 0 && b % tmp == 0) {
return tmp;
}
tmp--;
}
return -1;
}
}

View File

@ -0,0 +1,10 @@
package cn.whaifree.interview.qz.huachen;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/19 18:55
* @注释
*/
public class P1 {
}

View File

@ -0,0 +1,10 @@
package cn.whaifree.interview.qz.suiyou;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/24 19:18
* @注释
*/
public class p1 {
}

View File

@ -0,0 +1,137 @@
package cn.whaifree.interview.qz.zzyc;
import java.util.*;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/20 0:35
* @注释
*/
public class p1 {
public static void main(String[] args) {
List<Integer> list = Arrays.asList(0, 11, 12, 13,1);
System.out.println(new p1().isStraight(new ArrayList<>(list)));
}
/**
* <img src="https://pic.leetcode-cn.com/1599885716-MGMODX-Picture1.png"/>
* 1. 排序
*
*
* 给定的5张牌是否是顺子
* @param nums int整型ArrayList 扑克牌对应的数字集合
* @return bool布尔型
*/
public boolean isStraight (ArrayList<Integer> nums) {
// write code here
Collections.sort(nums);
if (inEdge(nums)) { // 如果出现1 10 11 12 13 这种情况
return true;
}
int joker = -1;
for (int i = 0; i < nums.size() - 1; i++) {
if (nums.get(i) == 0) {
joker++;
} else if (nums.get(i).equals(nums.get(i + 1))) {
return false; // 排序后出现重复不可能是顺子
}
}
// 比如 5 4 3 2 1 最大的减去最小在范围内
return nums.get(4) - nums.get(joker + 1) < 5;
}
static ArrayList<ArrayList<Integer>> o = new ArrayList<>();
static {
o.add(new ArrayList<>(Arrays.asList(0, 11, 12, 13, 1)));
o.add(new ArrayList<>(Arrays.asList(0, 10, 12, 13, 1)));
o.add(new ArrayList<>(Arrays.asList(0, 10, 11, 13, 1)));
o.add(new ArrayList<>(Arrays.asList(0, 10, 11, 12, 1)));
o.add(new ArrayList<>(Arrays.asList(0, 10, 11, 12, 13)));
o.add(new ArrayList<>(Arrays.asList(1, 10, 11, 12, 13)));
}
public static boolean inEdge(ArrayList<Integer> list) {
for (ArrayList<Integer> integers : o) {
if (integers.equals(list)) {
return true;
}
}
return false;
}
class Solution {
public boolean checkDynasty(int[] places) {
Set<Integer> repeat = new HashSet<>();
int max = 0, min = 14;
for(int place : places) {
if(place == 0) continue; // 跳过未知朝代
max = Math.max(max, place); // 最大编号朝代
min = Math.min(min, place); // 最小编号朝代
if(repeat.contains(place)) {
return false; // 若有重复提前返回 false
}
repeat.add(place); // 添加此朝代至 Set
}
return max - min < 5; // 最大编号朝代 - 最小编号朝代 < 5 则连续
}
}
}
class P{
public static void main(String[] args) {
List<Integer> list = Arrays.asList(1, 4, 6, 6, 11);
System.out.println(prize(new ArrayList<>(list), 12));
}
/**
* 代码中的类名方法名参数名已经指定请勿修改直接返回方法规定的值即可
*
*
* @param res int整型ArrayList
* @param target int整型
* @return int整型
*/
public static int prize (ArrayList<Integer> res, int target) {
// write code here
// for (int i = 0; i < res.size(); i++) {
// if (res.get(i) >= target) {
// return i;
// }
// }
int left = 0;
int right = res.size() - 1;
while (left <= right) {
int mid = (left + right) / 2;
if (res.get(mid) > target) {
right = mid - 1;
} else if (res.get(mid) == target) {
return mid + 1;
}else {
left = mid + 1;
}
}
if (left < res.size() && res.get(left) > target) {
return left + 1;
}
return -1;
}
}

View File

@ -0,0 +1,68 @@
package cn.whaifree.leetCode.Array;
import org.junit.Test;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/19 23:02
* @注释
*/
public class LeetCode167 {
@Test
public void test() {
Solution1 solution = new Solution1();
int[] ints = solution.twoSum(new int[]{2,7,11,15}, 9);
System.out.println(ints[0] + " " + ints[1]);
}
class Solution {
public int[] twoSum(int[] numbers, int target) {
for (int i = 0; i < numbers.length; i++) {
int tar = target - numbers[i];
int j = binarySearch(numbers, tar);
if (j != -1 && i != j) {
return i < j ? new int[]{i + 1, j + 1} : new int[]{j + 1, i + 1};
}
}
return null;
}
public int binarySearch(int[] nums, int target) {
int left = 0;
int right = nums.length - 1;
while (left <= right) {
int mid = (left + right) / 2;
if (nums[mid] == target) {
return mid;
} else if (nums[mid] < target) {
left = mid + 1;
} else {
right = mid - 1;
}
}
return -1;
}
}
class Solution1 {
public int[] twoSum(int[] numbers, int target) {
int left = 0;
int right = numbers.length - 1;
while (left < right) {
int sum = numbers[left] + numbers[right];
if (sum == target) {
return new int[]{left + 1, right + 1};
} else if (sum < target) {
left++;
}else {
right--;
}
}
return null;
}
}
}

View File

@ -0,0 +1,87 @@
package cn.whaifree.leetCode.Array;
import org.junit.Test;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/22 14:56
* @注释
*/
public class LeetCode228 {
public static void main(String[] args) throws IOException {
AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(Paths.get("D:\\project\\LeetCode\\README.md"), StandardOpenOption.READ);
ByteBuffer buffer = ByteBuffer.allocate(1024);
Future<Integer> result = fileChannel.read(buffer, 0);
while (!result.isDone()) {
// do something
}
}
@Test
public void test() {
int[] nums = {0, 2};
System.out.println(new Solution().summaryRanges(nums));
}
class Solution {
// public List<String> summaryRanges(int[] nums) {
// List<String> path = new ArrayList<>();
// List<String> res = new ArrayList<>();
// for (int i = 1; i < nums.length; i++) {
// if (nums[i] != nums[i - 1]) {
// StringBuilder str = new StringBuilder();
// for (int j = 0; j < path.size()-1; j++) {
// str.append(path.get(j));
// str.append("->");
// }
// str.append(path.get(path.size() - 1));
// path.clear();
// }
// path.add(String.valueOf(nums[i]));
// }
// }
public List<String> summaryRanges(int[] nums) {
List<String> res = new ArrayList<>();
int left = 0;
int right = 1;
while (right < nums.length) {
if (nums[right] != nums[right - 1] + 1) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(nums[left]);
if (left != right - 1) {
stringBuilder.append("->");
stringBuilder.append(nums[right - 1]);
}
res.add(stringBuilder.toString());
left = right;
}
right++;
}
if (left < nums.length) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(nums[left]);
if (left != right - 1) {
stringBuilder.append("->");
stringBuilder.append(nums[right - 1]);
}
res.add(stringBuilder.toString());
}
return res;
}
}
}

View File

@ -0,0 +1,102 @@
package cn.whaifree.leetCode.Array;
import org.junit.Test;
import java.util.Arrays;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/23 11:08
* @注释
*/
public class LeetCode289 {
@Test
public void test() {
int[][] board = new int[][]{{0, 1, 0}, {0, 0, 1}, {1, 1, 1}, {0, 0, 0}};
new Solution().gameOfLife(board);
for (int[] ints : board) {
System.out.println(Arrays.toString(ints));
}
}
class Solution {
/**
* 为了保证当前修改后的状态不会影响下一个状态的判定设置另外的状态
* 如题所示只有三种
* 1. 如果当前是活细胞但是变成了死细胞那么设置为-1
* 2. 如果当前是活细胞仍然是活细胞那么不变仍为1
* 3. 如果当前是死细胞但是变成了活细胞那么设置为2
* 那么最后遍历修改完状态之后-1修改回为02修改回为1
* @param board
*/
public void gameOfLife(int[][] board) {
//设置方向来遍历某个节点周围的另外几个节点
int[] ner = new int[]{-1,0,1};
//获取行和列
int rows = board.length;
int cols = board[0].length;
//遍历每一个节点格子
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
//设置当前节点周围的存活细胞的数量
int liveNer = 0;
/**
* 当前节点是[ i , j ]
* [i-1,j-1] [i-1,j] [i-1,j+1]
* [ i ,j-1] [ i ,j] [ i ,j+1]
* [i+1,j-1] [i+1,j] [i+1,j+1]
* 那么以当前节点为中心要求周围的节点则最多是3*3形式
* 并且所有的行和列都是用当前节点+1或者-1或者不变构成
* 所以我们设置 ner = {-1,0,1} 来形成遍历
*/
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
//必须保证不计算当前节点(不计算自己)
if (!(ner[i]==0 && ner[j]==0)){
//当前节点的相邻节点坐标
int r = row+ner[i];
int c = col+ner[j];
/**判断当前周围节点的存活状态要求满足两个状态
* 1. 必须保证要在 board 矩阵中
* 2. 并且**起始状态要是存活则当前状态为1或者-1都可以(因为这两个状态都表示起始状态为活细胞)**
**/
if ((r >= 0 && r < rows) && (c >= 0 && c < cols) && (Math.abs(board[r][c]) == 1)) {
// -1和1 初始状态都是活细胞
liveNer++;
}
}
}
}
/**开始判断当前节点的存活状态
* 因为遍历到当前节点的时候还没有开始修改细胞状态所以还是0和1的细胞状态
* 那么只需要判断状态变化的即可否则状态不变
**/
if ((board[row][col]==1) && ( liveNer>3 || liveNer<2)){
// -1 代表这个细胞过去是活的现在死了
board[row][col]=-1;
}
if (board[row][col]==0 && ( liveNer==3)){
// 2 代表这个细胞过去是死的现在活了
board[row][col]=2;
}
}
}
//再把额外的状态修改回去
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
if (board[row][col] == 2) {
board[row][col] = 1;
}
if (board[row][col] == -1){
board[row][col] = 0;
}
}
}
}
}
}

View File

@ -0,0 +1,51 @@
package cn.whaifree.leetCode.Array;
import org.junit.Test;
import java.util.PriorityQueue;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/22 15:14
* @注释
*/
public class LeetCode703 {
@Test
public void test() {
KthLargest kthLargest = new KthLargest(3, new int[]{});
System.out.println(kthLargest.add(3));
System.out.println(kthLargest.add(5));
System.out.println(kthLargest.add(10));
System.out.println(kthLargest.add(9));
System.out.println(kthLargest.add(4));
}
class KthLargest {
PriorityQueue<Integer> priorityQueue = null;
int size = 0;
// 小顶堆 第k
public KthLargest(int k, int[] nums) {
priorityQueue = new PriorityQueue<>();
this.size = k;
for (int num : nums) {
priorityQueue.offer(num);
if (priorityQueue.size() > k) {
priorityQueue.poll();
}
}
}
public int add(int val) {
priorityQueue.offer(val);
if (priorityQueue.size() > size) {
priorityQueue.poll();
}
return priorityQueue.peek();
}
}
}

View File

@ -0,0 +1,52 @@
package cn.whaifree.leetCode.Array;
import org.junit.Test;
import java.util.Arrays;
/**
* @version 1.0
* @Author whai文海
* @Date 2024/9/23 9:18
* @注释
*/
public class LeetCode73 {
@Test
public void test() {
int[][] matrix = new int[][]{{1, 1, 1}, {1, 0, 1}, {1, 1, 1}};
new Solution().setZeroes(matrix);
for (int[] ints : matrix) {
System.out.println(Arrays.toString(ints));
}
}
class Solution {
public void setZeroes(int[][] matrix) {
int yLen = matrix.length;
boolean[] row = new boolean[yLen];
int xLen = matrix[0].length;
boolean[] col = new boolean[xLen];
for (int y = 0; y < yLen; y++) {
for (int x = 0; x < xLen; x++) {
if (matrix[y][x] == 0) {
row[y] = true;
col[x] = true;
}
}
}
for (int y = 0; y < yLen; y++) {
for (int x = 0; x < xLen; x++) {
if (row[y] || col[x]) {
matrix[y][x] = 0;
}
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More