算法问题解决方案
这是来自Github项目 https://github.com/lzwjava/algorithm-solutions 的 README.md
。
算法问题解决方案
一些在线评测平台中的算法问题解决方案。
平台 | 解决的问题数量 |
---|---|
UVa | 568 |
Codeforces | 419 |
LeetCode | 20 |
Hacker Rank | 20(SQL) |
语言 | 代码行数 |
---|---|
Java | 70851 |
C++ | 3214 |
Python | 1193 |
SQL | 101 |
该仓库包含了来自Codeforces、HackerRank、LeetCode、Lintcode、Nowcoder 和 UVa等平台的各种算法问题解决方案。每个解决方案都按问题编号组织,并包括源代码、输入文件,有时还有额外的文档。
仓库结构
README.md
: 此文件。codeforces/
: 包含Codeforces 问题的解决方案。hacker_rank/
: 包含HackerRank SQL问题的解决方案。leetcode/
: 包含LeetCode 问题的解决方案。lintcode/
: 包含Lintcode 问题的解决方案。nowcoder/
: 包含Nowcoder 问题的解决方案。uva/
: 包含UVa 问题的解决方案。
Codeforces
codeforces
目录中的每个子目录都以问题编号命名,并包括以下内容:
1.in
: 问题的输入文件。src/Main.java
: 包含问题解决方案的Java 源代码文件。
HackerRank
hacker_rank
目录包含各种问题的SQL 文件。每个文件都以其解决的问题命名。
LeetCode
leetcode
目录包含不同问题的Python 脚本。文件名以其解决的问题命名,例如 two_sum.py
或 valid_parentheses.py
。
Lintcode
lintcode
目录中的每个子目录都以问题编号命名,并包括以下内容:
src/com/lintcode/Main.java
: 解决方案的主类文件。src/com/lintcode/Solution.java
: 问题解决方案的类文件。src/com/lintcode/
: 根据问题需求的额外类文件。
Nowcoder
nowcoder
目录中的每个子目录都以问题命名,并包括以下内容:
Solution.java
: 问题解决方案的类文件。Test.java
: 问题测试类文件。TreeNode.java
: (如果适用) 适用于涉及树结构的问题的TreeNode 类文件。
UVa
已解决: 568, 提交: 1776
Q1 | Q2 | Q3 |
---|---|---|
100: The 3n + 1 Problem | 101: The Blocks Problem | 102: Ecological Bin Packing |
103: Stacking Boxes | 104: Arbitrage | 105: The Skyline Problem |
106: Fermat’s Last Theorem | 107: The Cat in the Hat | 108: Maximum Sum |
110: Meta-Loopless Sorts | 111: History Grading | 112: Tree Summing |
113: Power of Cryptography | 116: Unidirectional TSP | 118: Mutant Flatworld Explorers |
119: Greedy Gift Givers | 120: Stacks of Flapjacks | 122: Trees on the Level |
123: Searching Quickly | 124: Following Orders | 127: “Accordian” Patience |
128: Software CRC | 129: Krypton Factor | 131: The Domino Effect |
133: The Dole Queue | 136: Ugly Numbers | 138: Street Numbers |
140: Bandwidth | 146: ID Codes | 147: Dollars |
151: Power Crisis | 152: Tree’s a Crowd | 156: Ananagrams |
160: Factors and Factorials | 167: The Sultan’s Successors | 185: Roman Numerals |
190: Circle Through Three Points | 193: Graph Coloring | 195: Anagram |
196: Spreadsheet | 197: Orbiting Satellites | 200: Rare Order |
201: Squares | 202: Repeating Decimals | 208: Firetruck |
210: Determining Periods | 211: The Domino Effect | 213: Message Decoding |
216: Getting in Line | 221: Partitioning Polygon | 225: Golomb Rulers |
227: Puzzle | 230: Borrowers | 231: Testing the CATCHER |
247: Calling Circles | 253: Cube painting | 256: Quirksome Squares |
260: Il Gioco dell’X | 264: Count on Cantor | 272: TEX Quotes |
278: Chess | 280: Vertex | 291: The House Of Santa Claus |
294: Divisors | 297: Quadtrees | 299: Train Swapping |
301: Transportation | 305: Joseph | 307: Sticks |
315: Network | 317: Power Transmission | 324: Factorial Frequencies |
327: Evaluating Simple C Expressions | 331: Mapping the Swaps | 336: A Node Too Far |
340: Master-Mind Hints | 343: What Base Is This? | 344: Roman Digititis |
348: Optimal Array Multiplication Sequence | 350: Pseudo-Random Numbers | 352: The Seasonal War |
353: Pesky Palindromes | 357: Let Me Count The Ways | 369: Combinations |
371: Ackermann Functions | 374: Big Mod | 375: Inscribed Circles and Isosceles Triangles |
378: Intersecting Lines | 382: Perfection | 386: Perfect Cubes |
387: Repeated Substitution with Sed | 389: Basically Speaking | 392: Polynomial Showdown |
400: Unix ls | 401: Palindromes | 406: Prime Cuts |
408: Uniform Generator | 409: Excuses, Excuses! | 412: Pi |
414: Machined Surfaces | 417: Word Index | 424: Integer Inquiry |
429: Word Transformation | 437: The Tower of Babylon | 438: The Circumference of the Circle |
439: Knight Moves | 440: Eeny Meeny Moo | 441: Lotto |
442: Matrix Chain Multiplication | 443: Humble Numbers | 444: Encoder and Decoder |
445: Marvelous Mazes | 446: Kibbles n' Bits n’ Bits `n’ Bits |
455: Periodic Strings |
457: Linear Cellular Automata | 458: The Decoder | 459: Graph Connectivity |
465: Overflow | 469: Wetlands of Florida | 476: Points in Figures: Rectangles |
477: Points in Figures: Rectangles and Circles | 478: Points in Figures: Rectangles, Circles, Triangles | 481: What Goes Up |
482: Permutation Arrays | 483: Word Scramble | 484: The Department of Redundancy Department |
488: Triangle Wave | 489: Hangman Judge | 490: Rotating Sentences |
492: Pig-Latin | 494: Kindergarten Counting Game | 495: Fibonacci Freeze |
496: Simply Subsets | 497: Strategic Defense Initiative | 499: What’s The Frequency, Kenneth? |
507: Jill Rides Again | 509: Just the Facts | 512: Taiwan Railway |
514: Rails | 524: Prime Ring Problem | 530: Binomial Showdown |
531: Compromise | 532: Dungeon Master | 534: Frogger |
536: Tree Recovery | 537: Railroads | 539: The Settlers of Catan |
540: Team Queue | 541: Error Correction | 543: Goldbach’s Conjecture |
544: Heavy Cargo | 548: Tree | 550: Multiplying by Rotation |
558: Wormholes | 562: Dividing coins | 567: Risk |
568: Just the Facts | 572: Oil Deposits | 573: The Snail |
574: Sum It Up | 575: Skew Binary | 576: Haiku Review |
579: Clock Hands | 583: Prime Factors | 591: Box of Bricks |
594: One Little, Two Little, Three Little Endians | 612: DNA Sorting | 621: Secret Research |
623: 500! | 624: CD | 637: Booklet Printing |
639: Don’t Get Rooked | 640: Self Numbers | 644: Immediate Decodability |
657: The die is cast | 661: Blowing Fuses | 673: Parentheses Balance |
674: Coin Change | 679: Dropping Balls | 686: Goldbach’s Conjecture (II) |
694: The Collatz Sequence | 696: How Many Knights | 699: The Falling Leaves |
705: Slash Maze | 706: LC-Display | 712: S-Trees |
713: Adding Reversed Numbers | 714: Copying Books | 725: Division |
727: Equation | 729: The Hamming Distance Problem | 748: Exponentiation |
750: 8 Queens Chess Problem | 755: 487–3279 | 784: Maze Exploration |
793: Network Connections | 796: Critical Links | 815: Flooded! |
818: Job Matching | 820: Internet Bandwidth | 821: Page Hopping |
834: Continued Fractions | 836: Largest Submatrix | 839: Not so Mobile |
846: Steps | 847: A Multiplication Game | 900: Brick Wall Patterns |
913: Joana and the Odd Numbers | 924: Spreading The News | 929: Number Maze |
948: Fibonaccimal Base | 993: Product of digits | 1124: Celebrity jeopardy |
1149: Dangerous Dive | 1152: 4 Values whose Sum is 0 | 1203: Argus |
1225: Digit Counting | 1230: MODEX | 1237: Expert Enough? |
1260: Sales | 1339: Ancient Cipher | 1368: DNA Consensus String |
1374: Power Transmission | 1451: Ghostbusters 2 | 1471: Dangerous Dive |
1583: Digital Roots | 1584: Mathematics | 1585: Score |
1586: Molar Mass | 1587: Box | 1588: War |
1589: Partitioning | 1590: Elevator | 1592: Transmission |
1593: Pipes | 1594: Diamond | 1595: One Liner |
1604: Jumping Champion | 1605: Fibonacci Sum | 1606: Candy |
1607: Kaprekar Numbers | 1608: Random Walk | 1609: Look-and-say sequence |
10000: Longest Paths | 10003: Cutting Sticks | 10004: Bicoloring |
10006: Carmichael Numbers | 10008: What’s Cryptanalysis? | 10010: Where’s Waldorf? |
10012: How Big Is It? | 10013: Super long sums | 10014: Simple Base Conversion |
10018: Reverse and Add | 10019: Funny Encryption Method | 10025: The Game of MasterMind |
10026: Shoemaker’s Problem | 10033: Billiard | 10034: Freckles |
10035: Primary Arithmetic | 10036: Divisibility | 10038: Jolly Jumpers |
10041: Vito’s Family | 10042: Smith Numbers | 10047: The Monocycle |
10048: Audiophobia | 10050: Hartals | 10054: The Necklace |
10055: Hashmat the Brave Warrior | 10056: What is the Probability? | 10061: How to solve the cryptarithm? |
10062: Tell me the frequencies! | 10066: The Twin Towers | 10067: Playing with Wheels |
10070: Leap Year or Not Leap Year and … | 10071: Back to High School Physics | 10074: Take the Land |
10077: The Stern-Brocot Number System | 10079: Pizza Cutting | 10082: WERTYU |
10098: Generating Fast | 10099: The Tourist Guide | 10101: Bangla Numbers |
10102: The path in the colored field | 10104: Euclid Problem | 10105: Polynomial Coefficients |
10106: Product | 10107: What is the Median? | 10110: Light, more light |
10112: Myacron Lifetime Achievement Award | 10114: Loansome Car Buyer | 10115: Automatic Editing |
10116: Robot Motion | 10123: Snowball Fight! | 10125: Sumsets |
10127: On a Diet | 10129: Play on Words | 10130: SuperSale |
10131: Is Bigger Smarter? | 10137: The Trip | 10139: Factovisors |
10140: Prime Distance | 10141: Request for Proposal | 10152: ShellSort |
10160: Servicing Stations | 10161: Ant on a Chessboard | 10167: Birthday Cake |
10168: Summation of Four Primes | 10170: The Hotel with Infinite Rooms | 10177: Magic Square Palindromes |
10179: Irreducible Basic Fractions | 10183: How many Fibs? | 10189: Minesweeper |
10190: Divide, But Not Quite Conquer! | 10191: Longest Nap | 10192: Vacation |
10193: All You Need Is Love | 10194: Football (aka Soccer) | 10195: The Knights Of The Round Table |
10198: Counting | 10199: Tourist Guide | 10205: Stack ‘em Up |
10209: Is This Integration? | 10219: Find the ways! | 10220: I Love Big Numbers! |
10221: Two-Three Move | 10222: Decode the Message | 10226: Hardwood Species |
10229: Modular Fibonacci | 10235: Simply Emirp | 10242: Fourth Point !! |
10245: The Closest Pair Problem | 10250: The Other Two Trees | 10252: Common Permutation |
10258: Contest Scoreboard | 10260: Soundex | 10267: Graphical Editor |
10276: Hanoi Tower Troubles Again! | 10281: Average Speed | 10282: Babelfish |
10285: Longest Run on a Snowboard | 10286: Trouble with a Pentagon | 10295: Hay Points |
10298: Power Strings | 10299: Relatives | 10300: Ecological Premium |
10302: Summation of Polynomials | 10305: Ordering Tasks | 10310: Dog and Gopher |
10323: Factorial! You Must be Kidding!!! | 10324: Zeros and Ones | 10327: Flip Sort |
10334: Ray Through Glasses | 10336: Rank the Languages | 10338: Mischievous Children |
10340: All in All | 10341: Solve It | 10344: 23 out of 5 |
10346: Peter’s Smokes | 10347: Medians | 10361: Automatic Poetry |
10369: Arctic Network | 10370: Above Average | 10387: Billiard Balls |
10391: Compound Words | 10392: Factoring Large Numbers | 10394: Twin Primes |
10397: Connect the Campus | 10405: Longest Common Subsequence | 10409: Die Game |
10420: List of Conquests | 10424: Love Calculator | 10432: Warehouse |
10450: World Cup Noise | 10452: Marcus | 10465: Homer Simpson |
10469: To Carry or not to Carry | 10473: Climbing Trees | 10474: The Candyman Can |
10487: Closest Sums | 10494: If We Were a Child Again | 10496: Collecting Beepers |
10499: Big Big Real Numbers | 10515: Power Sum | 10523: Very Easy !!! |
10530: Guessing Game | 10533: Digit Primes | 10534: Wavio Sequence |
10550: Combination Lock | 10557: XYZZY | 10562: Undraw the Trees |
10579: Fibonacci Numbers | 10583: Ubiquitous Religions | 10591: Happy Numbers |
10596: Deep Down Below | 10600: ACM Contest and Blackout | 10603: The Experimental Library |
10608: Friends | 10611: The Playboy Chimp | 10616: Divisible Group Sums |
10653: Bombs! NO they are Mines!! | 10656: Maximum Sum (II) | 10664: Luggage |
10673: Play with Floor and Ceil | 10679: I Love Strings!! | 10684: The jackpot |
10696: f91 | 10699: Count the factors | 10703: Free spots |
10719: Quirky Quantifiers | 10763: Foreign Exchange | 10773: Back to Intermediate Math |
10783: Odd Sum | 10784: Diagonal | 10785: Speed limit |
10789: Primo Words | 10790: How many points of intersection? | 10810: Ultra-QuickSort |
10812: Beat the Spread! | 10815: Andy’s First Dictionary | 10878: Decode the tape |
10879: Maximum Sum (II) | 10905: Children’s Game | 10911: Forming Quiz Teams |
10916: Factstone Benchmark | 10921: Find the Telephone | 10922: 2520 |
10924: Simple Minded Hashing | 10929: You can say 11 | 10931: Parity |
10935: Throwing cards away I | 10940: Throwing cards away II | 10943: How do you add? |
10945: Mother bear | 10948: The primary problem | 10954: Add All |
10963: The Swallowing Ground | 10970: Big Chocolate | 10976: Fractions Again?! |
10986: Sending email | 11000: Bee | 11044: Searching for Nessy |
11054: Wine trading in Gergovia | 11057: Exact Sum | 11059: Maximum Product |
11060: Beverages | 11085: Back to the 8-Queens | 11093: Just Finish it up |
11094: Continents | 11111: Generalized Matrioshkas | 11134: Fabled Rooks |
11137: Triple Fat Ladies | 11150: Cola | 11151: Longest Palindrome |
11152: Colourful Flowers | 11172: Relational Operator | 11185: Ternary |
11192: No Problem! | 11205: The broken pedometer | 11212: Editing a Book |
11214: Aladdin and the Flying Carpet | 11219: How Old Are You? | 11231: Black and white painting |
11234: Expressions | 11235: Frequent Values | 11244: Counting Stars |
11286: Conformity | 11292: Dragon of Loowater | 11332: Summing Digits |
11340: Newspaper | 11349: Symmetric Matrix | 11362: Phone List |