diff --git a/cc.txt b/cc.txt new file mode 100644 index 0000000..6ba1a6b Binary files /dev/null and b/cc.txt differ diff --git a/hs_err_pid119104.log b/hs_err_pid119104.log new file mode 100644 index 0000000..3cf9af2 --- /dev/null +++ b/hs_err_pid119104.log @@ -0,0 +1,208 @@ +# +# A fatal error has been detected by the Java Runtime Environment: +# +# Internal Error (javaCalls.cpp:51), pid=119104, tid=0x0000000000015538 +# guarantee(thread->is_Java_thread()) failed: crucial check - the VM thread cannot and must not escape to Java code +# +# JRE version: Java(TM) SE Runtime Environment (8.0_202-b08) (build 1.8.0_202-b08) +# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.202-b08 mixed mode windows-amd64 compressed oops) +# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows +# +# If you would like to submit a bug report, please visit: +# http://bugreport.java.com/bugreport/crash.jsp +# + +--------------- T H R E A D --------------- + +Current thread (0x00000000288e5000): VMThread [stack: 0x0000000029f80000,0x000000002a080000] [id=87352] + +Stack: [0x0000000029f80000,0x000000002a080000] +[error occurred during error reporting (printing stack bounds), id 0xc0000005] + +Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) + +VM_Operation (0x000000002a57f720): GetOrSetLocal, mode: safepoint, requested by thread 0x000000002899c800 + + +--------------- P R O C E S S --------------- + +Java Threads: ( => current thread ) + 0x0000000028ab9800 JavaThread "Service Thread" daemon [_thread_blocked, id=112856, stack(0x000000002b480000,0x000000002b580000)] + 0x0000000028a13800 JavaThread "C1 CompilerThread11" daemon [_thread_blocked, id=120924, stack(0x000000002b380000,0x000000002b480000)] + 0x0000000028a19000 JavaThread "C1 CompilerThread10" daemon [_thread_blocked, id=96916, stack(0x000000002b280000,0x000000002b380000)] + 0x0000000028a16800 JavaThread "C1 CompilerThread9" daemon [_thread_blocked, id=115280, stack(0x000000002b180000,0x000000002b280000)] + 0x0000000028a1a800 JavaThread "C1 CompilerThread8" daemon [_thread_blocked, id=120980, stack(0x000000002b080000,0x000000002b180000)] + 0x0000000028a19800 JavaThread "C2 CompilerThread7" daemon [_thread_blocked, id=119352, stack(0x000000002af80000,0x000000002b080000)] + 0x00000000289f3000 JavaThread "C2 CompilerThread6" daemon [_thread_blocked, id=92936, stack(0x000000002ad80000,0x000000002ae80000)] + 0x00000000289e2000 JavaThread "C2 CompilerThread5" daemon [_thread_blocked, id=121152, stack(0x000000002ac80000,0x000000002ad80000)] + 0x00000000289d4800 JavaThread "C2 CompilerThread4" daemon [_thread_blocked, id=120776, stack(0x000000002ab80000,0x000000002ac80000)] + 0x00000000289cd800 JavaThread "C2 CompilerThread3" daemon [_thread_blocked, id=122340, stack(0x000000002aa80000,0x000000002ab80000)] + 0x00000000289cd000 JavaThread "C2 CompilerThread2" daemon [_thread_blocked, id=25508, stack(0x000000002a980000,0x000000002aa80000)] + 0x00000000289c9000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=120280, stack(0x000000002a880000,0x000000002a980000)] + 0x00000000289b1800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=121384, stack(0x000000002a780000,0x000000002a880000)] + 0x00000000289a2000 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=120468, stack(0x000000002a680000,0x000000002a780000)] + 0x00000000289a0000 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=63796, stack(0x000000002a580000,0x000000002a680000)] + 0x000000002899c800 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=121060, stack(0x000000002a480000,0x000000002a580000)] + 0x0000000028985800 JavaThread "Attach Listener" daemon [_thread_blocked, id=119996, stack(0x000000002a380000,0x000000002a480000)] + 0x000000002892e800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=118844, stack(0x000000002a280000,0x000000002a380000)] + 0x0000000026eb7800 JavaThread "Finalizer" daemon [_thread_blocked, id=119200, stack(0x000000002a180000,0x000000002a280000)] + 0x0000000028906000 JavaThread "Reference Handler" daemon [_thread_blocked, id=122332, stack(0x000000002a080000,0x000000002a180000)] + 0x00000000038d5800 JavaThread "main" [_thread_blocked, id=122652, stack(0x00000000035d0000,0x00000000036d0000)] + +Other Threads: +=>0x00000000288e5000 VMThread [stack: 0x0000000029f80000,0x000000002a080000] [id=87352] + 0x0000000028aaf800 WatcherThread [stack: 0x000000002b580000,0x000000002b680000] [id=119464] + +VM state:at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event]) +[0x00000000038d1650] Threads_lock - owner thread: 0x00000000288e5000 + +heap address: 0x00000005c2000000, size: 8160 MB, Compressed Oops mode: Zero based, Oop shift amount: 3 +Narrow klass base: 0x0000000000000000, Narrow klass shift: 3 +Compressed class space size: 1073741824 Address: 0x00000007c0000000 + +Heap: + PSYoungGen total 152576K, used 23607K [0x0000000716000000, 0x0000000720a00000, 0x00000007c0000000) + eden space 131072K, 18% used [0x0000000716000000,0x000000071770df10,0x000000071e000000) + from space 21504K, 0% used [0x000000071f500000,0x000000071f500000,0x0000000720a00000) + to space 21504K, 0% used [0x000000071e000000,0x000000071e000000,0x000000071f500000) + ParOldGen total 348160K, used 0K [0x00000005c2000000, 0x00000005d7400000, 0x0000000716000000) + object space 348160K, 0% used [0x00000005c2000000,0x00000005c2000000,0x00000005d7400000) + Metaspace used 4924K, capacity 5232K, committed 5504K, reserved 1056768K + class space used 570K, capacity 595K, committed 640K, reserved 1048576K + +Card table byte_map: [0x0000000012d90000,0x0000000013d90000] byte_map_base: 0x000000000ff80000 + +Marking Bits: (ParMarkBitMap*) 0x0000000074015ce0 + Begin Bits: [0x0000000015530000, 0x000000001d4b0000) + End Bits: [0x000000001d4b0000, 0x0000000025430000) + +Polling page: 0x0000000001a60000 + +CodeCache: size=245760Kb used=3529Kb max_used=3547Kb free=242230Kb + bounds [0x00000000039d0000, 0x0000000003d50000, 0x00000000129d0000] + total_blobs=567 nmethods=307 adapters=178 + compilation: enabled + +Compilation events (10 events): +Event: 0.425 Thread 0x0000000028a13800 304 3 java.lang.Character::isHighSurrogate (18 bytes) +Event: 0.425 Thread 0x0000000028a1a800 305 3 java.util.regex.Pattern$Ctype::isSatisfiedBy (24 bytes) +Event: 0.426 Thread 0x0000000028a13800 nmethod 304 0x0000000003d37fd0 code [0x0000000003d38120, 0x0000000003d382f0] +Event: 0.426 Thread 0x0000000028a13800 306 3 java.util.regex.ASCII::isType (15 bytes) +Event: 0.426 Thread 0x0000000028a19000 307 3 java.util.regex.ASCII::getType (17 bytes) +Event: 0.426 Thread 0x0000000028a13800 nmethod 306 0x0000000003d37ad0 code [0x0000000003d37c40, 0x0000000003d37eb0] +Event: 0.426 Thread 0x0000000028a1a800 nmethod 305 0x0000000003d37450 code [0x0000000003d375c0, 0x0000000003d37950] +Event: 0.426 Thread 0x0000000028a19000 nmethod 307 0x0000000003d37050 code [0x0000000003d371c0, 0x0000000003d37390] +Event: 0.428 Thread 0x0000000028a16800 nmethod 303 0x0000000003d39f90 code [0x0000000003d3a460, 0x0000000003d3d098] +Event: 0.462 Thread 0x00000000289c9000 nmethod 301 0x0000000003d43e10 code [0x0000000003d440a0, 0x0000000003d45e80] + +GC Heap History (0 events): +No events + +Deoptimization events (1 events): +Event: 0.290 Thread 0x00000000038d5800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000003c7af84 method=java.lang.String.hashCode()I @ 14 + +Classes redefined (10 events): +Event: 20.392 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70, count=1 +Event: 20.392 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70$Solution, count=1 +Event: 125.611 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70, count=2 +Event: 125.612 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70$Solution, count=2 +Event: 239.127 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70, count=3 +Event: 239.128 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70$Solution, count=3 +Event: 263.150 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70, count=4 +Event: 263.151 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70$Solution, count=4 +Event: 1897.221 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70, count=5 +Event: 1897.221 Thread 0x00000000288e5000 redefined class name=cn.whaifree.leetCode.Dynamic.LeetCode70$Solution, count=5 + +Internal exceptions (7 events): +Event: 0.027 Thread 0x00000000038d5800 Exception (0x0000000716007cb0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u202\12323\hotspot +Event: 0.027 Thread 0x00000000038d5800 Exception (0x0000000716007f98) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u202\12323\hotspot\src\share\vm\prim +Event: 0.311 Thread 0x00000000038d5800 Exception (0x0000000716a3de80) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u202\12323\hotspot\src\share\vm\prims\jni.cpp, line 710] +Event: 0.334 Thread 0x00000000038d5800 Exception (0x0000000716b27fe8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u202\12323\hotspot\src\share\vm\prims\jvm.cpp, line 1502] +Event: 0.334 Thread 0x00000000038d5800 Exception (0x0000000716b283e0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u202\12323\hotspot\src\share\vm\prims\jvm.cpp, line 1502] +Event: 0.334 Thread 0x00000000038d5800 Exception (0x0000000716b2c6c0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u202\12323\hotspot\src\share\vm\prims\jvm.cpp, line 1502] +Event: 0.334 Thread 0x00000000038d5800 Exception (0x0000000716b2cab8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u202\12323\hotspot\src\share\vm\prims\jvm.cpp, line 1502] + +Events (10 events): +Event: 308.270 Executing VM operation: ChangeBreakpoints done +Event: 1897.219 Executing VM operation: ChangeBreakpoints +Event: 1897.219 Executing VM operation: ChangeBreakpoints done +Event: 1897.219 Executing VM operation: ChangeBreakpoints +Event: 1897.219 Executing VM operation: ChangeBreakpoints done +Event: 1897.220 Executing VM operation: RedefineClasses +Event: 1897.221 Executing VM operation: RedefineClasses done +Event: 1897.560 Executing VM operation: ChangeBreakpoints +Event: 1897.560 Executing VM operation: ChangeBreakpoints done +Event: 1897.568 Executing VM operation: GetOrSetLocal + + +Dynamic libraries: +0x00007ff7bba30000 - 0x00007ff7bba67000 C:\Program Files\Java\jdk1.8.0_202\bin\java.exe +0x00007ffd6e170000 - 0x00007ffd6e386000 C:\WINDOWS\SYSTEM32\ntdll.dll +0x00007ffd6d700000 - 0x00007ffd6d7c4000 C:\WINDOWS\System32\KERNEL32.DLL +0x00007ffd6b890000 - 0x00007ffd6bc36000 C:\WINDOWS\System32\KERNELBASE.dll +0x00007ffd6e070000 - 0x00007ffd6e122000 C:\WINDOWS\System32\ADVAPI32.dll +0x00007ffd6c5e0000 - 0x00007ffd6c687000 C:\WINDOWS\System32\msvcrt.dll +0x00007ffd6dd70000 - 0x00007ffd6de18000 C:\WINDOWS\System32\sechost.dll +0x00007ffd6bc40000 - 0x00007ffd6bc68000 C:\WINDOWS\System32\bcrypt.dll +0x00007ffd6d5e0000 - 0x00007ffd6d6f5000 C:\WINDOWS\System32\RPCRT4.dll +0x00007ffd6c6b0000 - 0x00007ffd6c85d000 C:\WINDOWS\System32\USER32.dll +0x00007ffd6be80000 - 0x00007ffd6bea6000 C:\WINDOWS\System32\win32u.dll +0x00007ffd6beb0000 - 0x00007ffd6bed9000 C:\WINDOWS\System32\GDI32.dll +0x00007ffd6b700000 - 0x00007ffd6b818000 C:\WINDOWS\System32\gdi32full.dll +0x00007ffd6bde0000 - 0x00007ffd6be7a000 C:\WINDOWS\System32\msvcp_win.dll +0x00007ffd6b4a0000 - 0x00007ffd6b5b1000 C:\WINDOWS\System32\ucrtbase.dll +0x00007ffd4e7b0000 - 0x00007ffd4ea43000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.3139_none_270f19e5738675cb\COMCTL32.dll +0x00007ffd6dd20000 - 0x00007ffd6dd51000 C:\WINDOWS\System32\IMM32.DLL +0x0000000074a10000 - 0x0000000074ae2000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\msvcr100.dll +0x00000000737f0000 - 0x0000000074095000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\server\jvm.dll +0x00007ffd6d5b0000 - 0x00007ffd6d5b8000 C:\WINDOWS\System32\PSAPI.DLL +0x00007ffd531d0000 - 0x00007ffd531d9000 C:\WINDOWS\SYSTEM32\WSOCK32.dll +0x00007ffd60da0000 - 0x00007ffd60daa000 C:\WINDOWS\SYSTEM32\VERSION.dll +0x00007ffd604e0000 - 0x00007ffd60514000 C:\WINDOWS\SYSTEM32\WINMM.dll +0x00007ffd6d880000 - 0x00007ffd6d8f1000 C:\WINDOWS\System32\WS2_32.dll +0x00007ffd3b260000 - 0x00007ffd3b26f000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\verify.dll +0x00007ffd2e4d0000 - 0x00007ffd2e4f9000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\java.dll +0x00007ffd3b400000 - 0x00007ffd3b435000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\jdwp.dll +0x00007ffd624f0000 - 0x00007ffd624f8000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\npt.dll +0x00007ffd390b0000 - 0x00007ffd390d3000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\instrument.dll +0x00007ffd34930000 - 0x00007ffd34946000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\zip.dll +0x00007ffd6c9c0000 - 0x00007ffd6d21d000 C:\WINDOWS\System32\SHELL32.dll +0x00007ffd693c0000 - 0x00007ffd69cb8000 C:\WINDOWS\SYSTEM32\windows.storage.dll +0x00007ffd6d220000 - 0x00007ffd6d5a8000 C:\WINDOWS\System32\combase.dll +0x00007ffd69280000 - 0x00007ffd693be000 C:\WINDOWS\SYSTEM32\wintypes.dll +0x00007ffd6bee0000 - 0x00007ffd6bfd3000 C:\WINDOWS\System32\SHCORE.dll +0x00007ffd6db30000 - 0x00007ffd6db8e000 C:\WINDOWS\System32\shlwapi.dll +0x00007ffd6b3d0000 - 0x00007ffd6b3f6000 C:\WINDOWS\SYSTEM32\profapi.dll +0x00007ffd624e0000 - 0x00007ffd624e9000 C:\Program Files\Java\jdk1.8.0_202\jre\bin\dt_socket.dll +0x00007ffd6aa00000 - 0x00007ffd6aa69000 C:\WINDOWS\system32\mswsock.dll + +VM Arguments: +jvm_args: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:60225,suspend=y,server=n -Dvisualgc.id=586331404565800 -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:C:\Users\wenhai\AppData\Local\JetBrains\IntelliJIdea2022.3\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 +java_command: com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 cn.whaifree.leetCode.Dynamic.LeetCode70,test +java_class_path (initial): C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.3\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.3\plugins\junit\lib\junit5-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.3\plugins\junit\lib\junit-rt.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\rt.jar;D:\project\LeetCode\target\classes;D:\Program Files\apache-maven-3.9.2\repository\cn\hutool\hutool-http\5.8.18\hutool-http-5.8.18.jar;D:\Program Files\apache-maven-3.9.2\repository\cn\hutool\hutool-core\5.8.18\hutool-core-5.8.18.jar;D:\Program Files\apache-maven-3.9.2\repository\junit\junit\4.12\junit-4.12.jar;D:\Program Files\apache-maven-3.9.2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users +Launcher Type: SUN_STANDARD + +Environment Variables: +PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk1.8.0_202\bin;C:\ProgramData\Anaconda3\Scripts;C:\ProgramData\Anaconda3;%HADOOP_HOME%\bin;%HADOOP_HOME%\lib;C:\Program Files\Docker\Docker\resources\bin;C:\Users\wenhai\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin;C:\Program Files (x86)\HP\IdrsOCR_15.2.10.1114\;C:\Program Files\dotnet\;C:\Users\wenhai\anaconda3;C:\Users\wenhai\anaconda3\Library\mingw-w64\bin;C:\Users\wenhai\anaconda3\Library\usr\bin;C:\Users\wenhai\anaconda3\Library\bin;C:\Users\wenhai\anaconda3\Scripts;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\wenhai\AppData\Local\Microsoft\WindowsApps;C:\Users\wenhai\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\wenhai\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\wenhai\AppData\Local\Programs\MiKTeX\miktex\bin\x64\ +USERNAME=wenhai +OS=Windows_NT +PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 165 Stepping 2, GenuineIntel + + + +--------------- S Y S T E M --------------- + +OS: Windows 10.0 , 64 bit Build 22621 (10.0.22621.3139) + +CPU:total 16 (initial active 16) (8 cores per cpu, 2 threads per core) family 6 model 165 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx + +Memory: 4k page, physical 33418032k(7771812k free), swap 85219428k(10129964k free) + +vm_info: Java HotSpot(TM) 64-Bit Server VM (25.202-b08) for windows-amd64 JRE (1.8.0_202-b08), built on Dec 15 2018 19:54:30 by "java_re" with MS VC++ 10.0 (VS2010) + +time: Fri Mar 08 12:49:13 2024 +timezone: 中国标准时间 +elapsed time: 1897 seconds (0d 0h 31m 37s) + diff --git a/src/main/java/cn/whaifree/redo/redo_24_4_1/LeetCode2602.java b/src/main/java/cn/whaifree/redo/redo_24_4_1/LeetCode2602.java new file mode 100644 index 0000000..2566231 --- /dev/null +++ b/src/main/java/cn/whaifree/redo/redo_24_4_1/LeetCode2602.java @@ -0,0 +1,74 @@ +package cn.whaifree.redo.redo_24_4_1; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @version 1.0 + * @Author whai鏂囨捣 + * @Date 2024/4/7 11:12 + * @娉ㄩ噴 + */ +public class LeetCode2602 { + @Test + public void test() + { + Solution solution = new Solution(); + int[] nums = {2,9,6,3}; + int[] queries = {10}; + List res = solution.minOperations(nums, queries); + System.out.println(res); + } + + +// class Solution { +// public List minOperations(int[] nums, int[] queries) { +// +// List res = new ArrayList<>(); +// for (int query : queries) { +// opr(nums, query, res); +// } +// return res; +// } +// +// public void opr(int[] nums, int query, List res) { +// long count = 0; +// for (int num : nums) { +// count += Math.abs(num - query); +// } +// res.add(count); +// } +// } + + class Solution { + public List minOperations(int[] nums, int[] queries) { + Arrays.sort(nums); + // 璁$畻鍓嶇紑鍜 + long[] preSum = new long[nums.length + 1]; + for (int i = 1; i < preSum.length; i++) { + preSum[i] = preSum[i - 1] + nums[i - 1]; + } + + + List res = new ArrayList<>(); + for (int query : queries) { + opr(preSum,nums, query, res); + } + return res; + } + + public void opr(long[] preSum, int[] nums, int query, List res) { + int index = Arrays.binarySearch(nums, query); + if (index < 0) { + index = -index - 1; + } + long left = (long) index * query - preSum[index]; + long right = preSum[preSum.length - 1] - preSum[index] - (long) (preSum.length - index - 1) * query; + res.add(left + right); + } + } + +} diff --git a/src/main/java/cn/whaifree/redo/redo_24_4_1/PaLouTi.java b/src/main/java/cn/whaifree/redo/redo_24_4_1/PaLouTi.java new file mode 100644 index 0000000..bce727f --- /dev/null +++ b/src/main/java/cn/whaifree/redo/redo_24_4_1/PaLouTi.java @@ -0,0 +1,65 @@ +package cn.whaifree.redo.redo_24_4_1; + +import org.junit.Test; + +import java.util.Scanner; + +/** + * @version 1.0 + * @Author whai鏂囨捣 + * @Date 2024/4/7 11:46 + * @娉ㄩ噴 + */ +public class PaLouTi { + + @Test + public void test() { + int capacity = 3; + int m = 2; + System.out.println(plt(capacity, m)); + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + int capacity = scanner.nextInt(); + int m = scanner.nextInt(); + System.out.println(plt(capacity, m)); + + } + + + /** + * 鍋囪浣犳鍦ㄧ埇妤兼銆傞渶瑕 n 闃朵綘鎵嶈兘鍒拌揪妤奸《銆 + * 姣忔浣犲彲浠ョ埇鑷冲m (1 <= m < n)涓彴闃躲備綘鏈夊灏戠涓嶅悓鐨勬柟娉曞彲浠ョ埇鍒版ゼ椤跺憿锛 + * + * n=3 m=2 + * 3 + * 褰 m = 2锛宯 = 3 鏃讹紝n = 3 杩欒〃绀轰竴鍏辨湁涓変釜鍙伴樁锛宮 = 2 浠h〃浣犳瘡娆″彲浠ョ埇涓涓彴闃舵垨鑰呬袱涓彴闃躲 + * @param capacity + * @param m + * @return + */ + public static int plt(int capacity, int m) { + /** + * 瀹屽叏鑳屽寘 + * + * m涓虹墿鍝佺殑閲嶉噺锛岃儗鍖呭閲忎负n + * + * dp[j] 琛ㄧず浠1-m涓夋嫨涓换鎰忛夋嫨锛岀埇鍒癹鍙伴樁鍙互鏈夌殑鏂规硶鏁 + * + * dp[j] = dp[j]+dp[j-i] + * + */ + int[] dp = new int[capacity + 1]; + dp[0] = 1; + for (int j = 1; j <= capacity; j++) { + for (int i = 1; i <= m; i++) { + if (i <= j) { + dp[j] = dp[j] + dp[j - i]; + } + } + } + return dp[capacity]; + } +} diff --git a/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode121.java b/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode121.java new file mode 100644 index 0000000..6de77e3 --- /dev/null +++ b/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode121.java @@ -0,0 +1,60 @@ +package cn.whaifree.redo.redo_24_4_6; + +import org.junit.Test; + +/** + * @version 1.0 + * @Author whai鏂囨捣 + * @Date 2024/4/7 13:42 + * @娉ㄩ噴 + */ +public class LeetCode121 { + @Test + public void test() { + int[] prices = {7}; + int res = new Solution1().maxProfit(prices); + System.out.println(res); + } + + class Solution { + public int maxProfit(int[] prices) { + int min = Integer.MAX_VALUE; + int res = 0; + for (int price : prices) { + min = Math.min(min, price); + res = Math.max(res, price - min); + } + return res; + } + } + + class Solution1 { + /** + * + * + * dp[i][2] + * dp[i][0]琛ㄧず绗琲澶╂墜澶存病鏈夎偂绁ㄧ殑鎵嬪ご鐜伴噾 + * 绗琲澶╁崠鍑轰簡 dp[i-1][1]+price[i] + * 绗琲-1澶╁氨娌℃湁鑲$エ dp[i-1][0] + * dp[i][1]琛ㄧず绗琲澶╂墜澶存湁鑲$エ鐨勬墜澶寸幇閲 + * 绗琲澶╀拱鍏ョ殑 -price[i] + * 绗琲-1澶╂寔鏈夌殑 dp[i-1][1] + * + * 鍒濆鍖 + * dp[0][1] = -price[0] + * dp[0][0] = 0 + * @param prices + * @return + */ + public int maxProfit(int[] prices) { + int[][] dp = new int[prices.length][2]; + dp[0][1] = -prices[0]; + dp[0][0] = 0; + for (int i = 1; i < prices.length; i++) { + dp[i][1] = Math.max(-prices[i], dp[i - 1][1]); + dp[i][0] = Math.max(dp[i - 1][0], dp[i - 1][1] + prices[i]); + } + return dp[prices.length - 1][0]; + } + } +} diff --git a/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode21.java b/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode21.java new file mode 100644 index 0000000..ec9ca78 --- /dev/null +++ b/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode21.java @@ -0,0 +1,60 @@ +package cn.whaifree.redo.redo_24_4_6; + +import cn.whaifree.leetCode.model.ListNode; +import org.junit.Test; + +/** + * @version 1.0 + * @Author whai鏂囨捣 + * @Date 2024/4/7 12:15 + * @娉ㄩ噴 + */ +public class LeetCode21 { + + @Test + public void test() { + new Solution1().mergeTwoLists(ListNode.listNodeFromArray(new int[]{1, 2, 4}), ListNode.listNodeFromArray(new int[]{1, 3, 4})).printList(); + + } + + class Solution { + public ListNode mergeTwoLists(ListNode list1, ListNode list2) { + if (list1 == null) { + return list2; + }else if (list2 == null) { + return list1; + }else if (list1.val < list2.val) { + list1.next = mergeTwoLists(list1.next, list2); + return list1; + }else { + list2.next = mergeTwoLists(list1, list2.next); + return list2; + } + } + } + + class Solution1 { + public ListNode mergeTwoLists(ListNode list1, ListNode list2) { + ListNode preHead = new ListNode(-1); + ListNode preIndex = preHead; + ListNode indexA = list1, indexB = list2; + while (indexA != null && indexB != null) { + if (indexA.val < indexB.val) { + preIndex.next = indexA; + indexA = indexA.next; + }else { + preIndex.next = indexB; + indexB = indexB.next; + } + preIndex = preIndex.next; + } + if (indexA != null) { + preIndex.next = indexA; + } else if (indexB != null) { + preIndex.next = indexB; + } + + return preHead.next; + } + } +} diff --git a/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode22.java b/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode22.java new file mode 100644 index 0000000..bd0846f --- /dev/null +++ b/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode22.java @@ -0,0 +1,58 @@ +package cn.whaifree.redo.redo_24_4_6; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +/** + * @version 1.0 + * @Author whai鏂囨捣 + * @Date 2024/4/7 12:26 + * @娉ㄩ噴 + */ +public class LeetCode22 { + @Test + public void test() { + Solution solution = new Solution(); + List result = solution.generateParenthesis(3); + System.out.println(result); + } + + class Solution { + + public List generateParenthesis(int n) { + List result = new ArrayList<>(); + StringBuilder x = new StringBuilder(); + backTracking(n, n, n, result, x); + return result; + } + + /** + * + * @param n + * @param left 宸﹁竟鍙敤鎷彿 + * @param right 鍙宠竟鍙敤鎷彿 + * @param result + * @param path + */ + public void backTracking(int n,int left,int right, List result, StringBuilder path) { + + if (left == 0 && right == 0) { + result.add(path.toString()); + return; + } + if (left < 0 || left > right) { + return; + } + + path.append("("); + backTracking(n, left - 1, right, result, path); + path.deleteCharAt(path.length() - 1); + + path.append(")"); + backTracking(n, left, right - 1, result, path); + path.deleteCharAt(path.length() - 1); + } + } +} diff --git a/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode31.java b/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode31.java new file mode 100644 index 0000000..acded2d --- /dev/null +++ b/src/main/java/cn/whaifree/redo/redo_24_4_6/LeetCode31.java @@ -0,0 +1,63 @@ +package cn.whaifree.redo.redo_24_4_6; + +import org.junit.Test; + +/** + * @version 1.0 + * @Author whai鏂囨捣 + * @Date 2024/4/7 13:06 + * @娉ㄩ噴 + */ +public class LeetCode31 { + @Test + public void test() { + int[] nums = {2,3,1}; + new Solution().nextPermutation(nums); + } + + class Solution { + public void nextPermutation(int[] nums) { + // 123465 涓嬩竴涓帓鍒 123546 + // 浠庡悗寰鍓嶆壘鍒扮涓涓崌搴忕殑[a,x1,x2,b] + // 浠巄閭i儴鍒嗘壘鍒扮涓涓ぇ浜巟1鐨刢 + // 鏇挎崲x1 鍜宑 + // reverse x2-- + int i = nums.length - 2; + while (i >= 0) { + if (nums[i] < nums[i + 1]) { + break; + } + i--; + } + + if (i == -1) { + reverse(nums, 0, nums.length - 1); + return; + } + int j = nums.length - 1; + while (j > i) { + if (nums[j] > nums[i]) { + break; + } + j--; + } + + swap(nums, i, j); + reverse(nums, i + 1, nums.length - 1); + } + + public void reverse(int[] nums, int start, int end) { + while (start < end) { + swap(nums, start, end); + start++; + end--; + } + } + + public void swap(int[] nums, int i, int j) { + int temp = nums[i]; + nums[i] = nums[j]; + nums[j] = temp; + } + } +} diff --git a/sync.cmd b/sync.cmd new file mode 100644 index 0000000..2bf063e --- /dev/null +++ b/sync.cmd @@ -0,0 +1,30 @@ + +@echo off + +setlocal enabledelayedexpansion + +git add . + +:: 鑾峰彇鏆傚瓨鍖轰腑鐨勬洿鏀规枃浠跺垪琛 +for /f "delims=" %%a in ('git diff --cached --name-only') do ( + set "changed_files=!changed_files! %%a" +) + +:: 濡傛灉娌℃湁鏂囦欢鏇存敼锛屽垯璁剧疆涓涓粯璁ょ殑鎻愪氦淇℃伅 +if "%changed_files%"=="" ( + set "commit_message=No files changed" +) else ( + :: 璁剧疆鎻愪氦淇℃伅锛屽寘鎷慨鏀圭殑鏂囦欢鍒楄〃 + set "commit_message=Updated files: %changed_files%" +) + +:: 鎵цgit commit +git commit -m "%commit_message%" +echo "git push origin master" +git push origin master +echo "git push gitee master" +git push gitee master +echo "git push github master" +git push github master + +endlocal