ζθ εθοΌεΏ ζδΈεΎγ
As an idiot of algorithms, I make bold to resolve the problems on LeetCode, especially, in Swift. Most of the algorithms were not figured out by myself.
let π = "Easy", π = "Medium", π¨ = "Hard", γοΈ = "require premium membership"
- 1 π Two Sum .swift
- 2 π Add Two Numbers .swift
- 3 π Longest Substring Without Repeating Characters .swift
- 4 π¨ Median of Two Sorted Arrays
- 5 π Longest Palindromic Substring .swift
- 6 π ZigZag Conversion .swift
- 7 π Reverse Integer .swift
- 8 π String to Integer (atoi) .swift
- 9 π Palindrome Number .swift
- 10 π¨ Regular Expression Matching
- 11 π Container With Most Water
- 12 π Integer to Roman .swift
- 13 π Roman to Integer .swift
- 14 π Longest Common Prefix .swift
- 15 π 3Sum
- 16 π 3Sum Closest
- 17 π Letter Combinations of a Phone Number .swift
- 18 π 4Sum
- 19 π Remove Nth Node From End of List .swift
- 20 π Valid Parentheses .swift
- 21 π Merge Two Sorted Lists .swift
- 22 π Generate Parentheses
- 23 π¨ Merge k Sorted Lists
- 24 π Swap Nodes in Pairs
- 25 π¨ Reverse Nodes in k-Group
- 26 π Remove Duplicates from Sorted Array .swift
- 27 π Remove Element .swift
- 28 π Implement strStr() .swift
- 29 π Divide Two Integers
- 30 π¨ Substring with Concatenation of All Words
- 31 π Next Permutation
- 32 π¨ Longest Valid Parentheses
- 33 π Search in Rotated Sorted Array
- 34 π Find First and Last Position of Element in Sorted Array
- 35 π Search Insert Position .swift
- 36 π Valid Sudoku
- 37 π¨ Sudoku Solver
- 38 π Count and Say .swift
- 39 π Combination Sum
- 40 π Combination Sum II
- 41 π¨ First Missing Positive
- 42 π¨ Trapping Rain Water
- 43 π Multiply Strings
- 44 π¨ Wildcard Matching
- 45 π¨ Jump Game II
- 46 π Permutations
- 47 π Permutations II
- 48 π Rotate Image
- 49 π Group Anagrams .swift
- 50 π Pow(x, n)
- 51 π¨ N-Queens
- 52 π¨ N-Queens II
- 53 π Maximum Subarray
- 54 π Spiral Matrix
- 55 π Jump Game
- 56 π Merge Intervals
- 57 π¨ Insert Interval
- 58 π Length of Last Word .swift
- 59 π Spiral Matrix II
- 60 π Permutation Sequence
- 61 π Rotate List
- 62 π Unique Paths
- 63 π Unique Paths II
- 64 π Minimum Path Sum
- 65 π¨ Valid Number .swift
- 66 π Plus One .swift
- 67 π Add Binary .swift
- 68 π¨ Text Justification
- 69 π Sqrt(x)
- 70 π Climbing Stairs
- 71 π Simplify Path
- 72 π¨ Edit Distance
- 73 π Set Matrix Zeroes
- 74 π Search a 2D Matrix
- 75 π Sort Colors
- 76 π¨ Minimum Window Substring
- 77 π Combinations
- 78 π Subsets
- 79 π Word Search
- 80 π Remove Duplicates from Sorted Array II
- 81 π Search in Rotated Sorted Array II
- 82 π Remove Duplicates from Sorted List II .swift
- 83 π Remove Duplicates from Sorted List .swift
- 84 π¨ Largest Rectangle in Histogram
- 85 π¨ Maximal Rectangle
- 86 π Partition List
- 87 π¨ Scramble String
- 88 π Merge Sorted Array .swift
- 89 π Gray Code
- 90 π Subsets II
- 91 π Decode Ways
- 92 π Reverse Linked List II
- 93 π Restore IP Addresses
- 94 π Binary Tree Inorder Traversal
- 95 π Unique Binary Search Trees II
- 96 π Unique Binary Search Trees
- 97 π¨ Interleaving String
- 98 π Validate Binary Search Tree
- 99 π¨ Recover Binary Search Tree
- 100 π Same Tree .swift
- 101 π Symmetric Tree .swift
- 102 π Binary Tree Level Order Traversal
- 103 π Binary Tree Zigzag Level Order Traversal
- 104 π Maximum Depth of Binary Tree .swift
- 105 π Construct Binary Tree from Preorder and Inorder Traversal
- 106 π Construct Binary Tree from Inorder and Postorder Traversal
- 107 π Binary Tree Level Order Traversal II
- 108 π Convert Sorted Array to Binary Search Tree
- 109 π Convert Sorted List to Binary Search Tree
- 110 π Balanced Binary Tree .swift
- 111 π Minimum Depth of Binary Tree .swift
- 112 π Path Sum
- 113 π Path Sum II
- 114 π Flatten Binary Tree to Linked List .swift
- 115 π¨ Distinct Subsequences
- 116 π Populating Next Right Pointers in Each Node
- 117 π Populating Next Right Pointers in Each Node II
- 118 π Pascal's Triangle
- 119 π Pascal's Triangle II
- 120 π Triangle
- 121 π Best Time to Buy and Sell Stock
- 122 π Best Time to Buy and Sell Stock II
- 123 π¨ Best Time to Buy and Sell Stock III
- 124 π¨ Binary Tree Maximum Path Sum
- 125 π Valid Palindrome
- 126 π¨ Word Ladder II
- 127 π Word Ladder
- 128 π¨ Longest Consecutive Sequence
- 129 π Sum Root to Leaf Numbers
- 130 π Surrounded Regions
- 131 π Palindrome Partitioning
- 132 π¨ Palindrome Partitioning II
- 133 π Clone Graph
- 134 π Gas Station
- 135 π¨ Candy
- 136 π Single Number .swift
- 137 π Single Number II
- 138 π Copy List with Random Pointer
- 139 π Word Break
- 140 π¨ Word Break II
- 141 π Linked List Cycle
- 142 π Linked List Cycle II
- 143 π Reorder List
- 144 π Binary Tree Preorder Traversal
- 145 π¨ Binary Tree Postorder Traversal
- 146 π¨ LRU Cache
- 147 π Insertion Sort List
- 148 π Sort List
- 149 π¨ Max Points on a Line
- 150 π Evaluate Reverse Polish Notation
- 151 π Reverse Words in a String
- 152 π Maximum Product Subarray
- 153 π Find Minimum in Rotated Sorted Array
- 154 π¨ Find Minimum in Rotated Sorted Array II
- 155 π Min Stack .swift
- 156 π Binary Tree Upside Down γοΈ
- 157 π Read N Characters Given Read4 γοΈ
- 158 π¨ Read N Characters Given Read4 II - Call multiple times γοΈ
- 159 π¨ Longest Substring with At Most Two Distinct Characters γοΈ
- 160 π Intersection of Two Linked Lists
- 161 π One Edit Distance γοΈ
- 162 π Find Peak Element
- 163 π Missing Ranges γοΈ
- 164 π¨ Maximum Gap
- 165 π Compare Version Numbers .swift
- 166 π Fraction to Recurring Decimal
- 167 π Two Sum II - Input array is sorted
- 168 π Excel Sheet Column Title
- 169 π Majority Element
- 170 π Two Sum III - Data structure design γοΈ
- 171 π Excel Sheet Column Number
- 172 π Factorial Trailing Zeroes
- 173 π Binary Search Tree Iterator
- 174 π¨ Dungeon Game
- 179 π Largest Number
- 186 π Reverse Words in a String II γοΈ
- 187 π Repeated DNA Sequences
- 188 π¨ Best Time to Buy and Sell Stock IV
- 189 π Rotate Array .swift
- 190 π Reverse Bits
- 191 π Number of 1 Bits
- 198 π House Robber
- 199 π Binary Tree Right Side View
- 200 π Number of Islands
- 201 π Bitwise AND of Numbers Range
- 202 π Happy Number
- 203 π Remove Linked List Elements
- 204 π Count Primes
- 205 π Isomorphic Strings
- 206 π Reverse Linked List
- 207 π Course Schedule
- 208 π Implement Trie (Prefix Tree)
- 209 π Minimum Size Subarray Sum
- 210 π Course Schedule II
- 211 π Add and Search Word - Data structure design
- 212 π¨ Word Search II
- 213 π House Robber II
- 214 π¨ Shortest Palindrome
- 215 π Kth Largest Element in an Array
- 216 π Combination Sum III
- 217 π Contains Duplicate
- 218 π¨ The Skyline Problem
- 219 π Contains Duplicate II
- 220 π Contains Duplicate III
- 221 π Maximal Square
- 222 π Count Complete Tree Nodes
- 223 π Rectangle Area
- 224 π¨ Basic Calculator
- 225 π Implement Stack using Queues
- 226 π Invert Binary Tree .swift
- 227 π Basic Calculator II
- 228 π Summary Ranges
- 229 π Majority Element II
- 230 π Kth Smallest Element in a BST
- 231 π Power of Two
- 232 π Implement Queue using Stacks
- 233 π¨ Number of Digit One
- 234 π Palindrome Linked List
- 235 π Lowest Common Ancestor of a Binary Search Tree
- 236 π Lowest Common Ancestor of a Binary Tree
- 237 π Delete Node in a Linked List
- 238 π Product of Array Except Self
- 239 π¨ Sliding Window Maximum
- 240 π Search a 2D Matrix II
- 241 π Different Ways to Add Parentheses
- 242 π Valid Anagram .swift
- 243 π Shortest Word Distance γοΈ
- 244 π Shortest Word Distance II γοΈ
- 245 π Shortest Word Distance III γοΈ
- 246 π Strobogrammatic Number γοΈ
- 247 π Strobogrammatic Number II γοΈ
- 248 π¨ Strobogrammatic Number III γοΈ
- 249 π Group Shifted Strings γοΈ
- 250 π Count Univalue Subtrees γοΈ
- 251 π Flatten 2D Vector γοΈ
- 252 π Meeting Rooms γοΈ
- 253 π Meeting Rooms II γοΈ
- 254 π Factor Combinations γοΈ
- 255 π Verify Preorder Sequence in Binary Search Tree γοΈ
- 256 π Paint House γοΈ
- 257 π Binary Tree Paths
- 258 π Add Digits .swift
- 259 π 3Sum Smaller γοΈ
- 260 π Single Number III
- 261 π Graph Valid Tree γοΈ
- 263 π Ugly Number .swift
- 264 π Ugly Number II
- 265 π¨ Paint House II γοΈ
- 266 π Palindrome Permutation γοΈ
- 267 π Palindrome Permutation II γοΈ
- 268 π Missing Number .swift
- 269 π¨ Alien Dictionary γοΈ
- 270 π Closest Binary Search Tree Value γοΈ
- 271 π Encode and Decode Strings γοΈ
- 272 π¨ Closest Binary Search Tree Value II γοΈ
- 273 π¨ Integer to English Words
- 274 π H-Index
- 275 π H-Index II
- 276 π Paint Fence γοΈ
- 277 π Find the Celebrity γοΈ
- 278 π First Bad Version
- 279 π Perfect Squares
- 280 π Wiggle Sort γοΈ
- 281 π Zigzag Iterator γοΈ
- 282 π¨ Expression Add Operators
- 283 π Move Zeroes .swift
- 284 π Peeking Iterator
- 285 π Inorder Successor in BST γοΈ
- 286 π Walls and Gates γοΈ
- 287 π Find the Duplicate Number
- 288 π Unique Word Abbreviation γοΈ
- 289 π Game of Life
- 290 π Word Pattern
- 291 π¨ Word Pattern II γοΈ
- 292 π Nim Game
- 293 π Flip Game γοΈ
- 294 π Flip Game II γοΈ
- 295 π¨ Find Median from Data Stream
- 296 π¨ Best Meeting Point γοΈ
- 297 π¨ Serialize and Deserialize Binary Tree
- 298 π Binary Tree Longest Consecutive Sequence γοΈ
- 299 π Bulls and Cows
- 300 π Longest Increasing Subsequence
- 301 π¨ Remove Invalid Parentheses
- 302 π¨ Smallest Rectangle Enclosing Black Pixels γοΈ
- 303 π Range Sum Query - Immutable
- 304 π Range Sum Query 2D - Immutable
- 305 π¨ Number of Islands II γοΈ
- 306 π Additive Number
- 307 π Range Sum Query - Mutable
- 308 π¨ Range Sum Query 2D - Mutable γοΈ
- 309 π Best Time to Buy and Sell Stock with Cooldown
- 310 π Minimum Height Trees
- 311 π Sparse Matrix Multiplication γοΈ
- 312 π¨ Burst Balloons
- 313 π Super Ugly Number
- 314 π Binary Tree Vertical Order Traversal γοΈ
- 315 π¨ Count of Smaller Numbers After Self
- 316 π¨ Remove Duplicate Letters
- 317 π¨ Shortest Distance from All Buildings γοΈ
- 318 π Maximum Product of Word Lengths
- 319 π Bulb Switcher
- 320 π Generalized Abbreviation γοΈ
- 321 π¨ Create Maximum Number
- 322 π Coin Change
- 323 π Number of Connected Components in an Undirected Graph γοΈ
- 324 π Wiggle Sort II
- 325 π Maximum Size Subarray Sum Equals k γοΈ
- 326 π Power of Three .swift
- 327 π¨ Count of Range Sum
- 328 π Odd Even Linked List
- 329 π¨ Longest Increasing Path in a Matrix
- 330 π¨ Patching Array
- 331 π Verify Preorder Serialization of a Binary Tree
- 332 π Reconstruct Itinerary
- 333 π Largest BST Subtree γοΈ
- 334 π Increasing Triplet Subsequence
- 335 π¨ Self Crossing
- 336 π¨ Palindrome Pairs
- 337 π House Robber III
- 338 π Counting Bits
- 339 π Nested List Weight Sum γοΈ
- 340 π¨ Longest Substring with At Most K Distinct Characters γοΈ
- 341 π Flatten Nested List Iterator
- 342 π Power of Four
- 343 π Integer Break
- 344 π Reverse String
- 345 π Reverse Vowels of a String
- 346 π Moving Average from Data Stream γοΈ
- 347 π Top K Frequent Elements
- 348 π Design Tic-Tac-Toe γοΈ
- 349 π Intersection of Two Arrays
- 350 π Intersection of Two Arrays II
- 351 π Android Unlock Patterns γοΈ
- 352 π¨ Data Stream as Disjoint Intervals
- 353 π Design Snake Game γοΈ
- 354 π¨ Russian Doll Envelopes
- 355 π Design Twitter
- 356 π Line Reflection γοΈ
- 357 π Count Numbers with Unique Digits
- 358 π¨ Rearrange String k Distance Apart γοΈ
- 359 π Logger Rate Limiter γοΈ
- 360 π Sort Transformed Array γοΈ
- 361 π Bomb Enemy γοΈ
- 362 π Design Hit Counter γοΈ
- 363 π¨ Max Sum of Rectangle No Larger Than K
- 364 π Nested List Weight Sum II γοΈ
- 365 π Water and Jug Problem
- 366 π Find Leaves of Binary Tree γοΈ
- 367 π Valid Perfect Square
- 368 π Largest Divisible Subset
- 369 π Plus One Linked List γοΈ
- 370 π Range Addition γοΈ
- 371 π Sum of Two Integers
- 372 π Super Pow
- 373 π Find K Pairs with Smallest Sums
- 374 π Guess Number Higher or Lower
- 375 π Guess Number Higher or Lower II
- 376 π Wiggle Subsequence
- 377 π Combination Sum IV
- 378 π Kth Smallest Element in a Sorted Matrix
- 379 π Design Phone Directory γοΈ
- 380 π Insert Delete GetRandom O(1)
- 381 π¨ Insert Delete GetRandom O(1) - Duplicates allowed
- 382 π Linked List Random Node
- 383 π Ransom Note
- 384 π Shuffle an Array
- 385 π Mini Parser
- 386 π Lexicographical Numbers
- 387 π First Unique Character in a String
- 388 π Longest Absolute File Path
- 389 π Find the Difference
- 390 π Elimination Game
- 391 π¨ Perfect Rectangle
- 392 π Is Subsequence
- 393 π UTF-8 Validation
- 394 π Decode String
- 395 π Longest Substring with At Least K Repeating Characters
- 396 π Rotate Function
- 397 π Integer Replacement
- 398 π Random Pick Index
- 399 π Evaluate Division
- 400 π Nth Digit
- 401 π Binary Watch
- 402 π Remove K Digits
- 403 π¨ Frog Jump
- 404 π Sum of Left Leaves
- 405 π Convert a Number to Hexadecimal
- 406 π Queue Reconstruction by Height
- 407 π¨ Trapping Rain Water II
- 408 π Valid Word Abbreviation γοΈ
- 409 π Longest Palindrome
- 410 π¨ Split Array Largest Sum
- 411 π¨ Minimum Unique Word Abbreviation γοΈ
- 412 π Fizz Buzz
- 413 π Arithmetic Slices
- 414 π Third Maximum Number
- 415 π Add Strings
- 416 π Partition Equal Subset Sum
- 417 π Pacific Atlantic Water Flow
- 418 π Sentence Screen Fitting γοΈ
- 419 π Battleships in a Board
- 420 π¨ Strong Password Checker
- 421 π Maximum XOR of Two Numbers in an Array
- 422 π Valid Word Square γοΈ
- 423 π Reconstruct Original Digits from English
- 424 π Longest Repeating Character Replacement
- 425 π¨ Word Squares γοΈ
- 432 π¨ All O`one Data Structure
- 433 π Minimum Genetic Mutation
- 434 π Number of Segments in a String
- 435 π Non-overlapping Intervals
- 436 π Find Right Interval
- 437 π Path Sum III
- 438 π Find All Anagrams in a String
- 439 π Ternary Expression Parser γοΈ
- 440 π¨ K-th Smallest in Lexicographical Order
- 441 π Arranging Coins
- 442 π Find All Duplicates in an Array
- 443 π String Compression
- 444 π Sequence Reconstruction γοΈ
- 445 π Add Two Numbers II
- 446 π¨ Arithmetic Slices II - Subsequence
- 447 π Number of Boomerangs
- 448 π Find All Numbers Disappeared in an Array
- 449 π Serialize and Deserialize BST
- 450 π Delete Node in a BST
- 451 π Sort Characters By Frequency
- 452 π Minimum Number of Arrows to Burst Balloons
- 453 π Minimum Moves to Equal Array Elements
- 454 π 4Sum II
- 455 π Assign Cookies
- 456 π 132 Pattern
- 457 π Circular Array Loop
- 458 π Poor Pigs
- 459 π Repeated Substring Pattern
- 460 π¨ LFU Cache
- 461 π Hamming Distance .swift
- 462 π Minimum Moves to Equal Array Elements II
- 463 π Island Perimeter
- 464 π Can I Win
- 465 π¨ Optimal Account Balancing γοΈ
- 466 π¨ Count The Repetitions
- 467 π Unique Substrings in Wraparound String
- 468 π Validate IP Address
- 469 π Convex Polygon γοΈ
- 471 π¨ Encode String with Shortest Length γοΈ
- 472 π¨ Concatenated Words
- 473 π Matchsticks to Square
- 474 π Ones and Zeroes
- 475 π Heaters
- 476 π Number Complement .swift
- 477 π Total Hamming Distance
- 479 π Largest Palindrome Product
- 480 π¨ Sliding Window Median
- 481 π Magical String
- 482 π License Key Formatting
- 483 π¨ Smallest Good Base
- 484 π Find Permutation γοΈ
- 485 π Max Consecutive Ones
- 486 π Predict the Winner
- 487 π Max Consecutive Ones II γοΈ
- 488 π¨ Zuma Game
- 490 π The Maze γοΈ
- 491 π Increasing Subsequences
- 492 π Construct the Rectangle
- 493 π¨ Reverse Pairs
- 494 π Target Sum
- 495 π Teemo Attacking
- 496 π Next Greater Element I
- 498 π Diagonal Traverse
- 499 π¨ The Maze III γοΈ
- 500 π Keyboard Row
- 501 π Find Mode in Binary Search Tree
- 502 π¨ IPO
- 503 π Next Greater Element II
- 504 π Base 7 .swift
- 505 π The Maze II γοΈ
- 506 π Relative Ranks
- 507 π Perfect Number
- 508 π Most Frequent Subtree Sum
- 513 π Find Bottom Left Tree Value
- 514 π¨ Freedom Trail
- 515 π Find Largest Value in Each Tree Row
- 516 π Longest Palindromic Subsequence
- 517 π¨ Super Washing Machines
- 518 π Coin Change 2
- 520 π Detect Capital .swift
- 521 π Longest Uncommon Subsequence I
- 522 π Longest Uncommon Subsequence II
- 523 π Continuous Subarray Sum
- 524 π Longest Word in Dictionary through Deleting
- 525 π Contiguous Array
- 526 π Beautiful Arrangement
- 527 π¨ Word Abbreviation γοΈ
- 529 π Minesweeper
- 530 π Minimum Absolute Difference in BST
- 531 π Lonely Pixel I γοΈ
- 532 π K-diff Pairs in an Array
- 533 π Lonely Pixel II γοΈ
- 535 π Encode and Decode TinyURL
- 536 π Construct Binary Tree from String γοΈ
- 537 π Complex Number Multiplication
- 538 π Convert BST to Greater Tree
- 539 π Minimum Time Difference
- 540 π Single Element in a Sorted Array
- 541 π Reverse String II
- 542 π 01 Matrix
- 543 π Diameter of Binary Tree
- 544 π Output Contest Matches γοΈ
- 545 π Boundary of Binary Tree γοΈ
- 546 π¨ Remove Boxes
- 547 π Friend Circles
- 548 π Split Array with Equal Sum γοΈ
- 549 π Binary Tree Longest Consecutive Sequence II γοΈ
- 551 π Student Attendance Record I
- 552 π¨ Student Attendance Record II
- 553 π Optimal Division
- 554 π Brick Wall
- 555 π Split Concatenated Strings γοΈ
- 556 π Next Greater Element III
- 557 π Reverse Words in a String III
- 560 π Subarray Sum Equals K
- 561 π Array Partition I
- 562 π Longest Line of Consecutive One in Matrix γοΈ
- 563 π Binary Tree Tilt
- 564 π¨ Find the Closest Palindrome
- 565 π Array Nesting
- 566 π Reshape the Matrix
- 567 π Permutation in String
- 568 π¨ Maximum Vacation Days γοΈ
- 572 π Subtree of Another Tree
- 573 π Squirrel Simulation γοΈ
- 575 π Distribute Candies
- 576 π Out of Boundary Paths
- 581 π Shortest Unsorted Continuous Subarray
- 582 π Kill Process γοΈ
- 583 π Delete Operation for Two Strings
- 587 π¨ Erect the Fence
- 588 π¨ Design In-Memory File System γοΈ
- 591 π¨ Tag Validator
- 592 π Fraction Addition and Subtraction
- 593 π Valid Square
- 594 π Longest Harmonious Subsequence
- 598 π Range Addition II
- 599 π Minimum Index Sum of Two Lists
- 600 π¨ Non-negative Integers without Consecutive Ones
- 604 π Design Compressed String Iterator γοΈ
- 605 π Can Place Flowers
- 606 π Construct String from Binary Tree
- 609 π Find Duplicate File in System
- 611 π Valid Triangle Number
- 616 π Add Bold Tag in String γοΈ
- 617 π Merge Two Binary Trees
- 621 π Task Scheduler
- 623 π Add One Row to Tree
- 624 π Maximum Distance in Arrays γοΈ
- 625 π Minimum Factorization γοΈ
- 628 π Maximum Product of Three Numbers
- 629 π¨ K Inverse Pairs Array
- 630 π¨ Course Schedule III
- 631 π¨ Design Excel Sum Formula γοΈ
- 632 π¨ Smallest Range
- 633 π Sum of Square Numbers
- 634 π Find the Derangement of An Array γοΈ
- 635 π Design Log Storage System γοΈ
- 636 π Exclusive Time of Functions
- 637 π Average of Levels in Binary Tree
- 638 π Shopping Offers
- 639 π¨ Decode Ways II
- 640 π Solve the Equation
- 642 π¨ Design Search Autocomplete System γοΈ
- 643 π Maximum Average Subarray I
- 644 π¨ Maximum Average Subarray II γοΈ
- 645 π Set Mismatch
- 646 π Maximum Length of Pair Chain
- 647 π Palindromic Substrings
- 648 π Replace Words
- 649 π Dota2 Senate
- 650 π 2 Keys Keyboard
- 651 π 4 Keys Keyboard γοΈ
- 652 π Find Duplicate Subtrees
- 653 π Two Sum IV - Input is a BST
- 654 π Maximum Binary Tree
- 655 π Print Binary Tree
- 656 π¨ Coin Path γοΈ
- 657 π Judge Route Circle
- 658 π Find K Closest Elements
- 659 π Split Array into Consecutive Subsequences
- 660 π¨ Remove 9 γοΈ
- 661 π Image Smoother
- 662 π Maximum Width of Binary Tree
- 663 π Equal Tree Partition γοΈ
- 664 π¨ Strange Printer
- 665 π Non-decreasing Array
- 666 π Path Sum IV γοΈ
- 667 π Beautiful Arrangement II
- 668 π¨ Kth Smallest Number in Multiplication Table
- 669 π Trim a Binary Search Tree
- 670 π Maximum Swap
- 671 π Second Minimum Node In a Binary Tree
- 672 π Bulb Switcher II
- 673 π Number of Longest Increasing Subsequence
- 674 π Longest Continuous Increasing Subsequence
- 675 π¨ Cut Off Trees for Golf Event
- 676 π Implement Magic Dictionary
- 677 π Map Sum Pairs
- 678 π Valid Parenthesis String
- 679 π¨ 24 Game
- 680 π Valid Palindrome II
- 681 π Next Closest Time γοΈ
- 682 π Baseball Game
- 683 π¨ K Empty Slots γοΈ
- 684 π Redundant Connection
- 685 π¨ Redundant Connection II
- 686 π Repeated String Match
- 687 π Longest Univalue Path
- 688 π Knight Probability in Chessboard
- 689 π¨ Maximum Sum of 3 Non-Overlapping Subarrays
- 690 π Employee Importance
- 691 π¨ Stickers to Spell Word
- 692 π Top K Frequent Words
- 693 π Binary Number with Alternating Bits
- 694 π Number of Distinct Islands γοΈ
- 695 π Max Area of Island
- 696 π Count Binary Substrings
- 697 π Degree of an Array
- 698 π Partition to K Equal Sum Subsets
- 699 π¨ Falling Squares
- 711 π¨ Number of Distinct Islands II γοΈ
- 712 π Minimum ASCII Delete Sum for Two Strings
- 713 π Subarray Product Less Than K
- 714 π Best Time to Buy and Sell Stock with Transaction Fee
- 715 π¨ Range Module
- 716 π¨ Max Stack γοΈ
- 717 π 1-bit and 2-bit Characters
- 718 π Maximum Length of Repeated Subarray
- 719 π¨ Find K-th Smallest Pair Distance
- 720 π Longest Word in Dictionary
- 721 π Accounts Merge
- 722 π Remove Comments
- 723 π Candy Crush γοΈ
- 724 π Find Pivot Index
- 725 π Split Linked List in Parts
- 726 π¨ Number of Atoms
- 727 π¨ Minimum Window Subsequence γοΈ
- 728 π Self Dividing Numbers
- 729 π My Calendar I
- 730 π¨ Count Different Palindromic Subsequences
- 731 π My Calendar II
- 732 π¨ My Calendar III
- 733 π Flood Fill
- 734 π Sentence Similarity γοΈ
- 735 π Asteroid Collision
- 736 π¨ Parse Lisp Expression
- 737 π Sentence Similarity II γοΈ
- 738 π Monotone Increasing Digits
- 739 π Daily Temperatures
- 740 π Delete and Earn
- 741 π¨ Cherry Pickup
- 709 π To Lower Case
- 742 π Closest Leaf in a Binary Tree γοΈ
- 743 π Network Delay Time
- 744 π Find Smallest Letter Greater Than Target
- 745 π¨ Prefix and Suffix Search
- 746 π Min Cost Climbing Stairs
- 747 π Largest Number At Least Twice of Others
- 748 π Shortest Completing Word
- 749 π¨ Contain Virus
- 750 π Number Of Corner Rectangles γοΈ
- 751 π IP to CIDR γοΈ
- 752 π Open the Lock
- 753 π¨ Cracking the Safe
- 754 π Reach a Number
- 755 π Pour Water γοΈ
- 756 π Pyramid Transition Matrix
- 426 π Convert Binary Search Tree to Sorted Doubly Linked List γοΈ
- 757 π¨ Set Intersection Size At Least Two
- 758 π Bold Words in String γοΈ
- 759 π¨ Employee Free Time γοΈ
- 760 π Find Anagram Mappings γοΈ
- 761 π¨ Special Binary String
- 429 π N-ary Tree Level Order Traversal
- 428 π¨ Serialize and Deserialize N-ary Tree γοΈ
- 430 π Flatten a Multilevel Doubly Linked List
- 762 π Prime Number of Set Bits in Binary Representation
- 763 π Partition Labels
- 764 π Largest Plus Sign
- 765 π¨ Couples Holding Hands
- 431 π¨ Encode N-ary Tree to Binary Tree γοΈ
- 427 π Construct Quad Tree
- 558 π Quad Tree Intersection
- 559 π Maximum Depth of N-ary Tree
- 589 π N-ary Tree Preorder Traversal
- 590 π N-ary Tree Postorder Traversal
- 766 π Toeplitz Matrix
- 767 π Reorganize String
- 768 π¨ Max Chunks To Make Sorted II
- 769 π Max Chunks To Make Sorted
- 770 π¨ Basic Calculator IV
- 771 π Jewels and Stones
- 700 π Search in a Binary Search Tree
- 701 π Insert into a Binary Search Tree
- 772 π¨ Basic Calculator III γοΈ
- 702 π Search in a Sorted Array of Unknown Size γοΈ
- 773 π¨ Sliding Puzzle
- 774 π¨ Minimize Max Distance to Gas Station γοΈ
- 703 π Kth Largest Element in a Stream
- 775 π Global and Local Inversions
- 776 π Split BST γοΈ
- 704 π Binary Search
- 777 π Swap Adjacent in LR String
- 778 π¨ Swim in Rising Water
- 779 π K-th Symbol in Grammar
- 780 π¨ Reaching Points
- 781 π Rabbits in Forest
- 782 π¨ Transform to Chessboard
- 783 π Minimum Distance Between BST Nodes
- 784 π Letter Case Permutation
- 785 π Is Graph Bipartite?
- 786 π¨ K-th Smallest Prime Fraction
- 787 π Cheapest Flights Within K Stops
- 788 π Rotated Digits .swift
- 789 π Escape The Ghosts
- 790 π Domino and Tromino Tiling
- 791 π Custom Sort String
- 792 π Number of Matching Subsequences
- 793 π¨ Preimage Size of Factorial Zeroes Function
- 794 π Valid Tic-Tac-Toe State
- 795 π Number of Subarrays with Bounded Maximum
- 796 π Rotate String .swift
- 797 π All Paths From Source to Target
- 798 π¨ Smallest Rotation with Highest Score
- 799 π Champagne Tower
- 705 π Design HashSet
- 706 π Design HashMap
- 800 π Similar RGB Color γοΈ
- 801 π Minimum Swaps To Make Sequences Increasing
- 802 π Find Eventual Safe States
- 803 π¨ Bricks Falling When Hit
- 804 π Unique Morse Code Words .swift
- 805 π¨ Split Array With Same Average
- 806 π Number of Lines To Write String .swift
- 807 π Max Increase to Keep City Skyline
- 808 π Soup Servings
- 809 π Expressive Words
- 810 π¨ Chalkboard XOR Game
- 811 π Subdomain Visit Count .swift
- 812 π Largest Triangle Area
- 813 π Largest Sum of Averages
- 814 π Binary Tree Pruning
- 815 π¨ Bus Routes
- 816 π Ambiguous Coordinates
- 817 π Linked List Components
- 818 π¨ Race Car
- 819 π Most Common Word .swift
- 707 π Design Linked List
- 820 π Short Encoding of Words
- 821 π Shortest Distance to a Character
- 822 π Card Flipping Game
- 823 π Binary Trees With Factors
- 708 π Insert into a Cyclic Sorted List γοΈ
- 824 π Goat Latin .swift
- 825 π Friends Of Appropriate Ages
- 826 π Most Profit Assigning Work
- 827 π¨ Making A Large Island
- 828 π¨ Unique Letter String
- 829 π Consecutive Numbers Sum
- 830 π Positions of Large Groups .swift
- 831 π Masking Personal Information
- 641 π Design Circular Deque
- 622 π Design Circular Queue
- 832 π Flipping an Image .swift
- 833 π Find And Replace in String
- 834 π¨ Sum of Distances in Tree
- 835 π Image Overlap
- 489 π¨ Robot Room Cleaner γοΈ
- 836 π Rectangle Overlap .swift
- 837 π New 21 Game
- 838 π Push Dominoes
- 839 π¨ Similar String Groups
- 840 π Magic Squares In Grid .swift
- 841 π Keys and Rooms
- 842 π Split Array into Fibonacci Sequence
- 843 π¨ Guess the Word
- 844 π Backspace String Compare .swift
- 845 π Longest Mountain in Array
- 846 π Hand of Straights
- 847 π¨ Shortest Path Visiting All Nodes
- 848 π Shifting Letters
- 849 π Maximize Distance to Closest Person
- 850 π¨ Rectangle Area II
- 851 π Loud and Rich
- 852 π Peak Index in a Mountain Array .swift
- 853 π Car Fleet
- 854 π¨ K-Similar Strings
- 855 π Exam Room
- 856 π Score of Parentheses
- 857 π¨ Minimum Cost to Hire K Workers
- 858 π Mirror Reflection
- 859 π Buddy Strings .swift
- 860 π Lemonade Change .swift
- 861 π Score After Flipping Matrix
- 862 π¨ Shortest Subarray with Sum at Least K
- 863 π All Nodes Distance K in Binary Tree
- 710 π¨ Random Pick with Blacklist
- 864 π¨ Shortest Path to Get All Keys
- 865 π Smallest Subtree with all the Deepest Nodes
- 866 π Prime Palindrome
- 867 π Transpose Matrix
- 868 π Binary Gap .swift
- 869 π Reordered Power of 2
- 870 π Advantage Shuffle
- 871 π¨ Minimum Number of Refueling Stops
- 470 π Implement Rand10() Using Rand7()
This is a test-driven project. You may press β + u in Xcode to invoke the tests. Or just rake
in CLI.
Copyright (C) 2018 lexrus.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.