From 5eaf6ea940c1cf6dbaa31618dfd283abb93d5330 Mon Sep 17 00:00:00 2001 From: baowj Date: Thu, 2 Nov 2023 11:02:22 +0800 Subject: [PATCH] 2023/11/2 --- .gitignore | 2 + .../leetcode/com/leetcode/MapSum$Node.class | Bin 724 -> 0 bytes .../leetcode/com/leetcode/MapSum.class | Bin 1550 -> 0 bytes .../leetcode/com/leetcode/MyCalendarTwo.class | Bin 2645 -> 0 bytes .../leetcode/com/leetcode/Solution.class | Bin 1035 -> 0 bytes .../leetcode/com/leetcode/Solution1005.class | Bin 997 -> 0 bytes .../leetcode/com/leetcode/Solution1034.class | Bin 1757 -> 0 bytes .../leetcode/com/leetcode/Solution1816.class | Bin 696 -> 0 bytes .../leetcode/com/leetcode/Solution318.class | Bin 1027 -> 0 bytes .../leetcode/com/leetcode/Solution319.class | Bin 456 -> 0 bytes .../leetcode/com/leetcode/Solution372.class | Bin 977 -> 0 bytes .../leetcode/com/leetcode/Solution383.class | Bin 873 -> 0 bytes .../leetcode/com/leetcode/Solution397.class | Bin 1060 -> 0 bytes .../leetcode/com/leetcode/Solution519.class | Bin 1291 -> 0 bytes .../leetcode/com/leetcode/Solution520.class | Bin 816 -> 0 bytes .../leetcode/com/leetcode/Solution56.class | Bin 837 -> 0 bytes .../leetcode/com/leetcode/Solution563.class | Bin 811 -> 0 bytes .../leetcode/com/leetcode/Solution594.class | Bin 675 -> 0 bytes .../leetcode/com/leetcode/Solution689.class | Bin 1192 -> 0 bytes .../leetcode/com/leetcode/Solution700.class | Bin 665 -> 0 bytes .../leetcode/com/leetcode/Solution709.class | Bin 1709 -> 0 bytes .../leetcode/com/leetcode/Solution748.class | Bin 1388 -> 0 bytes .../leetcode/com/leetcode/Solution794.class | Bin 1828 -> 0 bytes .../leetcode/com/leetcode/Solution851.class | Bin 1651 -> 0 bytes .../com/leetcode/TopVotedCandidate.class | Bin 1534 -> 0 bytes .../leetcode/com/leetcode/TreeNode.class | Bin 612 -> 0 bytes src/main/java/com/leetcode/1155.java | 28 +++++++ src/main/java/com/leetcode/2034.java | 71 ++++++++++++++++++ src/main/java/com/leetcode/2103.java | 24 ++++++ src/main/java/com/leetcode/2512.java | 38 ++++++++++ src/main/java/com/leetcode/2530.java | 25 ++++++ src/main/java/com/leetcode/2578.java | 31 ++++++++ src/main/java/com/leetcode/2678.java | 13 ++++ src/main/java/com/leetcode/2698.java | 25 ++++++ src/main/java/com/leetcode/274.java | 25 ++++++ src/main/java/com/leetcode/275.java | 12 +++ 36 files changed, 294 insertions(+) create mode 100644 .gitignore delete mode 100644 out/production/leetcode/com/leetcode/MapSum$Node.class delete mode 100644 out/production/leetcode/com/leetcode/MapSum.class delete mode 100644 out/production/leetcode/com/leetcode/MyCalendarTwo.class delete mode 100644 out/production/leetcode/com/leetcode/Solution.class delete mode 100644 out/production/leetcode/com/leetcode/Solution1005.class delete mode 100644 out/production/leetcode/com/leetcode/Solution1034.class delete mode 100644 out/production/leetcode/com/leetcode/Solution1816.class delete mode 100644 out/production/leetcode/com/leetcode/Solution318.class delete mode 100644 out/production/leetcode/com/leetcode/Solution319.class delete mode 100644 out/production/leetcode/com/leetcode/Solution372.class delete mode 100644 out/production/leetcode/com/leetcode/Solution383.class delete mode 100644 out/production/leetcode/com/leetcode/Solution397.class delete mode 100644 out/production/leetcode/com/leetcode/Solution519.class delete mode 100644 out/production/leetcode/com/leetcode/Solution520.class delete mode 100644 out/production/leetcode/com/leetcode/Solution56.class delete mode 100644 out/production/leetcode/com/leetcode/Solution563.class delete mode 100644 out/production/leetcode/com/leetcode/Solution594.class delete mode 100644 out/production/leetcode/com/leetcode/Solution689.class delete mode 100644 out/production/leetcode/com/leetcode/Solution700.class delete mode 100644 out/production/leetcode/com/leetcode/Solution709.class delete mode 100644 out/production/leetcode/com/leetcode/Solution748.class delete mode 100644 out/production/leetcode/com/leetcode/Solution794.class delete mode 100644 out/production/leetcode/com/leetcode/Solution851.class delete mode 100644 out/production/leetcode/com/leetcode/TopVotedCandidate.class delete mode 100644 out/production/leetcode/com/leetcode/TreeNode.class create mode 100644 src/main/java/com/leetcode/1155.java create mode 100644 src/main/java/com/leetcode/2034.java create mode 100644 src/main/java/com/leetcode/2103.java create mode 100644 src/main/java/com/leetcode/2512.java create mode 100644 src/main/java/com/leetcode/2530.java create mode 100644 src/main/java/com/leetcode/2578.java create mode 100644 src/main/java/com/leetcode/2678.java create mode 100644 src/main/java/com/leetcode/2698.java create mode 100644 src/main/java/com/leetcode/274.java create mode 100644 src/main/java/com/leetcode/275.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..37b1922 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.idea/ +/out/ diff --git a/out/production/leetcode/com/leetcode/MapSum$Node.class b/out/production/leetcode/com/leetcode/MapSum$Node.class deleted file mode 100644 index 12f7f1d167c950486eb3f0b1f85f10c7765fe9e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 724 zcmZuv&2G~`5dOwV>m-=gO-Wi(egXt=TvT(SLP1EV5~7j`hg3Px)5hJFEsl+Br=m9w zJOT%fJOKiU2!wzK;5~}OOH`dTAR+K!XLe?HzM1{L{eJxU8-UxmQH6n$iL!+m%o3J^ zcb`Rp=3(=JN_{DI3G`T}>lPMqhER^=b1qxiF6x&L#Z8-7GO=vo zELwk>PBImG_mV^$rVO&H!jRxN+y1{3_5ROvhdkYZ-~!s@-BWo;sQ-0skR>YG>oHGG z(NH~IU*5>+n)g*C`;+lVCR<_@GJ$nJ4n#NhSv(tu?5cKLhf0g+_NBnZR=0MG1J2;Uu4_nXou?!_HB1{3UWWfbW2m5cJ0x3|wN{%zM>QWufO7c?k_hYvOW#mSf=xIvg=--jl_^RgMf?!}Z)d NaM{;*1_KUOffGv=ov{D_ diff --git a/out/production/leetcode/com/leetcode/MapSum.class b/out/production/leetcode/com/leetcode/MapSum.class deleted file mode 100644 index d55a1ad3ba563747cade345302cf163d32fd6c19..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1550 zcmZ{kOK%%h7>3{Dneimfq`B3mPHgJt()tp|AuSHMLTVDQ{#R{uz(%vhE0V)N`l0ttEx!-1MHEC#6JM3w7h3LBtn>lkIy;to$tKQ`+YM{Uwr=v zz!J6s@If=7TQJ}k7`|iQvolq@zL$A#=Z>tj1^lZ{-D$52Xz@hZM4!NgN~4ykO4+V7 zc4cPUJ}7l+(?!k$FcDCh1{f4C^axu?l>0G=b0&r?3}ZxKtVfi9zAx=vf$?5B+^bds z7{hrJK?@_uBie@Vp8STNuX#A5`}3<_6L9cs`Nqr|77KS8nrV6<@NWmnRQ3QAZ=BE_J4 zc9jPyY!GP+bI1q;TAf;{vvZ>MqlHGr zu9oelqt@Q0-rjdw0>NHjD~hDvl1-wA;{TPMPn4B4?sbM!-<9_%+#y1{b|5fVYTK2& z>;ms5jS#%3M;@ixf6$b-9VXD5jYiv4rUy!mPO~Dn93?)KU0j@t{r=h4&p!R}x6i+P z_RZm(vQc25C|m7qsW{1DyL(}O$$MBl)WugXAE)(W#L}r_ zOs6Bqh$~r|D{FxwfQw{_k?RtLO|sRdNHxuu_%b%Q{|@3PAc6PUUuC3R>F-kBJo>T7 zQ+}SB!5e&Hpbu~IT#A?!?}4cq+t-D?sd|)_82A9oJgZ@ak;BmbLZ1m!JjcBFlWq&F zV$Cz-CpVrS6=lY@wjS+TaU~V?oX}^L6FQwRw1?h&`%okJFUi>x%sxEDouokUl`xRO z5COt8VTwRAtU#K3S6Km7nQM#)wQWab}g<8V83uQ1`q4>^F%q~jQL*Xmv zp*;2Kx~Z+DT(zkq#J)fv!vFZKHI9*D`cYQbvPRGd>JJc2v%<^%u>T3HNHXjv&8@XV zgJ{1-&ajdQP};I9!B6MDn-pA1{FTRmX&6l#;FMkvOz~d%MxC#6Xdp;fu diff --git a/out/production/leetcode/com/leetcode/MyCalendarTwo.class b/out/production/leetcode/com/leetcode/MyCalendarTwo.class deleted file mode 100644 index cb5e882f66aae15349e7b530e0424c93d2a5918d..0000000000000000000000000000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R=sPe4rY<5@y*pJk`U*{!fyODboNv1Y<($naxy-q{hkM5G8|M2HYs2ZK-4V zOo!IJ+*`fmJLRsS@Muxp(5vUsrA4I{^%~xqc~lv)!_d18Z|4GJR2IDA`PN#{ZRmy^ zD(F7S)TqUkj3i zpAG#L>(`)qPOvXPy{u9M*mWi4VU(ek&#aZ>JI1qz)^oJ?aWa=Vkzvl{Dkn0@^E!f< zrTrG8=1`5hsKG-nR(8_ wzr|EiqC%oY2#Hqy`5HD+D#SX1KjGhiOZ=m5!Xv~6y!1A&Goe73iCk#=4H>JzZU6uP diff --git a/out/production/leetcode/com/leetcode/Solution1005.class b/out/production/leetcode/com/leetcode/Solution1005.class deleted file mode 100644 index 9e51e860bdb104d23b08ede84a1722c992bc6b1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 997 zcmZ`&OHUJF6g^)%)321F<>81x5qx1wwJj(`tTqx8l7@mNH8qBiI4xtDGMypQsR=7x zbcte2WP!#+W6})^b)iHP7B2lCg+F1ecM6INoyDCy_i@g>H)p>8{IUyR3R6C~;N}n{ zi109UmXwD|OjnFz>{h;{7HkI3HO}8E82QvRfOcI^0SVgsBXRGDu z2exX>&Z|YmVWdtE-JQmwA&n}XmysusM;X@w`D}$U6(`e?wUxrkoU+yMEjuZy`QS1H~1QU@|RLISF;Xp zD=Z7LcL%{8oK6Te&g#u?L2-2p;^6k6EG%skn;XuADFnz$5YRzl_mhGHG;Jp>)P+g( zAW7=H0U0x-&RO*1F69>yM1ho|VyLxQiuN3(ePW2yk3)ML?&x@97;o)e!X?VOh-DF% v$#WC_JrY`+m?x+w3Qv<@y&NMP3C38<0zXLDexXU#;-3`233HOVT)6TJl{e4o diff --git a/out/production/leetcode/com/leetcode/Solution1034.class b/out/production/leetcode/com/leetcode/Solution1034.class deleted file mode 100644 index fc004aeb108eeed3bccdd27c86f95e518bcbc9a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1757 zcmZ`(&rcg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%X!dZj21w#~F^TVujvEl)K48zafRQ7Wx^l;T$7Xw20F_0>zOKEyZYz zSGgY7`IxFG=ND)3P-Tp()OBSuW6ncMf(BHD`+Pc kpHa|HiJ`*!wFzvOUbhl-s1Pb@#G*;^Zrq|eXa1j$W92Z5nf6)V#$7zrBM5aB}AJKhH zpK?(`nTe<$<_{=nd46L~9b{>V##bSy3)1QufHjvC!o3qeJ^9#i1QF@k9r@`BvV|335 zxQco11Qt+Z)WvUM!s6UC*K4gq*zd8_svTmoTz`kco^iVH22RT)a_L~t6dzB&w+_fQ zp*viI&FJtiqRJjKn4*3O*NJ$jj5;@|ZeW?*MOLxT*n?ixu{844WW^#`H<&NN`Uyi+ OogX}*z)eC1Zv6%nGmpUl diff --git a/out/production/leetcode/com/leetcode/Solution318.class b/out/production/leetcode/com/leetcode/Solution318.class deleted file mode 100644 index d4c7e1aa5598f7a1d5ce675003151a5e5c94132e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1027 zcmZ`&OHUI~6#gzV(`m;71sNV{6%etd*h(dh0wJ14lM)^#5E8?Np&enc?U->;+!z;Z z*=R7nR>a80gt);+3@+UH16;ZiAOCb|1cl-J*PY?u*Y|^ zbC!3;^Q`LvYAimLl}NmX(Q}fSvJ?r_4m)LgbfGk3dlS}7k&^mhH*Xau zEzgnXUqaQNbFK*N8~$IwegT8o&wFlRL88zYn;QOI-fpw~@tlCjb7k3&U%D)l{bj_` zE*32!Bc!#%HP4=|xn6+DAsJ zhB!gha0gvTa7L3ji|&f=FGzM diff --git a/out/production/leetcode/com/leetcode/Solution319.class b/out/production/leetcode/com/leetcode/Solution319.class deleted file mode 100644 index c896e4a218c9c20d7ab41dce6371b5f085467785..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmZ`#O;5r=5Pc(sYOR1@h@c5a@IYfc5e*lK2?^=}!@aFlmXvNRMX!1=-uw^VO^o3n zF~%R@|3LqRaTZ88xyjD#ym|9>X1;#kKLJ#*ZD0;D9h!+a5`=WezP2sj4lb=zr{lR1 zA#orA5mgDXVyR_d9t%1Q6N@kj$r=6Fj@ksRcNKDtR;-n3ikmc%QpEU$FJ-7>nUHm5 z*YZ6ta^<;aHKpH=gbem}D_nNS5FynNfp^mHI$n5YJ3b>T4e8o`%MOK#r=S+KMURkc z{3p0iFr2>cG;c)Ys^*IIQk_5nU-m{*_Cwb@66%KxH&8D8+`W7co<<+Hqx(Tw&4vQf zydiazn?lrdNgn)HqI3jEy%T^UvSxm_p`G+C&A(kGW aIhw;v!5AxKCakFf^RbB>YY_5d{?;GjVpg>P diff --git a/out/production/leetcode/com/leetcode/Solution372.class b/out/production/leetcode/com/leetcode/Solution372.class deleted file mode 100644 index 33e4217933c7cbc37b8f0b5927f140c15b35463e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 977 zcmZ{jO-~b16o%hBa|h@b1+<6^MJO?WT3ZE0h)qLkLed1q1VW;0oVFtjmQGVz_yhPC zOkm^3rkieDh>-<9z>N!6{sDCB)&$|b(^^(8?(Mnfo{#6fXZrQ;@d+IzwVdCw3pIhRv{QC!83BEAYR!)x_`2Z_B7mU4P{G|!m2A6KaEo?o z#Vyrqj$592FfGutVb>O&>W-=~nOo0I_@E5eP3i zW&25eJ8xH4t$c}|fhD(KmDa4Pqt0!otZh0w0>exHV|Yl2oqENtK6Up5gvFKP$_r@g zG>n%mI^8O>OlYNM6<$5ID(&jRAy3It_#!LdUvcZzg1zV{oIwgqj{Q1%{qwkS+I)Zd z=1WpN8^$P57Sw?${anBANAQX}2rn+TN%SboQe?(-Hxw_Xc#$JFLcz_kv z1VgxnUSfw4C+K~WD3*Jzer*CA0~~8r>R`n>STV+^*H#46XeAgUVKm!WANR-ArJTuh%vyKLShu%ow;*A&b@Qboo{=ew*ZXcf`u635=I&( z5(3#}^;i{a%3mx_%`dx7B#^k~`CfEgAU-raVq08ifr_VQ{GOo7Z8Z6URNn_XLE)UFP<< zZwXkT@>hfUWDqsmIaWm=SyzkdDLdz+sIq^7*ep{MOl?}3YNVV;x7A9MfJC3fS&iW} zRyAmZj(gM7Y}+}E!obdl*FRpp+5Y;rpfAG!GJGNZX~{PN2Su&OQ)th{PY~~$;Vh*N zgKu<_GJOa@8`^0Jbik%$vUmUkE%dEt^Ixn#7okac47m)In$O` zO39pIC$nnde!-ZVT9e}4{`brOK=&M>NB#nD$4jPdX7d~98nMj+ido&BJ<>}Y6T1PLn7~?N-3VrM(g=greW^nl6{c@k_Nr{ZqlIwJHoe@mm ZMgN`-(AY)aFT_O0PnHrm$J7|k9{?e;skHzA diff --git a/out/production/leetcode/com/leetcode/Solution397.class b/out/production/leetcode/com/leetcode/Solution397.class deleted file mode 100644 index e89f1e1862a0b08a1af6b4513445a4ad7809a98e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1060 zcmZ`&T~E_c7=F%LR#u99Y?P0QfS()ARYe6dGA|4yEJIWXMD9v=#6s7O(UA~u@sf}j zi3#3$vl}loF(R6%*Zz?G2;Hc^PnfppW*LM;azR2fL(F%oxTdA$O?!A+7{m}m#3H^6 z9$7y}u8Gw0o{)qK3_XTZ)GW?j!zplW&ap@f#~v9Ur3>y5MBGUjez#Iw=H+>P*&?Jf z?-;tZpqEYWTn9z>vAMy}m;YbF33NznUqD)D(!g+$b{c(|hYTNpy`@bEmuU6O zpl&2+RRRYjF-#|h%Sh2m!ED}71ibhJ>EQt)GeR~MfBFIPA=*P&Oht~jhfo>zVW$q! z$M6*`?{Q{SRK>{ieZ(3Zw*^+kq$%2e4xlAXcIBj#??@UGB}+fWr~ljaqZR^ z6W1m#G_k1oT>C>*R{jIycc-lkAujH{=bkx_?>pz*`Tl413xHwhF@&I~2y2L-MWAEB zST-`Y;gmADnFX`x3ABt@j^&LBD9Kb_MXNxkZ&dXxJ2Po4&0jMXV^E<)(FRS$77bg` zF3?kS%Ng4=y`np7W~N=64z6>0aF~(G#-c#`)OsAo$g1dU0`OzsFq~Pp979Jv^fnFK zv4eOjzFwd!;9s}RN(em~c44=GaJY1-Nod$3H4)GC3|ngUYUuNA9?J0hH5@>{fa;j{ zJ>4Paa8ggPG>33lMN&fw=_YHxG_)~GW`!QhhFvvta{@c)QO6Us$hP4qj;R>Xkil_* zEgKjMXeHCjRW6%zM%8B8v&le+di}GTHNiX$BMJ3{hLboY&}uneUc&M_rb`58Gz`h~ z%3_sSqSIE%F}!Mp7DIs=vIir9Yz>k@08Q0cmc>l!dMeLSjkCS7nU-T-ua;-b%1vX& zrlxDkEgE*-s95seP=>vEYe``D)c=NqkwuwN=WL535>BS>=+szTcX?g9CkH1|F_%md ziA}rJO3|FKWV!?=YoKrK*^?j7SATx}`0MklpD$jnJ*^GMlC#@w9CUEVA*U0pHKh<= z0OVA0hnxui_s>Gw+#b?GRm)g^%NMxdES@|7icGZ zNrDSezKBZ=NWTd$%x_PatDCEL1^Y&L#^UdBP_7R+qTm}2tzd9e>ZMJ1mLL8J0gJJw z=N{klw1Qh3d=l&Gf**(MBA;RfB|)>DcCHZig~i-!LJCsuA=zE%C;SP-aT^J^e3cJa z5J@>*r_i9R;St7t%Kf;D%Rc1^=(s{j_G1Dq4e~>NF@WgiO3ObRupg~_+%knm7aBHF K2wdeYgvr0@PzN3W diff --git a/out/production/leetcode/com/leetcode/Solution520.class b/out/production/leetcode/com/leetcode/Solution520.class deleted file mode 100644 index aa5b232c64b5ed7e291cf0b323f3de651ef276fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 816 zcmZ`%OHUI~6#g!AOQ94Bh4PXLzFV45W6(sACS;PvCKVS|Lb|(5$M)jTA=9aBT^KjU zwZV->P1sf6um1yngu%ym0VT#b$(-kR&OP6`_v?>Op8;IObPOG^qL6V!&?(Tr zs_v`2r<(Qrt(8^R2?aW@>!uD10#+uw6hjxfqlm@PgZN+YN*L&7op7h2f(6#eOet%} z(1%16{c#K+DKL24-X=^rp&JPF=vLX^a06SlTvKOftLB`cI8qp9N6&56!^Xh?r6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;M1& diff --git a/out/production/leetcode/com/leetcode/Solution594.class b/out/production/leetcode/com/leetcode/Solution594.class deleted file mode 100644 index 4d43ec08e4a4224856fb8419ffb8ce47309b1084..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 675 zcmZ`%O=}ZT6g@BVk~GQW!|1eC6I-=P+dyVhi^aB53hF>w7m;qdaWWb0#L0|IC!#wS zUAPb|g1B)ZMR22_D@zx3DY)@hL==C4o9cNQb>+a^ckj9Po_Fr$eLUFP2QY^-StOvP zA$25?5-4@-JGSZD!AE@fU?c7?iZx8OsHp5=zxR*SoVvHi|rvYO~Uiwf!BOuNra(M$M4*TD9JmFOb>N#LFMw{vyv& zFl4nYuUB@FU)YjNeyF@6nFb}`EHbn@B=QtfKp90$poD39vz%p#*kx8Kfin~_go~)4 v%I+NIae|&?#u|uL-WYel_k?AfWHy0Q%omV6Ku!pe8X5jh7J<`56PWl3LdSu; diff --git a/out/production/leetcode/com/leetcode/Solution689.class b/out/production/leetcode/com/leetcode/Solution689.class deleted file mode 100644 index fbc7189bd95db6417036722092454a414a0e03f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1192 zcmZ`(O=uit7=FH;Z+3PzNt0B^X1cT5YGb3D&T1M5)0PFX2n&gO*b||$ZrkULh zn_Y=F!37Z&wNM20&_4_aN_%Qh*^BhjOAj7B3Hd=h>9MHs`8FeXakIR6-uHdp|Brp} z_jdyT3z*3w1OB`SPzl7%no@n};)n2o5 z`O<1946D5rKWWSuc2p~KkZyBbKoE(DEwp+~CQT`iSfh8N*QE4Y${3Jn1ncEi5N--& zm^*=za9Loi+VvZ2OaA(>Lj#ULw%YD>8sTe^8pGw3?uni4_jk6x-uvwOukU@d`|8?Hf3yP-3juY0I3`Eb|aZ%cyK2rw9ps zXjddzpR4xGgRO&WEUc-Tg+ZFtZ()|@Tt#Q`x|O*N>%Ruog=h3lH6bTp0X0P0GMxIH z=2FoUMJnYEx2i#H{VGmTj`2iCxb<;ve*!sfdYWFB+F9Bcxc?F_a1m2jf{iMU;|;P_ z;b0AUY~o40i>L4bPyQ*M#!WnfZ<+TVv;2tDc!(MNOx`ajUh$ic8-y0DNJC~eCF z=|{4&<-cxis~{D~uY{d2eI{Vc%&r%32L&6Bi@R_IhJ$$5kCaM-ctiQkM5#3@Og)g1 zfLPV(11<(p60nkRt4+Mo`hSa-9Sq@~jr%T!F(Od8k=2N!ZW_j&r;CdMg?%NHp#8kj z6nHXo3*74LEdkA`;^KkkWJYR}l*|`B)`Ru1qt?2+EtNE7E8-kO^*E5xx=ccC_nl_i z4)+Bf-o*ch;W81EI3{qhk;-7_mE7x>I*quS1nOm|!KXRQf_HiG=J&g!tM{L-&yKG? zf4Ka9a{cizGZ*wS;PG8@To!tgTLOF2@_7s1R_z?(YcKqWQis72tCVh*fX5i4#dTqX zQWw94!2`_C{e&e>=gwePk5Q~qDOSIsoO!-vp3%&6%6tR5#~5r%2PS_(9z_iBRJdgi lCDce)_x3XUes6ZdIHQ`|y#6~J#-nb*$d}7>PteF=@-Mo+j@SSI diff --git a/out/production/leetcode/com/leetcode/Solution709.class b/out/production/leetcode/com/leetcode/Solution709.class deleted file mode 100644 index 5a16c5960c0762de1e9f7fdb76cd1874ed8f13ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1709 zcmbVNTTc@~6#k|li`xY%UI8zFs4XhRyI8zHy;X~-#Tp-{+d)>hJDc6DhCg6@AsSzd zuRd$U7l|1C0mi=p@mCnnbgOJdFtN$(&Yp9=?|gIS%=GJz#V-IxP}C7alZIvk8_>d# zc)%a=w9TFS>B-UqVFnB>qn2X@=NOujsiKBfhV3gsg}}3%`{Py1E(=eGh9(_x7#i9P zw4@%Nphx6Tq|rt%`#E4Xv(Z~{Axvn%h+R}7kv!cwDc}T2g=GQna^m z>{S~(z_4>21r(@ZzkvftD$TAdoU%e>>)QUJTEig24pUarwh)0S%OYKnHf^MIP7RMR zG-t`g(2=(saidx(32%y*Y_fFbrOE9g_bl~YH#P?|7Bxh7el5ZbLp+dq`B->a?i0=a z)yw%+$%tBlG2-nEceT+G^Ggg}t335qCgc{IS4w3*5Xn0*%&=>9=3kgxsz?b<8aZm& zf~j@I!UR{jQ?`Xa zkeBjd)y=FbMAXs%oSJpT|2e~y>tmxWS5KSewq39SkxAeZbyhN$%29Ey=(viUhHD0f zm3{L{ak6y3P&tH`Kt2Q%32;M43X=v-;uM3Ca~$d=oBO`-HQZ*{w}Nk2ZeyJ^Owq-) zekh%xu&8uqQ*^zmUlR?wV8L*ZW@&meWf@!mdry-X4$)J&fsHs!Pa_P#5Cwzg!#F}u z1$K!{(G7lrc5eY2Ck}pqzK8_y5nG685#4IKJBCk)-#fH`{&|WHGql%`akLVDAKGe} zdPBB)CgR0W9HU&V=*MxKKrErFn$@$95|dg|>tN4|57>A2PxVHPb6Xfw!&5MEou)q< lx@K{vrX_<>daJ0jWV?vVG}P=mCTQFwpH9)YP{18@{RHR*!WRGl diff --git a/out/production/leetcode/com/leetcode/Solution748.class b/out/production/leetcode/com/leetcode/Solution748.class deleted file mode 100644 index b94ba658cf37d48550a7b5df780f4992d41dea7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1388 zcmZ`(&u<%55dL1)_9pAK<2c>4YeJKf7VNgMp`@F}DS=>wWZ^bQfgsf!*f>kPVZ9rz zHx%dr4&lhXNJyv=s0b;dT+#}mT#z^*PFxUDh4>*#r2Yd1LBjW(mPn-7-nTRJX1L%4`GD$dXB#sH9HJcRU8vI z)CgK7&vBwgu;7$t1CPfH{PD3fjIPim&|7nT=ln`*-U(l@=RI1owV+{pb9U%T{jM<< zHC+;utNkC~q`*MC8HAD3jw(TG*<+3V;!8oeATW{N&qsZ~={~Fp2p&{a__%zkEZc3* zJV)^Y#fu&E?0zIt<+%;VZ#&O>cEmHqr7P?2zfW53F7JAE)tNwvTFa!e<@zXpObc|?S(`Q+tb`5cSy$3$lHKC)tq zLoaQ&Gr2Fd^KvQ2vOQK@loO-M4QMAeklDaMSvA#7t6Q;pj2@$V4I`#%^o&`Wq1{04 zeWXVXEn_ddT#UUkv)UuB?%XtEGWz6y<5p$dsj_Bj8yGg?SCF`hC8-RQlV)<$(iJOZ zqzruxgJ#l5jag|kW~BdxP7(Uon3Ys4-Ow|+H5}%)UL57KhJ<1zrK-%V>h$~BNV2d_ zA}elc~i&tL#A(&}>n-++lr zjJu3Me8l&s9JzH2;X3>C6^`I*jNn`9-{Ba(C&fQ9(=UwOBK5KrZ!w=m+))(SoXgat zl*Tmzrvzb#?;yU747Y^%3ps9VBdvma ZcQEuf;zAgIBKZe;>BlmjCTJHb{{UA*CA$Cs diff --git a/out/production/leetcode/com/leetcode/Solution794.class b/out/production/leetcode/com/leetcode/Solution794.class deleted file mode 100644 index eae0e42cbb4f95eea998ccaac62b0dba6c89efa8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1828 zcmah~OH5o<82--O*9^VD6u1a=kO4#)MxY&WNNIrrl@y&mB9Cg(n#(Z4#bKry22zR3 zF|8)X#DuD76zhTwT^JLnHEH6a3m-dU;?9^TE?nuRvBBbZ?j4~ZUQ)rSP6Vk45%hF=mNo6d(rMl+nMQ()04BQWL`i&>SUaJuYl4L88_hPVPayi z1SQyKz%)^cvcJWR7T+c`(dMWvdbapnaMB>pSS5rMKrJMB!3I>}KxIhrL>b<0Fz zuP@&Hj>z01$u-C|%QeiK&gXM7@jsktc4*GeT@cVFvvzJupz>cpd7X>A1V35#6OgSM z@cc_h@^gO^0UR}Qh!`H1Uam~`AH?JZQwX|5buEY(?sMR+RxQa(>b<5a5dE8&C z(r6i$f6Vd+pI$|v;1g>orEq!`dO;BdL#*w5QP8-55~`b0KSH1`H1$3-Wj(}Q?WvP{ zZ)>d@3~!+F9cge=*Q(4tqr`Pfcau;W^|I-m!SDy@|4WD)#ZxdmMi^OG(*K08OAk{A)DwVN&~ISc-HmP@fzleRt~*L2zhE@Jpw)8A>J zz?-{V9+F&EI_0jqV7sEkZuG48g1L5&%SEtHnScnY3()2XT1n$>uVt6e4@wYo&rsD qyWH~_*Nm#W{O=`1S1G9@3H6vfM9hd;dW^sNTqc*mL0;O2Lw^Fj_eom- diff --git a/out/production/leetcode/com/leetcode/Solution851.class b/out/production/leetcode/com/leetcode/Solution851.class deleted file mode 100644 index 7d518ebedcb22afe029c856ce8bc2861787c98f8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1651 zcmZ`(&r=&^7=FI&CL6*+X=qZ?5Q^5)BtX*A5^I1cZAGFfR8muI#>0{X`2OVdesnZKb?M!KlKN!#c3Et81z%y=DEjuHiL}P_Ec+sZ8r=uOZKu@W* zlB}4fU8afpj)ixK+x`1}as5H#k1%Y5R8*4^!m}nu!+VL9BY8cRQ4pD*5 zf9H|CmCFKw=n>Z@iDR+bK9(BSF^D1Ju1)3HBa;+l$b^n0&I@=g+pHUQjim&mt^7{E z*_NFJjNqb%OFBl867U}uZ~$Q!OUBxaxlZOeuiMh&vd%%LnXu}ZPaMQPGG%hqhjASf z;GDfy)h>Y0Ot> z@#ktKqf#*HmV9m*ReQSaniq$Pv5F`iLzw#SO`gQ?0sURi%-FMqj?xsF%zsOO_qt zRww%RzTEortDU_s?(Kbd@Aq#u6LJFR=WJcPP742Aa-NXa!;#!g2)s$%g|{38?-?zV zv?M77r91uv;-Le%!c)Em-LE>Q1Hd)B%_o5=yu*{uA`KN9ZJY6-ZD{eK-Jg8h=!ic; zhwCZ2`1~`1+vrg;5!!loA0Q}YDf99;`A})5f-2 zlt}G8oG>xPWEe?-g7kHKX{9c%PbEcKedPbrPH< z7k(@tPtC=gW!$8uI7Cjs-M-HOY8t#ka2qwI#6EM8R>vY}p?#l@Es&5V;2DDne86-r G6#fC8u0l=# diff --git a/out/production/leetcode/com/leetcode/TopVotedCandidate.class b/out/production/leetcode/com/leetcode/TopVotedCandidate.class deleted file mode 100644 index e1e504b897d3d62082ee50580aea1bc189b8d27e..0000000000000000000000000000000000000000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XX-XLBnG0>pM z&n(cSD7OH#b~0HUQH9ApLbI90WT(AB{;z^e6q;L9s$eCpCAK);X$6EaNy|>PobwHe w&cz1RU)3hH4ipJlLV*S=QBQSL6BlR8PhITP#ZFeho!b2CXaxc%bTiQY1~4mL1poj5 diff --git a/src/main/java/com/leetcode/1155.java b/src/main/java/com/leetcode/1155.java new file mode 100644 index 0000000..2e9e955 --- /dev/null +++ b/src/main/java/com/leetcode/1155.java @@ -0,0 +1,28 @@ +package com.leetcode; + +class Solution1155 { + public int numRollsToTarget(int n, int k, int target) { + long MAX = 1000000007; + long[] dp = new long[target + 1]; + for (int i = 1; i <= k && i < dp.length; i++) { + dp[i] = 1; + } + for (int i = 1; i < n; i++) { + for (int j = dp.length-1; j > 0; j--) { + dp[j] = 0; + for (int t = 1; t <= k; t++) { + if (j - t <= 0) { + break; + } + dp[j] = (dp[j - t] + dp[j]) % MAX; + } + } + } + return (int)dp[target]; + } + + public static void main(String[] args) { + Solution1155 so = new Solution1155(); + System.out.println(so.numRollsToTarget(4, 6, 7)); + } +} \ No newline at end of file diff --git a/src/main/java/com/leetcode/2034.java b/src/main/java/com/leetcode/2034.java new file mode 100644 index 0000000..922da2f --- /dev/null +++ b/src/main/java/com/leetcode/2034.java @@ -0,0 +1,71 @@ +package com.leetcode; + +import javafx.util.Pair; + +import java.util.*; + +class StockPrice { + HashMap map; + Queue> maxQ; + Queue> minQ; + int curTimestamp; + + public StockPrice() { + this.map = new HashMap<>(); + this.minQ = new PriorityQueue<>( + (o1, o2) -> -o2.getValue().compareTo(o1.getValue()) + ); + this.maxQ = new PriorityQueue<>( + (o1, o2) -> o2.getValue().compareTo(o1.getValue()) + ); + this.curTimestamp = 0; + } + + public void update(int timestamp, int price) { + if (timestamp > this.curTimestamp) { + this.curTimestamp = timestamp; + } + this.map.put(timestamp, price); + this.maxQ.add(new Pair<>(timestamp, price)); + this.minQ.add(new Pair<>(timestamp, price)); + } + + public int current() { + return this.map.get(this.curTimestamp); + } + + public int maximum() { + while(true) { + Pair peek = this.maxQ.peek(); + if (peek == null) { + return -1; + } + if (Objects.equals(peek.getValue(), this.map.get(peek.getKey()))) { + return peek.getValue(); + } else { + this.maxQ.remove(); + } + } + } + + public int minimum() { + while(true) { + Pair peek = this.minQ.peek(); + if (peek == null) { + return -1; + } + if (Objects.equals(peek.getValue(), this.map.get(peek.getKey()))) { + return peek.getValue(); + } else { + this.minQ.remove(); + } + } + } + + public static void main(String[] args) { + StockPrice obj = new StockPrice(); + obj.update(3, 9651); + obj.update(3, 6897); + System.out.println(obj.maximum()); + } +} diff --git a/src/main/java/com/leetcode/2103.java b/src/main/java/com/leetcode/2103.java new file mode 100644 index 0000000..bbcea80 --- /dev/null +++ b/src/main/java/com/leetcode/2103.java @@ -0,0 +1,24 @@ +package com.leetcode; + +import java.util.ArrayList; +import java.util.HashSet; + +class Solution2103 { + public int countPoints(String rings) { + ArrayList> maps = new ArrayList<>(); + for (int i = 0; i < 10; i++) { + maps.add(new HashSet<>()); + } + for (int i = 0; 2 * i < rings.length(); i++) { + int color = rings.charAt(2*i), idx = rings.charAt(2*i+1)-'0'; + maps.get(idx).add(color); + } + int res = 0; + for (HashSet map: maps) { + if (map.size() >= 3) { + res++; + } + } + return res; + } +} \ No newline at end of file diff --git a/src/main/java/com/leetcode/2512.java b/src/main/java/com/leetcode/2512.java new file mode 100644 index 0000000..200ca4d --- /dev/null +++ b/src/main/java/com/leetcode/2512.java @@ -0,0 +1,38 @@ +package com.leetcode; + +import java.util.*; +import java.util.stream.Collectors; + +class Solution2512 { + public List topStudents(String[] positive_feedback, String[] negative_feedback, String[] report, int[] student_id, int k) { + HashSet pos = new HashSet<>(Arrays.asList(positive_feedback)); + HashSet neg = new HashSet<>(Arrays.asList(negative_feedback)); + HashMap scores = new HashMap<>(); + for (int i = 0; i < report.length; i++) { + String[] ss = report[i].split(" "); + int score = 0; + for (String s: ss) { + if (pos.contains(s)) { + score += 3; + } + if (neg.contains(s)) { + score -= 1; + } + } + scores.put(student_id[i], score); + } + List res = Arrays.stream(student_id).boxed().collect(Collectors.toList()); + Collections.sort(res, new Comparator() { + @Override + public int compare(Integer o1, Integer o2) { + Integer score1 = scores.get(o1); + Integer score2 = scores.get(o2); + if (Objects.equals(score1, score2)) { + return o1.compareTo(o2); + } + return -score1.compareTo(score2); + } + }); + return res.subList(0, k); + } +} \ No newline at end of file diff --git a/src/main/java/com/leetcode/2530.java b/src/main/java/com/leetcode/2530.java new file mode 100644 index 0000000..9b4870e --- /dev/null +++ b/src/main/java/com/leetcode/2530.java @@ -0,0 +1,25 @@ +package com.leetcode; + +import java.util.PriorityQueue; + +class Solution2530 { + public long maxKelements(int[] nums, int k) { + PriorityQueue q = new PriorityQueue<>((o1, o2) -> {return -o1.compareTo(o2);}); + long s = 0; + for (int num: nums) { + q.add(num); + } + for (int i = 0; i < k; i++) { + long peek = q.remove(); + s += peek; + peek = (peek + 2) / 3; + q.add((int) peek); + } + return s; + } + + public static void main(String[] args) { + Solution2530 solution2530 = new Solution2530(); + System.out.println(solution2530.maxKelements(new int[]{10,10,10,10,10}, 5)); + } +} \ No newline at end of file diff --git a/src/main/java/com/leetcode/2578.java b/src/main/java/com/leetcode/2578.java new file mode 100644 index 0000000..420bc19 --- /dev/null +++ b/src/main/java/com/leetcode/2578.java @@ -0,0 +1,31 @@ +package com.leetcode; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +class Solution2578 { + public int splitNum(int num) { + ArrayList nums = new ArrayList<>(); + while (num > 0) { + nums.add(num % 10); + num /= 10; + } + Collections.sort(nums); + int v1 = 0, v2 = 0; + for (int k = 0; k < nums.size(); k++) { + if (k % 2 == 0) { + v1 = v1 * 10 + nums.get(k); + } else { + v2 = v2 * 10 + nums.get(k); + } + } + return v1 + v2; + } + + public static void main(String[] args) { + Solution2578 so = new Solution2578(); + System.out.println(so.splitNum(4325)); + } +} \ No newline at end of file diff --git a/src/main/java/com/leetcode/2678.java b/src/main/java/com/leetcode/2678.java new file mode 100644 index 0000000..b0c2155 --- /dev/null +++ b/src/main/java/com/leetcode/2678.java @@ -0,0 +1,13 @@ +package com.leetcode; + +class Solution2678 { + public int countSeniors(String[] details) { + int res = 0; + for (String detail: details) { + if (Integer.parseInt(detail.substring(11, 13)) > 60) { + res++; + } + } + return res; + } +} \ No newline at end of file diff --git a/src/main/java/com/leetcode/2698.java b/src/main/java/com/leetcode/2698.java new file mode 100644 index 0000000..a08ebdb --- /dev/null +++ b/src/main/java/com/leetcode/2698.java @@ -0,0 +1,25 @@ +package com.leetcode; + +class Solution2698 { + public int punishmentNumber(int n) { + int sum = 0; + for (int i = 1; i <= n; i++) { + int v = i * i; + if (bfs(v, i)) { + sum += v; + } + } + return sum; + } + + private boolean bfs (int v, int target) { + for (int i = 10; v / i > 0; i *= 10) { + int r = v % i; + int l = v / i; + if (target - r > 0 && bfs(l, target - r)) { + return true; + } + } + return v == target; + } +} \ No newline at end of file diff --git a/src/main/java/com/leetcode/274.java b/src/main/java/com/leetcode/274.java new file mode 100644 index 0000000..3039ff3 --- /dev/null +++ b/src/main/java/com/leetcode/274.java @@ -0,0 +1,25 @@ +package com.leetcode; + +import java.util.Arrays; + +class Solution274 { + public int hIndex(int[] citations) { + int l = 0, r = 1000; + while (l < r) { + int mid = (l + r + 1) / 2; + + int cnt = 0; + for (int c: citations) { + if (c >= mid) { + cnt++; + } + } + if (cnt >= mid) { + l = mid; + } else { + r = mid - 1; + } + } + return l; + } +} \ No newline at end of file diff --git a/src/main/java/com/leetcode/275.java b/src/main/java/com/leetcode/275.java new file mode 100644 index 0000000..4509bd6 --- /dev/null +++ b/src/main/java/com/leetcode/275.java @@ -0,0 +1,12 @@ +package com.leetcode; + +class Solution275 { + public int hIndex(int[] citations) { + for (int i = citations.length-1; i >= 0; i--) { + if (citations[i] < citations.length - i) { + return citations.length - i - 1; + } + } + return citations.length; + } +} \ No newline at end of file