offcode 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -2
- package/data/index.json +1 -0
- package/data/problems/01-matrix.json +1 -0
- package/data/problems/1-bit-and-2-bit-characters.json +1 -0
- package/data/problems/132-pattern.json +1 -0
- package/data/problems/2-keys-keyboard.json +1 -0
- package/data/problems/24-game.json +1 -0
- package/data/problems/3sum-closest.json +1 -0
- package/data/problems/3sum-smaller.json +1 -0
- package/data/problems/3sum-with-multiplicity.json +1 -0
- package/data/problems/3sum.json +1 -0
- package/data/problems/4-keys-keyboard.json +1 -0
- package/data/problems/4sum-ii.json +1 -0
- package/data/problems/4sum.json +1 -0
- package/data/problems/accounts-merge.json +1 -0
- package/data/problems/add-binary.json +1 -0
- package/data/problems/add-bold-tag-in-string.json +1 -0
- package/data/problems/add-digits.json +1 -0
- package/data/problems/add-one-row-to-tree.json +1 -0
- package/data/problems/add-strings.json +1 -0
- package/data/problems/add-to-array-form-of-integer.json +1 -0
- package/data/problems/add-two-numbers-ii.json +1 -0
- package/data/problems/add-two-numbers.json +1 -0
- package/data/problems/additive-number.json +1 -0
- package/data/problems/advantage-shuffle.json +1 -0
- package/data/problems/alien-dictionary.json +1 -0
- package/data/problems/all-nodes-distance-k-in-binary-tree.json +1 -0
- package/data/problems/all-oone-data-structure.json +1 -0
- package/data/problems/all-paths-from-source-to-target.json +1 -0
- package/data/problems/all-possible-full-binary-trees.json +1 -0
- package/data/problems/ambiguous-coordinates.json +1 -0
- package/data/problems/android-unlock-patterns.json +1 -0
- package/data/problems/arithmetic-slices-ii-subsequence.json +1 -0
- package/data/problems/arithmetic-slices.json +1 -0
- package/data/problems/arranging-coins.json +1 -0
- package/data/problems/array-nesting.json +1 -0
- package/data/problems/array-of-doubled-pairs.json +1 -0
- package/data/problems/array-partition.json +1 -0
- package/data/problems/assign-cookies.json +1 -0
- package/data/problems/asteroid-collision.json +1 -0
- package/data/problems/available-captures-for-rook.json +1 -0
- package/data/problems/average-of-levels-in-binary-tree.json +1 -0
- package/data/problems/backspace-string-compare.json +1 -0
- package/data/problems/bag-of-tokens.json +1 -0
- package/data/problems/balanced-binary-tree.json +1 -0
- package/data/problems/base-7.json +1 -0
- package/data/problems/baseball-game.json +1 -0
- package/data/problems/basic-absolute-value.json +1 -0
- package/data/problems/basic-array-max.json +1 -0
- package/data/problems/basic-array-min.json +1 -0
- package/data/problems/basic-array-sum-rec.json +1 -0
- package/data/problems/basic-array-sum.json +1 -0
- package/data/problems/basic-average-floor.json +1 -0
- package/data/problems/basic-bubble-sort.json +1 -0
- package/data/problems/basic-calculator-ii.json +1 -0
- package/data/problems/basic-calculator-iii.json +1 -0
- package/data/problems/basic-calculator-iv.json +1 -0
- package/data/problems/basic-calculator.json +1 -0
- package/data/problems/basic-collatz-steps.json +1 -0
- package/data/problems/basic-contains-value.json +1 -0
- package/data/problems/basic-count-above.json +1 -0
- package/data/problems/basic-count-char.json +1 -0
- package/data/problems/basic-count-digits.json +1 -0
- package/data/problems/basic-count-evens.json +1 -0
- package/data/problems/basic-count-pairs.json +1 -0
- package/data/problems/basic-count-vowels.json +1 -0
- package/data/problems/basic-count-words.json +1 -0
- package/data/problems/basic-countdown.json +1 -0
- package/data/problems/basic-double-array.json +1 -0
- package/data/problems/basic-factorial-rec.json +1 -0
- package/data/problems/basic-factorial.json +1 -0
- package/data/problems/basic-fibonacci.json +1 -0
- package/data/problems/basic-find-index.json +1 -0
- package/data/problems/basic-gcd.json +1 -0
- package/data/problems/basic-grade-letter.json +1 -0
- package/data/problems/basic-has-duplicate.json +1 -0
- package/data/problems/basic-is-even.json +1 -0
- package/data/problems/basic-is-leap-year.json +1 -0
- package/data/problems/basic-is-sorted.json +1 -0
- package/data/problems/basic-max-frequency.json +1 -0
- package/data/problems/basic-max-of-three.json +1 -0
- package/data/problems/basic-max-of-two.json +1 -0
- package/data/problems/basic-palindrome-text.json +1 -0
- package/data/problems/basic-power-rec.json +1 -0
- package/data/problems/basic-power.json +1 -0
- package/data/problems/basic-repeat-string.json +1 -0
- package/data/problems/basic-reverse-array.json +1 -0
- package/data/problems/basic-reverse-number.json +1 -0
- package/data/problems/basic-reverse-text-rec.json +1 -0
- package/data/problems/basic-reverse-text.json +1 -0
- package/data/problems/basic-second-largest.json +1 -0
- package/data/problems/basic-sort-two.json +1 -0
- package/data/problems/basic-staircase.json +1 -0
- package/data/problems/basic-string-length.json +1 -0
- package/data/problems/basic-sum-1-to-n.json +1 -0
- package/data/problems/basic-sum-digits-rec.json +1 -0
- package/data/problems/basic-sum-multiples.json +1 -0
- package/data/problems/basic-sum-of-digits.json +1 -0
- package/data/problems/basic-temperature-advice.json +1 -0
- package/data/problems/basic-to-upper.json +1 -0
- package/data/problems/basic-triangle-sum.json +1 -0
- package/data/problems/battleships-in-a-board.json +1 -0
- package/data/problems/beautiful-arrangement-ii.json +1 -0
- package/data/problems/beautiful-arrangement.json +1 -0
- package/data/problems/beautiful-array.json +1 -0
- package/data/problems/best-meeting-point.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-ii.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-iii.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-iv.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-with-cooldown.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-with-transaction-fee.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock.json +1 -0
- package/data/problems/binary-gap.json +1 -0
- package/data/problems/binary-number-with-alternating-bits.json +1 -0
- package/data/problems/binary-search-tree-iterator.json +1 -0
- package/data/problems/binary-search.json +1 -0
- package/data/problems/binary-subarrays-with-sum.json +1 -0
- package/data/problems/binary-tree-cameras.json +1 -0
- package/data/problems/binary-tree-inorder-traversal.json +1 -0
- package/data/problems/binary-tree-level-order-traversal-ii.json +1 -0
- package/data/problems/binary-tree-level-order-traversal.json +1 -0
- package/data/problems/binary-tree-longest-consecutive-sequence-ii.json +1 -0
- package/data/problems/binary-tree-longest-consecutive-sequence.json +1 -0
- package/data/problems/binary-tree-maximum-path-sum.json +1 -0
- package/data/problems/binary-tree-paths.json +1 -0
- package/data/problems/binary-tree-postorder-traversal.json +1 -0
- package/data/problems/binary-tree-preorder-traversal.json +1 -0
- package/data/problems/binary-tree-pruning.json +1 -0
- package/data/problems/binary-tree-right-side-view.json +1 -0
- package/data/problems/binary-tree-tilt.json +1 -0
- package/data/problems/binary-tree-upside-down.json +1 -0
- package/data/problems/binary-tree-vertical-order-traversal.json +1 -0
- package/data/problems/binary-tree-zigzag-level-order-traversal.json +1 -0
- package/data/problems/binary-trees-with-factors.json +1 -0
- package/data/problems/binary-watch.json +1 -0
- package/data/problems/bitwise-and-of-numbers-range.json +1 -0
- package/data/problems/bitwise-ors-of-subarrays.json +1 -0
- package/data/problems/boats-to-save-people.json +1 -0
- package/data/problems/bold-words-in-string.json +1 -0
- package/data/problems/bomb-enemy.json +1 -0
- package/data/problems/boundary-of-binary-tree.json +1 -0
- package/data/problems/brick-wall.json +1 -0
- package/data/problems/bricks-falling-when-hit.json +1 -0
- package/data/problems/broken-calculator.json +1 -0
- package/data/problems/buddy-strings.json +1 -0
- package/data/problems/build-a-matrix-with-conditions.json +1 -0
- package/data/problems/bulb-switcher-ii.json +1 -0
- package/data/problems/bulb-switcher.json +1 -0
- package/data/problems/bulls-and-cows.json +1 -0
- package/data/problems/burst-balloons.json +1 -0
- package/data/problems/bus-routes.json +1 -0
- package/data/problems/can-i-win.json +1 -0
- package/data/problems/can-place-flowers.json +1 -0
- package/data/problems/candy-crush.json +1 -0
- package/data/problems/candy.json +1 -0
- package/data/problems/capacity-to-ship-packages-within-d-days.json +1 -0
- package/data/problems/car-fleet.json +1 -0
- package/data/problems/car-pooling.json +1 -0
- package/data/problems/card-flipping-game.json +1 -0
- package/data/problems/cat-and-mouse.json +1 -0
- package/data/problems/chalkboard-xor-game.json +1 -0
- package/data/problems/champagne-tower.json +1 -0
- package/data/problems/cheapest-flights-within-k-stops.json +1 -0
- package/data/problems/check-completeness-of-a-binary-tree.json +1 -0
- package/data/problems/cherry-pickup.json +1 -0
- package/data/problems/circular-array-loop.json +1 -0
- package/data/problems/climbing-stairs.json +1 -0
- package/data/problems/clone-graph.json +1 -0
- package/data/problems/closest-binary-search-tree-value-ii.json +1 -0
- package/data/problems/closest-binary-search-tree-value.json +1 -0
- package/data/problems/closest-leaf-in-a-binary-tree.json +1 -0
- package/data/problems/coin-change-ii.json +1 -0
- package/data/problems/coin-change.json +1 -0
- package/data/problems/coin-path.json +1 -0
- package/data/problems/combination-sum-ii.json +1 -0
- package/data/problems/combination-sum-iii.json +1 -0
- package/data/problems/combination-sum-iv.json +1 -0
- package/data/problems/combination-sum.json +1 -0
- package/data/problems/combinations.json +1 -0
- package/data/problems/compare-version-numbers.json +1 -0
- package/data/problems/complete-binary-tree-inserter.json +1 -0
- package/data/problems/complex-number-multiplication.json +1 -0
- package/data/problems/concatenated-words.json +1 -0
- package/data/problems/concatenation-of-array.json +1 -0
- package/data/problems/consecutive-numbers-sum.json +1 -0
- package/data/problems/construct-binary-tree-from-inorder-and-postorder-traversal.json +1 -0
- package/data/problems/construct-binary-tree-from-preorder-and-inorder-traversal.json +1 -0
- package/data/problems/construct-binary-tree-from-preorder-and-postorder-traversal.json +1 -0
- package/data/problems/construct-binary-tree-from-string.json +1 -0
- package/data/problems/construct-quad-tree.json +1 -0
- package/data/problems/construct-string-from-binary-tree.json +1 -0
- package/data/problems/construct-the-rectangle.json +1 -0
- package/data/problems/contain-virus.json +1 -0
- package/data/problems/container-with-most-water.json +1 -0
- package/data/problems/contains-duplicate-ii.json +1 -0
- package/data/problems/contains-duplicate-iii.json +1 -0
- package/data/problems/contains-duplicate.json +1 -0
- package/data/problems/contiguous-array.json +1 -0
- package/data/problems/continuous-subarray-sum.json +1 -0
- package/data/problems/convert-a-number-to-hexadecimal.json +1 -0
- package/data/problems/convert-binary-search-tree-to-sorted-doubly-linked-list.json +1 -0
- package/data/problems/convert-bst-to-greater-tree.json +1 -0
- package/data/problems/convert-sorted-array-to-binary-search-tree.json +1 -0
- package/data/problems/convert-sorted-list-to-binary-search-tree.json +1 -0
- package/data/problems/convex-polygon.json +1 -0
- package/data/problems/copy-list-with-random-pointer.json +1 -0
- package/data/problems/count-and-say.json +1 -0
- package/data/problems/count-binary-substrings.json +1 -0
- package/data/problems/count-complete-tree-nodes.json +1 -0
- package/data/problems/count-different-palindromic-subsequences.json +1 -0
- package/data/problems/count-good-nodes-in-binary-tree.json +1 -0
- package/data/problems/count-numbers-with-unique-digits.json +1 -0
- package/data/problems/count-of-range-sum.json +1 -0
- package/data/problems/count-of-smaller-numbers-after-self.json +1 -0
- package/data/problems/count-primes.json +1 -0
- package/data/problems/count-the-repetitions.json +1 -0
- package/data/problems/count-unique-characters-of-all-substrings-of-a-given-string.json +1 -0
- package/data/problems/count-univalue-subtrees.json +1 -0
- package/data/problems/counting-bits.json +1 -0
- package/data/problems/couples-holding-hands.json +1 -0
- package/data/problems/course-schedule-ii.json +1 -0
- package/data/problems/course-schedule-iii.json +1 -0
- package/data/problems/course-schedule-iv.json +1 -0
- package/data/problems/course-schedule.json +1 -0
- package/data/problems/cousins-in-binary-tree.json +1 -0
- package/data/problems/cracking-the-safe.json +1 -0
- package/data/problems/create-maximum-number.json +1 -0
- package/data/problems/custom-sort-string.json +1 -0
- package/data/problems/cut-off-trees-for-golf-event.json +1 -0
- package/data/problems/daily-temperatures.json +1 -0
- package/data/problems/data-stream-as-disjoint-intervals.json +1 -0
- package/data/problems/decode-string.json +1 -0
- package/data/problems/decode-ways-ii.json +1 -0
- package/data/problems/decode-ways.json +1 -0
- package/data/problems/decoded-string-at-index.json +1 -0
- package/data/problems/degree-of-an-array.json +1 -0
- package/data/problems/delete-and-earn.json +1 -0
- package/data/problems/delete-columns-to-make-sorted-ii.json +1 -0
- package/data/problems/delete-columns-to-make-sorted-iii.json +1 -0
- package/data/problems/delete-columns-to-make-sorted.json +1 -0
- package/data/problems/delete-leaves-with-a-given-value.json +1 -0
- package/data/problems/delete-node-in-a-bst.json +1 -0
- package/data/problems/delete-node-in-a-linked-list.json +1 -0
- package/data/problems/delete-operation-for-two-strings.json +1 -0
- package/data/problems/design-add-and-search-words-data-structure.json +1 -0
- package/data/problems/design-circular-deque.json +1 -0
- package/data/problems/design-circular-queue.json +1 -0
- package/data/problems/design-compressed-string-iterator.json +1 -0
- package/data/problems/design-excel-sum-formula.json +1 -0
- package/data/problems/design-hashmap.json +1 -0
- package/data/problems/design-hashset.json +1 -0
- package/data/problems/design-hit-counter.json +1 -0
- package/data/problems/design-in-memory-file-system.json +1 -0
- package/data/problems/design-linked-list.json +1 -0
- package/data/problems/design-log-storage-system.json +1 -0
- package/data/problems/design-phone-directory.json +1 -0
- package/data/problems/design-search-autocomplete-system.json +1 -0
- package/data/problems/design-snake-game.json +1 -0
- package/data/problems/design-tic-tac-toe.json +1 -0
- package/data/problems/design-twitter.json +1 -0
- package/data/problems/detect-capital.json +1 -0
- package/data/problems/detect-squares.json +1 -0
- package/data/problems/di-string-match.json +1 -0
- package/data/problems/diagonal-traverse.json +1 -0
- package/data/problems/diameter-of-binary-tree.json +1 -0
- package/data/problems/different-ways-to-add-parentheses.json +1 -0
- package/data/problems/distinct-subsequences-ii.json +1 -0
- package/data/problems/distinct-subsequences.json +1 -0
- package/data/problems/distribute-candies.json +1 -0
- package/data/problems/distribute-coins-in-binary-tree.json +1 -0
- package/data/problems/divide-two-integers.json +1 -0
- package/data/problems/domino-and-tromino-tiling.json +1 -0
- package/data/problems/dota2-senate.json +1 -0
- package/data/problems/dungeon-game.json +1 -0
- package/data/problems/edit-distance.json +1 -0
- package/data/problems/elimination-game.json +1 -0
- package/data/problems/employee-free-time.json +1 -0
- package/data/problems/employee-importance.json +1 -0
- package/data/problems/encode-and-decode-strings.json +1 -0
- package/data/problems/encode-and-decode-tinyurl.json +1 -0
- package/data/problems/encode-n-ary-tree-to-binary-tree.json +1 -0
- package/data/problems/encode-string-with-shortest-length.json +1 -0
- package/data/problems/equal-rational-numbers.json +1 -0
- package/data/problems/equal-tree-partition.json +1 -0
- package/data/problems/erect-the-fence.json +1 -0
- package/data/problems/escape-the-ghosts.json +1 -0
- package/data/problems/evaluate-division.json +1 -0
- package/data/problems/evaluate-reverse-polish-notation.json +1 -0
- package/data/problems/exam-room.json +1 -0
- package/data/problems/excel-sheet-column-number.json +1 -0
- package/data/problems/excel-sheet-column-title.json +1 -0
- package/data/problems/exclusive-time-of-functions.json +1 -0
- package/data/problems/expression-add-operators.json +1 -0
- package/data/problems/expressive-words.json +1 -0
- package/data/problems/extra-characters-in-a-string.json +1 -0
- package/data/problems/factor-combinations.json +1 -0
- package/data/problems/factorial-trailing-zeroes.json +1 -0
- package/data/problems/fair-candy-swap.json +1 -0
- package/data/problems/falling-squares.json +1 -0
- package/data/problems/fibonacci-number.json +1 -0
- package/data/problems/find-all-anagrams-in-a-string.json +1 -0
- package/data/problems/find-all-duplicates-in-an-array.json +1 -0
- package/data/problems/find-all-numbers-disappeared-in-an-array.json +1 -0
- package/data/problems/find-anagram-mappings.json +1 -0
- package/data/problems/find-and-replace-in-string.json +1 -0
- package/data/problems/find-and-replace-pattern.json +1 -0
- package/data/problems/find-bottom-left-tree-value.json +1 -0
- package/data/problems/find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree.json +1 -0
- package/data/problems/find-duplicate-file-in-system.json +1 -0
- package/data/problems/find-duplicate-subtrees.json +1 -0
- package/data/problems/find-eventual-safe-states.json +1 -0
- package/data/problems/find-first-and-last-position-of-element-in-sorted-array.json +1 -0
- package/data/problems/find-in-mountain-array.json +1 -0
- package/data/problems/find-k-closest-elements.json +1 -0
- package/data/problems/find-k-pairs-with-smallest-sums.json +1 -0
- package/data/problems/find-k-th-smallest-pair-distance.json +1 -0
- package/data/problems/find-largest-value-in-each-tree-row.json +1 -0
- package/data/problems/find-leaves-of-binary-tree.json +1 -0
- package/data/problems/find-median-from-data-stream.json +1 -0
- package/data/problems/find-minimum-in-rotated-sorted-array-ii.json +1 -0
- package/data/problems/find-minimum-in-rotated-sorted-array.json +1 -0
- package/data/problems/find-mode-in-binary-search-tree.json +1 -0
- package/data/problems/find-peak-element.json +1 -0
- package/data/problems/find-permutation.json +1 -0
- package/data/problems/find-pivot-index.json +1 -0
- package/data/problems/find-right-interval.json +1 -0
- package/data/problems/find-smallest-letter-greater-than-target.json +1 -0
- package/data/problems/find-the-celebrity.json +1 -0
- package/data/problems/find-the-closest-palindrome.json +1 -0
- package/data/problems/find-the-derangement-of-an-array.json +1 -0
- package/data/problems/find-the-difference.json +1 -0
- package/data/problems/find-the-duplicate-number.json +1 -0
- package/data/problems/find-the-index-of-the-first-occurrence-in-a-string.json +1 -0
- package/data/problems/find-the-shortest-superstring.json +1 -0
- package/data/problems/find-the-town-judge.json +1 -0
- package/data/problems/first-bad-version.json +1 -0
- package/data/problems/first-missing-positive.json +1 -0
- package/data/problems/first-unique-character-in-a-string.json +1 -0
- package/data/problems/fizz-buzz.json +1 -0
- package/data/problems/flatten-2d-vector.json +1 -0
- package/data/problems/flatten-a-multilevel-doubly-linked-list.json +1 -0
- package/data/problems/flatten-binary-tree-to-linked-list.json +1 -0
- package/data/problems/flatten-nested-list-iterator.json +1 -0
- package/data/problems/flip-binary-tree-to-match-preorder-traversal.json +1 -0
- package/data/problems/flip-equivalent-binary-trees.json +1 -0
- package/data/problems/flip-game-ii.json +1 -0
- package/data/problems/flip-game.json +1 -0
- package/data/problems/flip-string-to-monotone-increasing.json +1 -0
- package/data/problems/flipping-an-image.json +1 -0
- package/data/problems/flood-fill.json +1 -0
- package/data/problems/fraction-addition-and-subtraction.json +1 -0
- package/data/problems/fraction-to-recurring-decimal.json +1 -0
- package/data/problems/freedom-trail.json +1 -0
- package/data/problems/friends-of-appropriate-ages.json +1 -0
- package/data/problems/frog-jump.json +1 -0
- package/data/problems/fruit-into-baskets.json +1 -0
- package/data/problems/game-of-life.json +1 -0
- package/data/problems/gas-station.json +1 -0
- package/data/problems/generalized-abbreviation.json +1 -0
- package/data/problems/generate-parentheses.json +1 -0
- package/data/problems/generate-random-point-in-a-circle.json +1 -0
- package/data/problems/global-and-local-inversions.json +1 -0
- package/data/problems/goat-latin.json +1 -0
- package/data/problems/graph-valid-tree.json +1 -0
- package/data/problems/gray-code.json +1 -0
- package/data/problems/greatest-common-divisor-of-strings.json +1 -0
- package/data/problems/greatest-common-divisor-traversal.json +1 -0
- package/data/problems/group-anagrams.json +1 -0
- package/data/problems/group-shifted-strings.json +1 -0
- package/data/problems/groups-of-special-equivalent-strings.json +1 -0
- package/data/problems/guess-number-higher-or-lower-ii.json +1 -0
- package/data/problems/guess-number-higher-or-lower.json +1 -0
- package/data/problems/guess-the-word.json +1 -0
- package/data/problems/h-index-ii.json +1 -0
- package/data/problems/h-index.json +1 -0
- package/data/problems/hamming-distance.json +1 -0
- package/data/problems/hand-of-straights.json +1 -0
- package/data/problems/happy-number.json +1 -0
- package/data/problems/heaters.json +1 -0
- package/data/problems/house-robber-ii.json +1 -0
- package/data/problems/house-robber-iii.json +1 -0
- package/data/problems/house-robber.json +1 -0
- package/data/problems/image-overlap.json +1 -0
- package/data/problems/image-smoother.json +1 -0
- package/data/problems/implement-magic-dictionary.json +1 -0
- package/data/problems/implement-queue-using-stacks.json +1 -0
- package/data/problems/implement-rand10-using-rand7.json +1 -0
- package/data/problems/implement-stack-using-queues.json +1 -0
- package/data/problems/implement-trie-prefix-tree.json +1 -0
- package/data/problems/increasing-order-search-tree.json +1 -0
- package/data/problems/increasing-triplet-subsequence.json +1 -0
- package/data/problems/inorder-successor-in-bst-ii.json +1 -0
- package/data/problems/inorder-successor-in-bst.json +1 -0
- package/data/problems/insert-delete-getrandom-o1-duplicates-allowed.json +1 -0
- package/data/problems/insert-delete-getrandom-o1.json +1 -0
- package/data/problems/insert-greatest-common-divisors-in-linked-list.json +1 -0
- package/data/problems/insert-interval.json +1 -0
- package/data/problems/insert-into-a-binary-search-tree.json +1 -0
- package/data/problems/insert-into-a-sorted-circular-linked-list.json +1 -0
- package/data/problems/insertion-sort-list.json +1 -0
- package/data/problems/integer-break.json +1 -0
- package/data/problems/integer-replacement.json +1 -0
- package/data/problems/integer-to-english-words.json +1 -0
- package/data/problems/integer-to-roman.json +1 -0
- package/data/problems/interleaving-string.json +1 -0
- package/data/problems/intersection-of-two-arrays-ii.json +1 -0
- package/data/problems/intersection-of-two-arrays.json +1 -0
- package/data/problems/intersection-of-two-linked-lists.json +1 -0
- package/data/problems/interval-list-intersections.json +1 -0
- package/data/problems/invert-binary-tree.json +1 -0
- package/data/problems/ip-to-cidr.json +1 -0
- package/data/problems/ipo.json +1 -0
- package/data/problems/is-graph-bipartite.json +1 -0
- package/data/problems/is-subsequence.json +1 -0
- package/data/problems/island-perimeter.json +1 -0
- package/data/problems/isomorphic-strings.json +1 -0
- package/data/problems/jewels-and-stones.json +1 -0
- package/data/problems/jump-game-ii.json +1 -0
- package/data/problems/jump-game-vii.json +1 -0
- package/data/problems/jump-game.json +1 -0
- package/data/problems/k-closest-points-to-origin.json +1 -0
- package/data/problems/k-diff-pairs-in-an-array.json +1 -0
- package/data/problems/k-empty-slots.json +1 -0
- package/data/problems/k-inverse-pairs-array.json +1 -0
- package/data/problems/k-similar-strings.json +1 -0
- package/data/problems/k-th-smallest-in-lexicographical-order.json +1 -0
- package/data/problems/k-th-smallest-prime-fraction.json +1 -0
- package/data/problems/k-th-symbol-in-grammar.json +1 -0
- package/data/problems/keyboard-row.json +1 -0
- package/data/problems/keys-and-rooms.json +1 -0
- package/data/problems/kill-process.json +1 -0
- package/data/problems/knight-dialer.json +1 -0
- package/data/problems/knight-probability-in-chessboard.json +1 -0
- package/data/problems/koko-eating-bananas.json +1 -0
- package/data/problems/kth-largest-element-in-a-stream.json +1 -0
- package/data/problems/kth-largest-element-in-an-array.json +1 -0
- package/data/problems/kth-smallest-element-in-a-bst.json +1 -0
- package/data/problems/kth-smallest-element-in-a-sorted-matrix.json +1 -0
- package/data/problems/kth-smallest-number-in-multiplication-table.json +1 -0
- package/data/problems/largest-bst-subtree.json +1 -0
- package/data/problems/largest-component-size-by-common-factor.json +1 -0
- package/data/problems/largest-divisible-subset.json +1 -0
- package/data/problems/largest-number-at-least-twice-of-others.json +1 -0
- package/data/problems/largest-number.json +1 -0
- package/data/problems/largest-palindrome-product.json +1 -0
- package/data/problems/largest-perimeter-triangle.json +1 -0
- package/data/problems/largest-plus-sign.json +1 -0
- package/data/problems/largest-rectangle-in-histogram.json +1 -0
- package/data/problems/largest-sum-of-averages.json +1 -0
- package/data/problems/largest-time-for-given-digits.json +1 -0
- package/data/problems/largest-triangle-area.json +1 -0
- package/data/problems/last-stone-weight-ii.json +1 -0
- package/data/problems/last-stone-weight.json +1 -0
- package/data/problems/leaf-similar-trees.json +1 -0
- package/data/problems/least-operators-to-express-number.json +1 -0
- package/data/problems/lemonade-change.json +1 -0
- package/data/problems/length-of-last-word.json +1 -0
- package/data/problems/length-of-longest-fibonacci-subsequence.json +1 -0
- package/data/problems/letter-case-permutation.json +1 -0
- package/data/problems/letter-combinations-of-a-phone-number.json +1 -0
- package/data/problems/lexicographical-numbers.json +1 -0
- package/data/problems/lfu-cache.json +1 -0
- package/data/problems/license-key-formatting.json +1 -0
- package/data/problems/line-reflection.json +1 -0
- package/data/problems/linked-list-components.json +1 -0
- package/data/problems/linked-list-cycle-ii.json +1 -0
- package/data/problems/linked-list-cycle.json +1 -0
- package/data/problems/linked-list-random-node.json +1 -0
- package/data/problems/logger-rate-limiter.json +1 -0
- package/data/problems/logical-or-of-two-binary-grids-represented-as-quad-trees.json +1 -0
- package/data/problems/lonely-pixel-i.json +1 -0
- package/data/problems/lonely-pixel-ii.json +1 -0
- package/data/problems/long-pressed-name.json +1 -0
- package/data/problems/longest-absolute-file-path.json +1 -0
- package/data/problems/longest-common-prefix.json +1 -0
- package/data/problems/longest-common-subsequence.json +1 -0
- package/data/problems/longest-consecutive-sequence.json +1 -0
- package/data/problems/longest-continuous-increasing-subsequence.json +1 -0
- package/data/problems/longest-happy-string.json +1 -0
- package/data/problems/longest-harmonious-subsequence.json +1 -0
- package/data/problems/longest-increasing-path-in-a-matrix.json +1 -0
- package/data/problems/longest-increasing-subsequence.json +1 -0
- package/data/problems/longest-line-of-consecutive-one-in-matrix.json +1 -0
- package/data/problems/longest-mountain-in-array.json +1 -0
- package/data/problems/longest-palindrome.json +1 -0
- package/data/problems/longest-palindromic-subsequence.json +1 -0
- package/data/problems/longest-palindromic-substring.json +1 -0
- package/data/problems/longest-repeating-character-replacement.json +1 -0
- package/data/problems/longest-substring-with-at-least-k-repeating-characters.json +1 -0
- package/data/problems/longest-substring-with-at-most-k-distinct-characters.json +1 -0
- package/data/problems/longest-substring-with-at-most-two-distinct-characters.json +1 -0
- package/data/problems/longest-substring-without-repeating-characters.json +1 -0
- package/data/problems/longest-turbulent-subarray.json +1 -0
- package/data/problems/longest-uncommon-subsequence-i.json +1 -0
- package/data/problems/longest-uncommon-subsequence-ii.json +1 -0
- package/data/problems/longest-univalue-path.json +1 -0
- package/data/problems/longest-valid-parentheses.json +1 -0
- package/data/problems/longest-word-in-dictionary-through-deleting.json +1 -0
- package/data/problems/longest-word-in-dictionary.json +1 -0
- package/data/problems/loud-and-rich.json +1 -0
- package/data/problems/lowest-common-ancestor-of-a-binary-search-tree.json +1 -0
- package/data/problems/lowest-common-ancestor-of-a-binary-tree.json +1 -0
- package/data/problems/lru-cache.json +1 -0
- package/data/problems/magic-squares-in-grid.json +1 -0
- package/data/problems/magical-string.json +1 -0
- package/data/problems/majority-element-ii.json +1 -0
- package/data/problems/majority-element.json +1 -0
- package/data/problems/making-a-large-island.json +1 -0
- package/data/problems/map-sum-pairs.json +1 -0
- package/data/problems/masking-personal-information.json +1 -0
- package/data/problems/matchsticks-to-square.json +1 -0
- package/data/problems/max-area-of-island.json +1 -0
- package/data/problems/max-chunks-to-make-sorted-ii.json +1 -0
- package/data/problems/max-chunks-to-make-sorted.json +1 -0
- package/data/problems/max-consecutive-ones-ii.json +1 -0
- package/data/problems/max-consecutive-ones.json +1 -0
- package/data/problems/max-increase-to-keep-city-skyline.json +1 -0
- package/data/problems/max-points-on-a-line.json +1 -0
- package/data/problems/max-stack.json +1 -0
- package/data/problems/max-sum-of-rectangle-no-larger-than-k.json +1 -0
- package/data/problems/maximal-rectangle.json +1 -0
- package/data/problems/maximal-square.json +1 -0
- package/data/problems/maximize-distance-to-closest-person.json +1 -0
- package/data/problems/maximum-average-subarray-i.json +1 -0
- package/data/problems/maximum-average-subarray-ii.json +1 -0
- package/data/problems/maximum-binary-tree-ii.json +1 -0
- package/data/problems/maximum-binary-tree.json +1 -0
- package/data/problems/maximum-depth-of-binary-tree.json +1 -0
- package/data/problems/maximum-depth-of-n-ary-tree.json +1 -0
- package/data/problems/maximum-distance-in-arrays.json +1 -0
- package/data/problems/maximum-frequency-stack.json +1 -0
- package/data/problems/maximum-gap.json +1 -0
- package/data/problems/maximum-length-of-pair-chain.json +1 -0
- package/data/problems/maximum-length-of-repeated-subarray.json +1 -0
- package/data/problems/maximum-product-of-three-numbers.json +1 -0
- package/data/problems/maximum-product-of-word-lengths.json +1 -0
- package/data/problems/maximum-product-subarray.json +1 -0
- package/data/problems/maximum-size-subarray-sum-equals-k.json +1 -0
- package/data/problems/maximum-subarray.json +1 -0
- package/data/problems/maximum-sum-circular-subarray.json +1 -0
- package/data/problems/maximum-sum-of-3-non-overlapping-subarrays.json +1 -0
- package/data/problems/maximum-swap.json +1 -0
- package/data/problems/maximum-vacation-days.json +1 -0
- package/data/problems/maximum-width-of-binary-tree.json +1 -0
- package/data/problems/maximum-width-ramp.json +1 -0
- package/data/problems/maximum-xor-of-two-numbers-in-an-array.json +1 -0
- package/data/problems/median-of-two-sorted-arrays.json +1 -0
- package/data/problems/meeting-rooms-ii.json +1 -0
- package/data/problems/meeting-rooms-iii.json +1 -0
- package/data/problems/meeting-rooms.json +1 -0
- package/data/problems/merge-intervals.json +1 -0
- package/data/problems/merge-k-sorted-lists.json +1 -0
- package/data/problems/merge-sorted-array.json +1 -0
- package/data/problems/merge-strings-alternately.json +1 -0
- package/data/problems/merge-triplets-to-form-target-triplet.json +1 -0
- package/data/problems/merge-two-binary-trees.json +1 -0
- package/data/problems/merge-two-sorted-lists.json +1 -0
- package/data/problems/middle-of-the-linked-list.json +1 -0
- package/data/problems/min-cost-climbing-stairs.json +1 -0
- package/data/problems/min-cost-to-connect-all-points.json +1 -0
- package/data/problems/min-stack.json +1 -0
- package/data/problems/minesweeper.json +1 -0
- package/data/problems/mini-parser.json +1 -0
- package/data/problems/minimize-malware-spread-ii.json +1 -0
- package/data/problems/minimize-malware-spread.json +1 -0
- package/data/problems/minimize-max-distance-to-gas-station.json +1 -0
- package/data/problems/minimum-absolute-difference-in-bst.json +1 -0
- package/data/problems/minimum-add-to-make-parentheses-valid.json +1 -0
- package/data/problems/minimum-area-rectangle-ii.json +1 -0
- package/data/problems/minimum-area-rectangle.json +1 -0
- package/data/problems/minimum-array-end.json +1 -0
- package/data/problems/minimum-ascii-delete-sum-for-two-strings.json +1 -0
- package/data/problems/minimum-cost-for-tickets.json +1 -0
- package/data/problems/minimum-cost-to-hire-k-workers.json +1 -0
- package/data/problems/minimum-cost-to-merge-stones.json +1 -0
- package/data/problems/minimum-depth-of-binary-tree.json +1 -0
- package/data/problems/minimum-distance-between-bst-nodes.json +1 -0
- package/data/problems/minimum-factorization.json +1 -0
- package/data/problems/minimum-falling-path-sum.json +1 -0
- package/data/problems/minimum-genetic-mutation.json +1 -0
- package/data/problems/minimum-height-trees.json +1 -0
- package/data/problems/minimum-increment-to-make-array-unique.json +1 -0
- package/data/problems/minimum-index-sum-of-two-lists.json +1 -0
- package/data/problems/minimum-interval-to-include-each-query.json +1 -0
- package/data/problems/minimum-moves-to-equal-array-elements-ii.json +1 -0
- package/data/problems/minimum-moves-to-equal-array-elements.json +1 -0
- package/data/problems/minimum-number-of-arrows-to-burst-balloons.json +1 -0
- package/data/problems/minimum-number-of-k-consecutive-bit-flips.json +1 -0
- package/data/problems/minimum-number-of-refueling-stops.json +1 -0
- package/data/problems/minimum-path-sum.json +1 -0
- package/data/problems/minimum-size-subarray-sum.json +1 -0
- package/data/problems/minimum-swaps-to-make-sequences-increasing.json +1 -0
- package/data/problems/minimum-time-difference.json +1 -0
- package/data/problems/minimum-unique-word-abbreviation.json +1 -0
- package/data/problems/minimum-window-subsequence.json +1 -0
- package/data/problems/minimum-window-substring.json +1 -0
- package/data/problems/mirror-reflection.json +1 -0
- package/data/problems/missing-number.json +1 -0
- package/data/problems/missing-ranges.json +1 -0
- package/data/problems/monotone-increasing-digits.json +1 -0
- package/data/problems/monotonic-array.json +1 -0
- package/data/problems/most-common-word.json +1 -0
- package/data/problems/most-frequent-subtree-sum.json +1 -0
- package/data/problems/most-profit-assigning-work.json +1 -0
- package/data/problems/most-stones-removed-with-same-row-or-column.json +1 -0
- package/data/problems/move-zeroes.json +1 -0
- package/data/problems/moving-average-from-data-stream.json +1 -0
- package/data/problems/multiply-strings.json +1 -0
- package/data/problems/my-calendar-i.json +1 -0
- package/data/problems/my-calendar-ii.json +1 -0
- package/data/problems/my-calendar-iii.json +1 -0
- package/data/problems/n-ary-tree-level-order-traversal.json +1 -0
- package/data/problems/n-ary-tree-postorder-traversal.json +1 -0
- package/data/problems/n-ary-tree-preorder-traversal.json +1 -0
- package/data/problems/n-queens-ii.json +1 -0
- package/data/problems/n-queens.json +1 -0
- package/data/problems/n-repeated-element-in-size-2n-array.json +1 -0
- package/data/problems/n-th-tribonacci-number.json +1 -0
- package/data/problems/nested-list-weight-sum-ii.json +1 -0
- package/data/problems/nested-list-weight-sum.json +1 -0
- package/data/problems/network-delay-time.json +1 -0
- package/data/problems/new-21-game.json +1 -0
- package/data/problems/next-closest-time.json +1 -0
- package/data/problems/next-greater-element-i.json +1 -0
- package/data/problems/next-greater-element-ii.json +1 -0
- package/data/problems/next-greater-element-iii.json +1 -0
- package/data/problems/next-permutation.json +1 -0
- package/data/problems/nim-game.json +1 -0
- package/data/problems/non-decreasing-array.json +1 -0
- package/data/problems/non-decreasing-subsequences.json +1 -0
- package/data/problems/non-negative-integers-without-consecutive-ones.json +1 -0
- package/data/problems/non-overlapping-intervals.json +1 -0
- package/data/problems/nth-digit.json +1 -0
- package/data/problems/nth-magical-number.json +1 -0
- package/data/problems/number-complement.json +1 -0
- package/data/problems/number-of-1-bits.json +1 -0
- package/data/problems/number-of-atoms.json +1 -0
- package/data/problems/number-of-boomerangs.json +1 -0
- package/data/problems/number-of-connected-components-in-an-undirected-graph.json +1 -0
- package/data/problems/number-of-corner-rectangles.json +1 -0
- package/data/problems/number-of-digit-one.json +1 -0
- package/data/problems/number-of-distinct-islands-ii.json +1 -0
- package/data/problems/number-of-distinct-islands.json +1 -0
- package/data/problems/number-of-islands-ii.json +1 -0
- package/data/problems/number-of-islands.json +1 -0
- package/data/problems/number-of-lines-to-write-string.json +1 -0
- package/data/problems/number-of-longest-increasing-subsequence.json +1 -0
- package/data/problems/number-of-matching-subsequences.json +1 -0
- package/data/problems/number-of-music-playlists.json +1 -0
- package/data/problems/number-of-provinces.json +1 -0
- package/data/problems/number-of-recent-calls.json +1 -0
- package/data/problems/number-of-segments-in-a-string.json +1 -0
- package/data/problems/number-of-squareful-arrays.json +1 -0
- package/data/problems/number-of-subarrays-with-bounded-maximum.json +1 -0
- package/data/problems/numbers-at-most-n-given-digit-set.json +1 -0
- package/data/problems/numbers-with-same-consecutive-differences.json +1 -0
- package/data/problems/odd-even-jump.json +1 -0
- package/data/problems/odd-even-linked-list.json +1 -0
- package/data/problems/one-edit-distance.json +1 -0
- package/data/problems/ones-and-zeroes.json +1 -0
- package/data/problems/online-election.json +1 -0
- package/data/problems/online-stock-span.json +1 -0
- package/data/problems/open-the-lock.json +1 -0
- package/data/problems/optimal-account-balancing.json +1 -0
- package/data/problems/optimal-division.json +1 -0
- package/data/problems/orderly-queue.json +1 -0
- package/data/problems/out-of-boundary-paths.json +1 -0
- package/data/problems/output-contest-matches.json +1 -0
- package/data/problems/pacific-atlantic-water-flow.json +1 -0
- package/data/problems/paint-fence.json +1 -0
- package/data/problems/paint-house-ii.json +1 -0
- package/data/problems/paint-house.json +1 -0
- package/data/problems/palindrome-linked-list.json +1 -0
- package/data/problems/palindrome-number.json +1 -0
- package/data/problems/palindrome-pairs.json +1 -0
- package/data/problems/palindrome-partitioning-ii.json +1 -0
- package/data/problems/palindrome-partitioning.json +1 -0
- package/data/problems/palindrome-permutation-ii.json +1 -0
- package/data/problems/palindrome-permutation.json +1 -0
- package/data/problems/palindromic-substrings.json +1 -0
- package/data/problems/pancake-sorting.json +1 -0
- package/data/problems/parse-lisp-expression.json +1 -0
- package/data/problems/partition-array-into-disjoint-intervals.json +1 -0
- package/data/problems/partition-equal-subset-sum.json +1 -0
- package/data/problems/partition-labels.json +1 -0
- package/data/problems/partition-list.json +1 -0
- package/data/problems/partition-to-k-equal-sum-subsets.json +1 -0
- package/data/problems/pascals-triangle-ii.json +1 -0
- package/data/problems/pascals-triangle.json +1 -0
- package/data/problems/patching-array.json +1 -0
- package/data/problems/path-sum-ii.json +1 -0
- package/data/problems/path-sum-iii.json +1 -0
- package/data/problems/path-sum-iv.json +1 -0
- package/data/problems/path-sum.json +1 -0
- package/data/problems/path-with-minimum-effort.json +1 -0
- package/data/problems/peak-index-in-a-mountain-array.json +1 -0
- package/data/problems/peeking-iterator.json +1 -0
- package/data/problems/perfect-number.json +1 -0
- package/data/problems/perfect-rectangle.json +1 -0
- package/data/problems/perfect-squares.json +1 -0
- package/data/problems/permutation-in-string.json +1 -0
- package/data/problems/permutation-sequence.json +1 -0
- package/data/problems/permutations-ii.json +1 -0
- package/data/problems/permutations.json +1 -0
- package/data/problems/plus-one-linked-list.json +1 -0
- package/data/problems/plus-one.json +1 -0
- package/data/problems/poor-pigs.json +1 -0
- package/data/problems/populating-next-right-pointers-in-each-node-ii.json +1 -0
- package/data/problems/populating-next-right-pointers-in-each-node.json +1 -0
- package/data/problems/positions-of-large-groups.json +1 -0
- package/data/problems/possible-bipartition.json +1 -0
- package/data/problems/pour-water.json +1 -0
- package/data/problems/power-of-four.json +1 -0
- package/data/problems/power-of-three.json +1 -0
- package/data/problems/power-of-two.json +1 -0
- package/data/problems/powerful-integers.json +1 -0
- package/data/problems/powx-n.json +1 -0
- package/data/problems/predict-the-winner.json +1 -0
- package/data/problems/prefix-and-suffix-search.json +1 -0
- package/data/problems/preimage-size-of-factorial-zeroes-function.json +1 -0
- package/data/problems/prime-number-of-set-bits-in-binary-representation.json +1 -0
- package/data/problems/prime-palindrome.json +1 -0
- package/data/problems/print-binary-tree.json +1 -0
- package/data/problems/prison-cells-after-n-days.json +1 -0
- package/data/problems/product-of-array-except-self.json +1 -0
- package/data/problems/profitable-schemes.json +1 -0
- package/data/problems/projection-area-of-3d-shapes.json +1 -0
- package/data/problems/push-dominoes.json +1 -0
- package/data/problems/pyramid-transition-matrix.json +1 -0
- package/data/problems/queue-reconstruction-by-height.json +1 -0
- package/data/problems/rabbits-in-forest.json +1 -0
- package/data/problems/race-car.json +1 -0
- package/data/problems/random-flip-matrix.json +1 -0
- package/data/problems/random-pick-index.json +1 -0
- package/data/problems/random-pick-with-blacklist.json +1 -0
- package/data/problems/random-pick-with-weight.json +1 -0
- package/data/problems/random-point-in-non-overlapping-rectangles.json +1 -0
- package/data/problems/range-addition-ii.json +1 -0
- package/data/problems/range-addition.json +1 -0
- package/data/problems/range-module.json +1 -0
- package/data/problems/range-sum-of-bst.json +1 -0
- package/data/problems/range-sum-query-2d-immutable.json +1 -0
- package/data/problems/range-sum-query-2d-mutable.json +1 -0
- package/data/problems/range-sum-query-immutable.json +1 -0
- package/data/problems/range-sum-query-mutable.json +1 -0
- package/data/problems/ransom-note.json +1 -0
- package/data/problems/reach-a-number.json +1 -0
- package/data/problems/reachable-nodes-in-subdivided-graph.json +1 -0
- package/data/problems/reaching-points.json +1 -0
- package/data/problems/read-n-characters-given-read4-ii-call-multiple-times.json +1 -0
- package/data/problems/read-n-characters-given-read4.json +1 -0
- package/data/problems/rearrange-string-k-distance-apart.json +1 -0
- package/data/problems/reconstruct-itinerary.json +1 -0
- package/data/problems/reconstruct-original-digits-from-english.json +1 -0
- package/data/problems/recover-binary-search-tree.json +1 -0
- package/data/problems/rectangle-area-ii.json +1 -0
- package/data/problems/rectangle-area.json +1 -0
- package/data/problems/rectangle-overlap.json +1 -0
- package/data/problems/redundant-connection-ii.json +1 -0
- package/data/problems/redundant-connection.json +1 -0
- package/data/problems/regions-cut-by-slashes.json +1 -0
- package/data/problems/regular-expression-matching.json +1 -0
- package/data/problems/relative-ranks.json +1 -0
- package/data/problems/remove-9.json +1 -0
- package/data/problems/remove-boxes.json +1 -0
- package/data/problems/remove-comments.json +1 -0
- package/data/problems/remove-duplicate-letters.json +1 -0
- package/data/problems/remove-duplicates-from-sorted-array-ii.json +1 -0
- package/data/problems/remove-duplicates-from-sorted-array.json +1 -0
- package/data/problems/remove-duplicates-from-sorted-list-ii.json +1 -0
- package/data/problems/remove-duplicates-from-sorted-list.json +1 -0
- package/data/problems/remove-element.json +1 -0
- package/data/problems/remove-invalid-parentheses.json +1 -0
- package/data/problems/remove-k-digits.json +1 -0
- package/data/problems/remove-linked-list-elements.json +1 -0
- package/data/problems/remove-nth-node-from-end-of-list.json +1 -0
- package/data/problems/reorder-data-in-log-files.json +1 -0
- package/data/problems/reorder-list.json +1 -0
- package/data/problems/reordered-power-of-2.json +1 -0
- package/data/problems/reorganize-string.json +1 -0
- package/data/problems/repeated-dna-sequences.json +1 -0
- package/data/problems/repeated-string-match.json +1 -0
- package/data/problems/repeated-substring-pattern.json +1 -0
- package/data/problems/replace-words.json +1 -0
- package/data/problems/reshape-the-matrix.json +1 -0
- package/data/problems/restore-ip-addresses.json +1 -0
- package/data/problems/reveal-cards-in-increasing-order.json +1 -0
- package/data/problems/reverse-bits.json +1 -0
- package/data/problems/reverse-integer.json +1 -0
- package/data/problems/reverse-linked-list-ii.json +1 -0
- package/data/problems/reverse-linked-list.json +1 -0
- package/data/problems/reverse-nodes-in-k-group.json +1 -0
- package/data/problems/reverse-only-letters.json +1 -0
- package/data/problems/reverse-pairs.json +1 -0
- package/data/problems/reverse-string-ii.json +1 -0
- package/data/problems/reverse-string.json +1 -0
- package/data/problems/reverse-vowels-of-a-string.json +1 -0
- package/data/problems/reverse-words-in-a-string-ii.json +1 -0
- package/data/problems/reverse-words-in-a-string-iii.json +1 -0
- package/data/problems/reverse-words-in-a-string.json +1 -0
- package/data/problems/rle-iterator.json +1 -0
- package/data/problems/robot-return-to-origin.json +1 -0
- package/data/problems/robot-room-cleaner.json +1 -0
- package/data/problems/roman-to-integer.json +1 -0
- package/data/problems/rotate-array.json +1 -0
- package/data/problems/rotate-function.json +1 -0
- package/data/problems/rotate-image.json +1 -0
- package/data/problems/rotate-list.json +1 -0
- package/data/problems/rotate-string.json +1 -0
- package/data/problems/rotated-digits.json +1 -0
- package/data/problems/rotting-oranges.json +1 -0
- package/data/problems/russian-doll-envelopes.json +1 -0
- package/data/problems/same-tree.json +1 -0
- package/data/problems/satisfiability-of-equality-equations.json +1 -0
- package/data/problems/score-after-flipping-matrix.json +1 -0
- package/data/problems/score-of-parentheses.json +1 -0
- package/data/problems/scramble-string.json +1 -0
- package/data/problems/search-a-2d-matrix-ii.json +1 -0
- package/data/problems/search-a-2d-matrix.json +1 -0
- package/data/problems/search-in-a-binary-search-tree.json +1 -0
- package/data/problems/search-in-a-sorted-array-of-unknown-size.json +1 -0
- package/data/problems/search-in-rotated-sorted-array-ii.json +1 -0
- package/data/problems/search-in-rotated-sorted-array.json +1 -0
- package/data/problems/search-insert-position.json +1 -0
- package/data/problems/second-minimum-node-in-a-binary-tree.json +1 -0
- package/data/problems/self-crossing.json +1 -0
- package/data/problems/self-dividing-numbers.json +1 -0
- package/data/problems/sentence-screen-fitting.json +1 -0
- package/data/problems/sentence-similarity-ii.json +1 -0
- package/data/problems/sentence-similarity.json +1 -0
- package/data/problems/sequence-reconstruction.json +1 -0
- package/data/problems/serialize-and-deserialize-binary-tree.json +1 -0
- package/data/problems/serialize-and-deserialize-bst.json +1 -0
- package/data/problems/serialize-and-deserialize-n-ary-tree.json +1 -0
- package/data/problems/set-intersection-size-at-least-two.json +1 -0
- package/data/problems/set-matrix-zeroes.json +1 -0
- package/data/problems/set-mismatch.json +1 -0
- package/data/problems/shifting-letters.json +1 -0
- package/data/problems/shopping-offers.json +1 -0
- package/data/problems/short-encoding-of-words.json +1 -0
- package/data/problems/shortest-bridge.json +1 -0
- package/data/problems/shortest-completing-word.json +1 -0
- package/data/problems/shortest-distance-from-all-buildings.json +1 -0
- package/data/problems/shortest-distance-to-a-character.json +1 -0
- package/data/problems/shortest-palindrome.json +1 -0
- package/data/problems/shortest-path-to-get-all-keys.json +1 -0
- package/data/problems/shortest-path-visiting-all-nodes.json +1 -0
- package/data/problems/shortest-subarray-with-sum-at-least-k.json +1 -0
- package/data/problems/shortest-unsorted-continuous-subarray.json +1 -0
- package/data/problems/shortest-word-distance-ii.json +1 -0
- package/data/problems/shortest-word-distance-iii.json +1 -0
- package/data/problems/shortest-word-distance.json +1 -0
- package/data/problems/shuffle-an-array.json +1 -0
- package/data/problems/similar-rgb-color.json +1 -0
- package/data/problems/similar-string-groups.json +1 -0
- package/data/problems/simplify-path.json +1 -0
- package/data/problems/single-element-in-a-sorted-array.json +1 -0
- package/data/problems/single-number-ii.json +1 -0
- package/data/problems/single-number-iii.json +1 -0
- package/data/problems/single-number.json +1 -0
- package/data/problems/single-threaded-cpu.json +1 -0
- package/data/problems/sliding-puzzle.json +1 -0
- package/data/problems/sliding-window-maximum.json +1 -0
- package/data/problems/sliding-window-median.json +1 -0
- package/data/problems/smallest-good-base.json +1 -0
- package/data/problems/smallest-range-covering-elements-from-k-lists.json +1 -0
- package/data/problems/smallest-range-i.json +1 -0
- package/data/problems/smallest-range-ii.json +1 -0
- package/data/problems/smallest-rectangle-enclosing-black-pixels.json +1 -0
- package/data/problems/smallest-rotation-with-highest-score.json +1 -0
- package/data/problems/smallest-string-starting-from-leaf.json +1 -0
- package/data/problems/smallest-subtree-with-all-the-deepest-nodes.json +1 -0
- package/data/problems/snakes-and-ladders.json +1 -0
- package/data/problems/solve-the-equation.json +1 -0
- package/data/problems/sort-an-array.json +1 -0
- package/data/problems/sort-array-by-parity-ii.json +1 -0
- package/data/problems/sort-array-by-parity.json +1 -0
- package/data/problems/sort-characters-by-frequency.json +1 -0
- package/data/problems/sort-colors.json +1 -0
- package/data/problems/sort-list.json +1 -0
- package/data/problems/sort-transformed-array.json +1 -0
- package/data/problems/soup-servings.json +1 -0
- package/data/problems/sparse-matrix-multiplication.json +1 -0
- package/data/problems/special-binary-string.json +1 -0
- package/data/problems/spiral-matrix-ii.json +1 -0
- package/data/problems/spiral-matrix-iii.json +1 -0
- package/data/problems/spiral-matrix.json +1 -0
- package/data/problems/split-array-into-consecutive-subsequences.json +1 -0
- package/data/problems/split-array-into-fibonacci-sequence.json +1 -0
- package/data/problems/split-array-largest-sum.json +1 -0
- package/data/problems/split-array-with-equal-sum.json +1 -0
- package/data/problems/split-array-with-same-average.json +1 -0
- package/data/problems/split-bst.json +1 -0
- package/data/problems/split-concatenated-strings.json +1 -0
- package/data/problems/split-linked-list-in-parts.json +1 -0
- package/data/problems/sqrtx.json +1 -0
- package/data/problems/squares-of-a-sorted-array.json +1 -0
- package/data/problems/squirrel-simulation.json +1 -0
- package/data/problems/stamping-the-sequence.json +1 -0
- package/data/problems/stickers-to-spell-word.json +1 -0
- package/data/problems/stone-game-ii.json +1 -0
- package/data/problems/stone-game-iii.json +1 -0
- package/data/problems/stone-game.json +1 -0
- package/data/problems/strange-printer.json +1 -0
- package/data/problems/string-compression.json +1 -0
- package/data/problems/string-to-integer-atoi.json +1 -0
- package/data/problems/string-without-aaa-or-bbb.json +1 -0
- package/data/problems/strobogrammatic-number-ii.json +1 -0
- package/data/problems/strobogrammatic-number-iii.json +1 -0
- package/data/problems/strobogrammatic-number.json +1 -0
- package/data/problems/strong-password-checker.json +1 -0
- package/data/problems/student-attendance-record-i.json +1 -0
- package/data/problems/student-attendance-record-ii.json +1 -0
- package/data/problems/subarray-product-less-than-k.json +1 -0
- package/data/problems/subarray-sum-equals-k.json +1 -0
- package/data/problems/subarray-sums-divisible-by-k.json +1 -0
- package/data/problems/subarrays-with-k-different-integers.json +1 -0
- package/data/problems/subdomain-visit-count.json +1 -0
- package/data/problems/subsets-ii.json +1 -0
- package/data/problems/subsets.json +1 -0
- package/data/problems/substring-with-concatenation-of-all-words.json +1 -0
- package/data/problems/subtree-of-another-tree.json +1 -0
- package/data/problems/sudoku-solver.json +1 -0
- package/data/problems/sum-of-all-subset-xor-totals.json +1 -0
- package/data/problems/sum-of-distances-in-tree.json +1 -0
- package/data/problems/sum-of-even-numbers-after-queries.json +1 -0
- package/data/problems/sum-of-left-leaves.json +1 -0
- package/data/problems/sum-of-square-numbers.json +1 -0
- package/data/problems/sum-of-subarray-minimums.json +1 -0
- package/data/problems/sum-of-subsequence-widths.json +1 -0
- package/data/problems/sum-of-two-integers.json +1 -0
- package/data/problems/sum-root-to-leaf-numbers.json +1 -0
- package/data/problems/summary-ranges.json +1 -0
- package/data/problems/super-egg-drop.json +1 -0
- package/data/problems/super-palindromes.json +1 -0
- package/data/problems/super-pow.json +1 -0
- package/data/problems/super-ugly-number.json +1 -0
- package/data/problems/super-washing-machines.json +1 -0
- package/data/problems/surface-area-of-3d-shapes.json +1 -0
- package/data/problems/surrounded-regions.json +1 -0
- package/data/problems/swap-adjacent-in-lr-string.json +1 -0
- package/data/problems/swap-nodes-in-pairs.json +1 -0
- package/data/problems/swim-in-rising-water.json +1 -0
- package/data/problems/symmetric-tree.json +1 -0
- package/data/problems/tag-validator.json +1 -0
- package/data/problems/tallest-billboard.json +1 -0
- package/data/problems/target-sum.json +1 -0
- package/data/problems/task-scheduler.json +1 -0
- package/data/problems/teemo-attacking.json +1 -0
- package/data/problems/ternary-expression-parser.json +1 -0
- package/data/problems/text-justification.json +1 -0
- package/data/problems/the-maze-ii.json +1 -0
- package/data/problems/the-maze-iii.json +1 -0
- package/data/problems/the-maze.json +1 -0
- package/data/problems/the-skyline-problem.json +1 -0
- package/data/problems/third-maximum-number.json +1 -0
- package/data/problems/three-equal-parts.json +1 -0
- package/data/problems/time-based-key-value-store.json +1 -0
- package/data/problems/to-lower-case.json +1 -0
- package/data/problems/toeplitz-matrix.json +1 -0
- package/data/problems/top-k-frequent-elements.json +1 -0
- package/data/problems/top-k-frequent-words.json +1 -0
- package/data/problems/total-hamming-distance.json +1 -0
- package/data/problems/transform-to-chessboard.json +1 -0
- package/data/problems/transpose-matrix.json +1 -0
- package/data/problems/trapping-rain-water-ii.json +1 -0
- package/data/problems/trapping-rain-water.json +1 -0
- package/data/problems/triangle.json +1 -0
- package/data/problems/trim-a-binary-search-tree.json +1 -0
- package/data/problems/triples-with-bitwise-and-equal-to-zero.json +1 -0
- package/data/problems/two-sum-ii-input-array-is-sorted.json +1 -0
- package/data/problems/two-sum-iii-data-structure-design.json +1 -0
- package/data/problems/two-sum-iv-input-is-a-bst.json +1 -0
- package/data/problems/two-sum.json +1 -0
- package/data/problems/ugly-number-ii.json +1 -0
- package/data/problems/ugly-number.json +1 -0
- package/data/problems/uncommon-words-from-two-sentences.json +1 -0
- package/data/problems/unique-binary-search-trees-ii.json +1 -0
- package/data/problems/unique-binary-search-trees.json +1 -0
- package/data/problems/unique-email-addresses.json +1 -0
- package/data/problems/unique-morse-code-words.json +1 -0
- package/data/problems/unique-paths-ii.json +1 -0
- package/data/problems/unique-paths-iii.json +1 -0
- package/data/problems/unique-paths.json +1 -0
- package/data/problems/unique-substrings-in-wraparound-string.json +1 -0
- package/data/problems/unique-word-abbreviation.json +1 -0
- package/data/problems/univalued-binary-tree.json +1 -0
- package/data/problems/utf-8-validation.json +1 -0
- package/data/problems/valid-anagram.json +1 -0
- package/data/problems/valid-mountain-array.json +1 -0
- package/data/problems/valid-number.json +1 -0
- package/data/problems/valid-palindrome-ii.json +1 -0
- package/data/problems/valid-palindrome.json +1 -0
- package/data/problems/valid-parentheses.json +1 -0
- package/data/problems/valid-parenthesis-string.json +1 -0
- package/data/problems/valid-perfect-square.json +1 -0
- package/data/problems/valid-permutations-for-di-sequence.json +1 -0
- package/data/problems/valid-square.json +1 -0
- package/data/problems/valid-sudoku.json +1 -0
- package/data/problems/valid-tic-tac-toe-state.json +1 -0
- package/data/problems/valid-triangle-number.json +1 -0
- package/data/problems/valid-word-abbreviation.json +1 -0
- package/data/problems/valid-word-square.json +1 -0
- package/data/problems/validate-binary-search-tree.json +1 -0
- package/data/problems/validate-ip-address.json +1 -0
- package/data/problems/validate-stack-sequences.json +1 -0
- package/data/problems/verify-preorder-sequence-in-binary-search-tree.json +1 -0
- package/data/problems/verify-preorder-serialization-of-a-binary-tree.json +1 -0
- package/data/problems/verifying-an-alien-dictionary.json +1 -0
- package/data/problems/vertical-order-traversal-of-a-binary-tree.json +1 -0
- package/data/problems/vowel-spellchecker.json +1 -0
- package/data/problems/walking-robot-simulation.json +1 -0
- package/data/problems/walls-and-gates.json +1 -0
- package/data/problems/water-and-jug-problem.json +1 -0
- package/data/problems/wiggle-sort-ii.json +1 -0
- package/data/problems/wiggle-sort.json +1 -0
- package/data/problems/wiggle-subsequence.json +1 -0
- package/data/problems/wildcard-matching.json +1 -0
- package/data/problems/word-abbreviation.json +1 -0
- package/data/problems/word-break-ii.json +1 -0
- package/data/problems/word-break.json +1 -0
- package/data/problems/word-ladder-ii.json +1 -0
- package/data/problems/word-ladder.json +1 -0
- package/data/problems/word-pattern-ii.json +1 -0
- package/data/problems/word-pattern.json +1 -0
- package/data/problems/word-search-ii.json +1 -0
- package/data/problems/word-search.json +1 -0
- package/data/problems/word-squares.json +1 -0
- package/data/problems/word-subsets.json +1 -0
- package/data/problems/x-of-a-kind-in-a-deck-of-cards.json +1 -0
- package/data/problems/zigzag-conversion.json +1 -0
- package/data/problems/zigzag-iterator.json +1 -0
- package/data/problems/zuma-game.json +1 -0
- package/dist/cli.js +793 -0
- package/dist/web/assets/index-7tyR3Zsa.js +147 -0
- package/dist/web/assets/index-oer4U46K.css +1 -0
- package/dist/web/index.html +13 -0
- package/package.json +42 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "124", "slug": "network-delay-time", "id": 124, "title": "Network Delay Time", "difficulty": "Medium", "category": "graph", "link": "https://leetcode.com/problems/network-delay-time/", "examples": [{"input": "times = [[2,1,1],[2,3,1],[3,4,1]], n = 4, k = 2", "output": "2", "explanation": "From node 2, the signal reaches all 4 nodes; the longest travel time is 2."}, {"input": "times = [[1,2,1]], n = 2, k = 2", "output": "-1", "explanation": "Node 2 has no outgoing edges, so it cannot reach node 1. Since not all nodes receive the signal, the answer is -1."}], "hints": ["The arrival time at each node is its shortest-path distance from k.", "All weights are positive, so Dijkstra's algorithm with a min-heap is appropriate.", "After finding all shortest distances, the answer is their maximum; an unreached node makes the answer -1."], "statement": "There are `n` network nodes labeled from `1` to `n`. Each directed edge\n`times[i] = [u, v, w]` means that a signal takes `w` time units to travel from\n`u` to `v`.\n\nA signal is sent from node `k`. Return the minimum time required for every node\nto receive the signal. Return `-1` if at least one node cannot be reached.\n\n**Constraints:**\n\n- `1 <= n <= 100`\n- `1 <= times.length <= 6000`\n- `times[i].length == 3`\n- `1 <= u, v, k <= n`\n- `u != v`\n- `0 <= w <= 100`\n- Directed node pairs in `times` are unique.\n", "solution": "## Approach\n\nThe time at which a node receives the signal is its shortest-path distance from `k`. Because every edge weight is positive, run Dijkstra's algorithm with a min-heap and ignore stale heap entries. If every node is reached, the largest shortest distance is the network delay.\n\n## Complexity Analysis\n\n- **Time Complexity:** O((V + E) log V) with a binary heap.\n- **Space Complexity:** O(V + E) for the graph, distances, and heap.\n\n## Implementation\n\n```python\nimport heapq\nfrom typing import List\n\n\nclass Solution:\n def networkDelayTime(self, times: List[List[int]], n: int, k: int) -> int:\n graph = [[] for _ in range(n + 1)]\n for source, target, weight in times:\n graph[source].append((target, weight))\n\n distance = [float(\"inf\")] * (n + 1)\n distance[k] = 0\n queue = [(0, k)]\n\n while queue:\n elapsed, node = heapq.heappop(queue)\n if elapsed != distance[node]:\n continue\n for target, weight in graph[node]:\n next_distance = elapsed + weight\n if next_distance < distance[target]:\n distance[target] = next_distance\n heapq.heappush(queue, (next_distance, target))\n\n answer = max(distance[1:])\n return -1 if answer == float(\"inf\") else answer\n```\n", "starter": {"go": "package main\n\nfunc NetworkDelayTime(times [][]int, n int, k int) int {\n return 0\n}\n", "python": "from typing import List\n\nclass Solution:\n def networkDelayTime(self, times: List[List[int]], n: int, k: int) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int networkDelayTime(vector<vector<int>>& times, int n, int k) {\n return 0;\n }\n};"}, "fn": "networkDelayTime", "params": [{"name": "times", "type": "int_array_2d", "visualizeType": "directed_weighted_edges", "numNodesRef": "n"}, {"name": "n", "type": "int"}, {"name": "k", "type": "int"}], "outputType": "int", "tests": [["[[1,2,100]]", "2", "1"], ["[[1,2,0]]", "2", "1"], ["[[1,2,1]]", "2", "1"], ["[[1,2,1]]", "2", "2"], ["[[2,1,7]]", "2", "2"], ["[[1,2,5],[2,1,3]]", "2", "1"], ["[[1,2,5],[2,1,3]]", "2", "2"], ["[[1,2,2],[2,3,3]]", "3", "1"], ["[[1,2,2],[2,3,3]]", "3", "2"], ["[[1,2,2],[1,3,7],[2,3,1]]", "3", "1"], ["[[1,2,10],[1,3,1],[3,2,1]]", "3", "1"], ["[[1,2,1],[2,3,1],[3,1,1]]", "3", "1"], ["[[1,2,4],[3,2,1]]", "3", "1"], ["[[2,1,4],[2,3,6]]", "3", "2"], ["[[2,1,1],[2,3,1],[3,4,1]]", "4", "2"], ["[[1,2,1],[2,3,1],[3,4,1]]", "4", "1"], ["[[4,3,1],[3,2,1],[2,1,1]]", "4", "4"], ["[[1,2,5],[1,3,2],[3,2,1],[2,4,1],[3,4,8]]", "4", "1"], ["[[1,2,1],[1,3,1],[1,4,1]]", "4", "1"], ["[[2,1,1],[3,1,1],[4,1,1]]", "4", "1"], ["[[1,2,1],[2,1,1],[3,4,1],[4,3,1]]", "4", "1"], ["[[1,2,9],[1,3,3],[3,2,2],[2,4,4],[3,4,10],[4,1,1]]", "4", "1"], ["[[1,2,2],[2,3,2],[3,4,2],[4,5,2]]", "5", "1"], ["[[5,4,2],[4,3,2],[3,2,2],[2,1,2]]", "5", "5"], ["[[1,2,1],[1,3,2],[1,4,3],[1,5,4]]", "5", "1"], ["[[1,2,10],[1,3,1],[3,4,1],[4,2,1],[2,5,1],[4,5,10]]", "5", "1"], ["[[1,2,1],[2,3,1],[3,1,1],[4,5,1]]", "5", "1"], ["[[3,1,4],[3,2,2],[3,4,6],[3,5,8],[2,5,3]]", "5", "3"], ["[[1,2,5],[1,3,5],[2,4,5],[3,4,1],[4,5,2],[2,5,20]]", "5", "1"], ["[[1,2,100],[2,3,100],[3,4,100],[4,5,100],[1,5,1]]", "5", "1"], ["[[1,2,1],[2,3,2],[3,4,3],[4,5,4],[5,6,5]]", "6", "1"], ["[[1,2,1],[1,3,1],[2,4,1],[2,5,1],[3,6,1]]", "6", "1"], ["[[6,5,1],[5,4,1],[4,3,1],[3,2,1],[2,1,1]]", "6", "6"], ["[[1,2,8],[1,3,3],[3,2,2],[2,4,4],[3,5,7],[5,4,1],[4,6,2],[5,6,9]]", "6", "1"], ["[[1,2,1],[2,3,1],[3,1,1],[4,5,1],[5,6,1],[6,4,1]]", "6", "1"], ["[[3,1,5],[3,2,4],[3,4,3],[3,5,2],[3,6,1]]", "6", "3"], ["[[1,2,9],[1,3,2],[3,4,2],[4,5,2],[5,6,2],[6,2,1],[2,5,1]]", "6", "1"], ["[[1,2,2],[2,3,2],[3,4,2],[4,5,2],[5,6,2],[6,7,2]]", "7", "1"], ["[[1,2,1],[1,3,1],[2,4,1],[2,5,1],[3,6,1],[3,7,1]]", "7", "1"], ["[[4,1,7],[4,2,6],[4,3,5],[4,5,4],[4,6,3],[4,7,2]]", "7", "4"], ["[[1,2,10],[1,3,4],[3,2,3],[2,4,2],[3,5,8],[5,4,1],[4,6,5],[5,7,2],[7,6,1]]", "7", "1"], ["[[1,2,1],[2,3,1],[3,4,1],[4,1,1],[5,6,1],[6,7,1]]", "7", "1"], ["[[1,2,3],[2,3,4],[3,4,5],[4,5,6],[5,6,7],[6,7,8],[7,8,9]]", "8", "1"], ["[[8,7,1],[7,6,2],[6,5,3],[5,4,4],[4,3,5],[3,2,6],[2,1,7]]", "8", "8"], ["[[1,2,1],[1,3,2],[2,4,3],[2,5,4],[3,6,5],[3,7,6],[7,8,7]]", "8", "1"], ["[[1,2,20],[1,3,2],[3,4,2],[4,5,2],[5,2,2],[2,6,2],[6,7,2],[7,8,2],[3,8,50]]", "8", "1"], ["[[5,1,9],[5,2,8],[5,3,7],[5,4,6],[5,6,5],[5,7,4],[5,8,3]]", "8", "5"], ["[[1,2,1],[2,3,1],[3,4,1],[4,5,1],[5,6,1],[6,7,1],[7,8,1],[8,9,1],[9,10,1]]", "10", "1"], ["[[1,2,5],[1,3,2],[2,4,2],[3,4,6],[3,5,3],[4,6,1],[5,6,4],[6,7,2],[7,8,2],[8,9,2],[9,10,2]]", "10", "1"], ["[[10,9,1],[9,8,1],[8,7,1],[7,6,1],[6,5,1],[5,4,1],[4,3,1],[3,2,1],[2,1,1]]", "10", "10"], ["[[1,2,1],[2,1,1],[3,4,1],[4,3,1],[5,6,1],[6,5,1],[7,8,1],[8,7,1],[9,10,1],[10,9,1]]", "10", "1"], ["[[1,2,4],[1,3,8],[2,3,1],[2,4,7],[3,4,2],[3,5,5],[4,5,1],[4,6,9],[5,6,3],[6,7,2],[7,8,2],[8,9,2],[9,10,2],[10,11,2],[11,12,2]]", "12", "1"], ["[[6,1,10],[6,2,9],[6,3,8],[6,4,7],[6,5,6],[6,7,5],[6,8,4],[6,9,3],[6,10,2],[6,11,1],[11,12,1]]", "12", "6"], ["[[1,2,3],[2,3,3],[3,4,3],[4,5,3],[5,6,3],[6,7,3],[7,8,3],[8,9,3],[9,10,3],[10,11,3],[11,12,3],[12,13,3],[13,14,3],[14,15,3]]", "15", "1"], ["[[100,99,100],[99,98,1],[98,97,1],[97,96,1],[96,95,1],[95,94,1],[94,93,1],[93,92,1],[92,91,1],[91,90,1],[90,89,1],[89,88,1],[88,87,1],[87,86,1],[86,85,1],[85,84,1],[84,83,1],[83,82,1],[82,81,1],[81,80,1],[80,79,1],[79,78,1],[78,77,1],[77,76,1],[76,75,1],[75,74,1],[74,73,1],[73,72,1],[72,71,1],[71,70,1],[70,69,1],[69,68,1],[68,67,1],[67,66,1],[66,65,1],[65,64,1],[64,63,1],[63,62,1],[62,61,1],[61,60,1],[60,59,1],[59,58,1],[58,57,1],[57,56,1],[56,55,1],[55,54,1],[54,53,1],[53,52,1],[52,51,1],[51,50,1],[50,49,1],[49,48,1],[48,47,1],[47,46,1],[46,45,1],[45,44,1],[44,43,1],[43,42,1],[42,41,1],[41,40,1],[40,39,1],[39,38,1],[38,37,1],[37,36,1],[36,35,1],[35,34,1],[34,33,1],[33,32,1],[32,31,1],[31,30,1],[30,29,1],[29,28,1],[28,27,1],[27,26,1],[26,25,1],[25,24,1],[24,23,1],[23,22,1],[22,21,1],[21,20,1],[20,19,1],[19,18,1],[18,17,1],[17,16,1],[16,15,1],[15,14,1],[14,13,1],[13,12,1],[12,11,1],[11,10,1],[10,9,1],[9,8,1],[8,7,1],[7,6,1],[6,5,1],[5,4,1],[4,3,1],[3,2,1],[2,1,1],[1,2,72],[1,3,89],[1,4,6],[1,5,23],[1,6,40],[1,7,57],[1,8,74],[1,9,91],[1,10,8],[1,11,25],[1,12,42],[1,13,59],[1,14,76],[1,15,93],[1,16,10],[1,17,27],[1,18,44],[1,19,61],[1,20,78],[1,21,95],[1,22,12],[1,23,29],[1,24,46],[1,25,63],[1,26,80],[1,27,97],[1,28,14],[1,29,31],[1,30,48],[1,31,65],[1,32,82],[1,33,99],[1,34,16],[1,35,33],[1,36,50],[1,37,67],[1,38,84],[1,39,1],[1,40,18],[1,41,35],[1,42,52],[1,43,69],[1,44,86],[1,45,3],[1,46,20],[1,47,37],[1,48,54],[1,49,71],[1,50,88],[1,51,5],[1,52,22],[1,53,39],[1,54,56],[1,55,73],[1,56,90],[1,57,7],[1,58,24],[1,59,41],[1,60,58],[1,61,75],[1,62,92],[1,63,9],[1,64,26],[1,65,43],[1,66,60],[1,67,77],[1,68,94],[1,69,11],[1,70,28],[1,71,45],[1,72,62],[1,73,79],[1,74,96],[1,75,13],[1,76,30],[1,77,47],[1,78,64],[1,79,81],[1,80,98],[1,81,15],[1,82,32],[1,83,49],[1,84,66],[1,85,83],[1,86,100],[1,87,17],[1,88,34],[1,89,51],[1,90,68],[1,91,85],[1,92,2],[1,93,19],[1,94,36],[1,95,53],[1,96,70],[1,97,87],[1,98,4],[1,99,21],[1,100,38],[2,3,26],[2,4,43],[2,5,60],[2,6,77],[2,7,94],[2,8,11],[2,9,28],[2,10,45],[2,11,62],[2,12,79],[2,13,96],[2,14,13],[2,15,30],[2,16,47],[2,17,64],[2,18,81],[2,19,98],[2,20,15],[2,21,32],[2,22,49],[2,23,66],[2,24,83],[2,25,100],[2,26,17],[2,27,34],[2,28,51],[2,29,68],[2,30,85],[2,31,2],[2,32,19],[2,33,36],[2,34,53],[2,35,70],[2,36,87],[2,37,4],[2,38,21],[2,39,38],[2,40,55],[2,41,72],[2,42,89],[2,43,6],[2,44,23],[2,45,40],[2,46,57],[2,47,74],[2,48,91],[2,49,8],[2,50,25],[2,51,42],[2,52,59],[2,53,76],[2,54,93],[2,55,10],[2,56,27],[2,57,44],[2,58,61],[2,59,78],[2,60,95],[2,61,12],[2,62,29],[2,63,46],[2,64,63],[2,65,80],[2,66,97],[2,67,14],[2,68,31],[2,69,48],[2,70,65],[2,71,82],[2,72,99],[2,73,16],[2,74,33],[2,75,50],[2,76,67],[2,77,84],[2,78,1],[2,79,18],[2,80,35],[2,81,52],[2,82,69],[2,83,86],[2,84,3],[2,85,20],[2,86,37],[2,87,54],[2,88,71],[2,89,88],[2,90,5],[2,91,22],[2,92,39],[2,93,56],[2,94,73],[2,95,90],[2,96,7],[2,97,24],[2,98,41],[2,99,58],[2,100,75],[3,1,29],[3,4,80],[3,5,97],[3,6,14],[3,7,31],[3,8,48],[3,9,65],[3,10,82],[3,11,99],[3,12,16],[3,13,33],[3,14,50],[3,15,67],[3,16,84],[3,17,1],[3,18,18],[3,19,35],[3,20,52],[3,21,69],[3,22,86],[3,23,3],[3,24,20],[3,25,37],[3,26,54],[3,27,71],[3,28,88],[3,29,5],[3,30,22],[3,31,39],[3,32,56],[3,33,73],[3,34,90],[3,35,7],[3,36,24],[3,37,41],[3,38,58],[3,39,75],[3,40,92],[3,41,9],[3,42,26],[3,43,43],[3,44,60],[3,45,77],[3,46,94],[3,47,11],[3,48,28],[3,49,45],[3,50,62],[3,51,79],[3,52,96],[3,53,13],[3,54,30],[3,55,47],[3,56,64],[3,57,81],[3,58,98],[3,59,15],[3,60,32],[3,61,49],[3,62,66],[3,63,83],[3,64,100],[3,65,17],[3,66,34],[3,67,51],[3,68,68],[3,69,85],[3,70,2],[3,71,19],[3,72,36],[3,73,53],[3,74,70],[3,75,87],[3,76,4],[3,77,21],[3,78,38],[3,79,55],[3,80,72],[3,81,89],[3,82,6],[3,83,23],[3,84,40],[3,85,57],[3,86,74],[3,87,91],[3,88,8],[3,89,25],[3,90,42],[3,91,59],[3,92,76],[3,93,93],[3,94,10],[3,95,27],[3,96,44],[3,97,61],[3,98,78],[3,99,95],[3,100,12],[4,1,66],[4,2,83],[4,5,34],[4,6,51],[4,7,68],[4,8,85],[4,9,2],[4,10,19],[4,11,36],[4,12,53],[4,13,70],[4,14,87],[4,15,4],[4,16,21],[4,17,38],[4,18,55],[4,19,72],[4,20,89],[4,21,6],[4,22,23],[4,23,40],[4,24,57],[4,25,74],[4,26,91],[4,27,8],[4,28,25],[4,29,42],[4,30,59],[4,31,76],[4,32,93],[4,33,10],[4,34,27],[4,35,44],[4,36,61],[4,37,78],[4,38,95],[4,39,12],[4,40,29],[4,41,46],[4,42,63],[4,43,80],[4,44,97],[4,45,14],[4,46,31],[4,47,48],[4,48,65],[4,49,82],[4,50,99],[4,51,16],[4,52,33],[4,53,50],[4,54,67],[4,55,84],[4,56,1],[4,57,18],[4,58,35],[4,59,52],[4,60,69],[4,61,86],[4,62,3],[4,63,20],[4,64,37],[4,65,54],[4,66,71],[4,67,88],[4,68,5],[4,69,22],[4,70,39],[4,71,56],[4,72,73],[4,73,90],[4,74,7],[4,75,24],[4,76,41],[4,77,58],[4,78,75],[4,79,92],[4,80,9],[4,81,26],[4,82,43],[4,83,60],[4,84,77],[4,85,94],[4,86,11],[4,87,28],[4,88,45],[4,89,62],[4,90,79],[4,91,96],[4,92,13],[4,93,30],[4,94,47],[4,95,64],[4,96,81],[4,97,98],[4,98,15],[4,99,32],[4,100,49],[5,1,3],[5,2,20],[5,3,37],[5,6,88],[5,7,5],[5,8,22],[5,9,39],[5,10,56],[5,11,73],[5,12,90],[5,13,7],[5,14,24],[5,15,41],[5,16,58],[5,17,75],[5,18,92],[5,19,9],[5,20,26],[5,21,43],[5,22,60],[5,23,77],[5,24,94],[5,25,11],[5,26,28],[5,27,45],[5,28,62],[5,29,79],[5,30,96],[5,31,13],[5,32,30],[5,33,47],[5,34,64],[5,35,81],[5,36,98],[5,37,15],[5,38,32],[5,39,49],[5,40,66],[5,41,83],[5,42,100],[5,43,17],[5,44,34],[5,45,51],[5,46,68],[5,47,85],[5,48,2],[5,49,19],[5,50,36],[5,51,53],[5,52,70],[5,53,87],[5,54,4],[5,55,21],[5,56,38],[5,57,55],[5,58,72],[5,59,89],[5,60,6],[5,61,23],[5,62,40],[5,63,57],[5,64,74],[5,65,91],[5,66,8],[5,67,25],[5,68,42],[5,69,59],[5,70,76],[5,71,93],[5,72,10],[5,73,27],[5,74,44],[5,75,61],[5,76,78],[5,77,95],[5,78,12],[5,79,29],[5,80,46],[5,81,63],[5,82,80],[5,83,97],[5,84,14],[5,85,31],[5,86,48],[5,87,65],[5,88,82],[5,89,99],[5,90,16],[5,91,33],[5,92,50],[5,93,67],[5,94,84],[5,95,1],[5,96,18],[5,97,35],[5,98,52],[5,99,69],[5,100,86],[6,1,40],[6,2,57],[6,3,74],[6,4,91],[6,7,42],[6,8,59],[6,9,76],[6,10,93],[6,11,10],[6,12,27],[6,13,44],[6,14,61],[6,15,78],[6,16,95],[6,17,12],[6,18,29],[6,19,46],[6,20,63],[6,21,80],[6,22,97],[6,23,14],[6,24,31],[6,25,48],[6,26,65],[6,27,82],[6,28,99],[6,29,16],[6,30,33],[6,31,50],[6,32,67],[6,33,84],[6,34,1],[6,35,18],[6,36,35],[6,37,52],[6,38,69],[6,39,86],[6,40,3],[6,41,20],[6,42,37],[6,43,54],[6,44,71],[6,45,88],[6,46,5],[6,47,22],[6,48,39],[6,49,56],[6,50,73],[6,51,90],[6,52,7],[6,53,24],[6,54,41],[6,55,58],[6,56,75],[6,57,92],[6,58,9],[6,59,26],[6,60,43],[6,61,60],[6,62,77],[6,63,94],[6,64,11],[6,65,28],[6,66,45],[6,67,62],[6,68,79],[6,69,96],[6,70,13],[6,71,30],[6,72,47],[6,73,64],[6,74,81],[6,75,98],[6,76,15],[6,77,32],[6,78,49],[6,79,66],[6,80,83],[6,81,100],[6,82,17],[6,83,34],[6,84,51],[6,85,68],[6,86,85],[6,87,2],[6,88,19],[6,89,36],[6,90,53],[6,91,70],[6,92,87],[6,93,4],[6,94,21],[6,95,38],[6,96,55],[6,97,72],[6,98,89],[6,99,6],[6,100,23],[7,1,77],[7,2,94],[7,3,11],[7,4,28],[7,5,45],[7,8,96],[7,9,13],[7,10,30],[7,11,47],[7,12,64],[7,13,81],[7,14,98],[7,15,15],[7,16,32],[7,17,49],[7,18,66],[7,19,83],[7,20,100],[7,21,17],[7,22,34],[7,23,51],[7,24,68],[7,25,85],[7,26,2],[7,27,19],[7,28,36],[7,29,53],[7,30,70],[7,31,87],[7,32,4],[7,33,21],[7,34,38],[7,35,55],[7,36,72],[7,37,89],[7,38,6],[7,39,23],[7,40,40],[7,41,57],[7,42,74],[7,43,91],[7,44,8],[7,45,25],[7,46,42],[7,47,59],[7,48,76],[7,49,93],[7,50,10],[7,51,27],[7,52,44],[7,53,61],[7,54,78],[7,55,95],[7,56,12],[7,57,29],[7,58,46],[7,59,63],[7,60,80],[7,61,97],[7,62,14],[7,63,31],[7,64,48],[7,65,65],[7,66,82],[7,67,99],[7,68,16],[7,69,33],[7,70,50],[7,71,67],[7,72,84],[7,73,1],[7,74,18],[7,75,35],[7,76,52],[7,77,69],[7,78,86],[7,79,3],[7,80,20],[7,81,37],[7,82,54],[7,83,71],[7,84,88],[7,85,5],[7,86,22],[7,87,39],[7,88,56],[7,89,73],[7,90,90],[7,91,7],[7,92,24],[7,93,41],[7,94,58],[7,95,75],[7,96,92],[7,97,9],[7,98,26],[7,99,43],[7,100,60],[8,1,14],[8,2,31],[8,3,48],[8,4,65],[8,5,82],[8,6,99],[8,9,50],[8,10,67],[8,11,84],[8,12,1],[8,13,18],[8,14,35],[8,15,52],[8,16,69],[8,17,86],[8,18,3],[8,19,20],[8,20,37],[8,21,54],[8,22,71],[8,23,88],[8,24,5],[8,25,22],[8,26,39],[8,27,56],[8,28,73],[8,29,90],[8,30,7],[8,31,24],[8,32,41],[8,33,58],[8,34,75],[8,35,92],[8,36,9],[8,37,26],[8,38,43],[8,39,60],[8,40,77],[8,41,94],[8,42,11],[8,43,28],[8,44,45],[8,45,62],[8,46,79],[8,47,96],[8,48,13],[8,49,30],[8,50,47],[8,51,64],[8,52,81],[8,53,98],[8,54,15],[8,55,32],[8,56,49],[8,57,66],[8,58,83],[8,59,100],[8,60,17],[8,61,34],[8,62,51],[8,63,68],[8,64,85],[8,65,2],[8,66,19],[8,67,36],[8,68,53],[8,69,70],[8,70,87],[8,71,4],[8,72,21],[8,73,38],[8,74,55],[8,75,72],[8,76,89],[8,77,6],[8,78,23],[8,79,40],[8,80,57],[8,81,74],[8,82,91],[8,83,8],[8,84,25],[8,85,42],[8,86,59],[8,87,76],[8,88,93],[8,89,10],[8,90,27],[8,91,44],[8,92,61],[8,93,78],[8,94,95],[8,95,12],[8,96,29],[8,97,46],[8,98,63],[8,99,80],[8,100,97],[9,1,51],[9,2,68],[9,3,85],[9,4,2],[9,5,19],[9,6,36],[9,7,53],[9,10,4],[9,11,21],[9,12,38],[9,13,55],[9,14,72],[9,15,89],[9,16,6],[9,17,23],[9,18,40],[9,19,57],[9,20,74],[9,21,91],[9,22,8],[9,23,25],[9,24,42],[9,25,59],[9,26,76],[9,27,93],[9,28,10],[9,29,27],[9,30,44],[9,31,61],[9,32,78],[9,33,95],[9,34,12],[9,35,29],[9,36,46],[9,37,63],[9,38,80],[9,39,97],[9,40,14],[9,41,31],[9,42,48],[9,43,65],[9,44,82],[9,45,99],[9,46,16],[9,47,33],[9,48,50],[9,49,67],[9,50,84],[9,51,1],[9,52,18],[9,53,35],[9,54,52],[9,55,69],[9,56,86],[9,57,3],[9,58,20],[9,59,37],[9,60,54],[9,61,71],[9,62,88],[9,63,5],[9,64,22],[9,65,39],[9,66,56],[9,67,73],[9,68,90],[9,69,7],[9,70,24],[9,71,41],[9,72,58],[9,73,75],[9,74,92],[9,75,9],[9,76,26],[9,77,43],[9,78,60],[9,79,77],[9,80,94],[9,81,11],[9,82,28],[9,83,45],[9,84,62],[9,85,79],[9,86,96],[9,87,13],[9,88,30],[9,89,47],[9,90,64],[9,91,81],[9,92,98],[9,93,15],[9,94,32],[9,95,49],[9,96,66],[9,97,83],[9,98,100],[9,99,17],[9,100,34],[10,1,88],[10,2,5],[10,3,22],[10,4,39],[10,5,56],[10,6,73],[10,7,90],[10,8,7],[10,11,58],[10,12,75],[10,13,92],[10,14,9],[10,15,26],[10,16,43],[10,17,60],[10,18,77],[10,19,94],[10,20,11],[10,21,28],[10,22,45],[10,23,62],[10,24,79],[10,25,96],[10,26,13],[10,27,30],[10,28,47],[10,29,64],[10,30,81],[10,31,98],[10,32,15],[10,33,32],[10,34,49],[10,35,66],[10,36,83],[10,37,100],[10,38,17],[10,39,34],[10,40,51],[10,41,68],[10,42,85],[10,43,2],[10,44,19],[10,45,36],[10,46,53],[10,47,70],[10,48,87],[10,49,4],[10,50,21],[10,51,38],[10,52,55],[10,53,72],[10,54,89],[10,55,6],[10,56,23],[10,57,40],[10,58,57],[10,59,74],[10,60,91],[10,61,8],[10,62,25],[10,63,42],[10,64,59],[10,65,76],[10,66,93],[10,67,10],[10,68,27],[10,69,44],[10,70,61],[10,71,78],[10,72,95],[10,73,12],[10,74,29],[10,75,46],[10,76,63],[10,77,80],[10,78,97],[10,79,14],[10,80,31],[10,81,48],[10,82,65],[10,83,82],[10,84,99],[10,85,16],[10,86,33],[10,87,50],[10,88,67],[10,89,84],[10,90,1],[10,91,18],[10,92,35],[10,93,52],[10,94,69],[10,95,86],[10,96,3],[10,97,20],[10,98,37],[10,99,54],[10,100,71],[11,1,25],[11,2,42],[11,3,59],[11,4,76],[11,5,93],[11,6,10],[11,7,27],[11,8,44],[11,9,61],[11,12,12],[11,13,29],[11,14,46],[11,15,63],[11,16,80],[11,17,97],[11,18,14],[11,19,31],[11,20,48],[11,21,65],[11,22,82],[11,23,99],[11,24,16],[11,25,33],[11,26,50],[11,27,67],[11,28,84],[11,29,1],[11,30,18],[11,31,35],[11,32,52],[11,33,69],[11,34,86],[11,35,3],[11,36,20],[11,37,37],[11,38,54],[11,39,71],[11,40,88],[11,41,5],[11,42,22],[11,43,39],[11,44,56],[11,45,73],[11,46,90],[11,47,7],[11,48,24],[11,49,41],[11,50,58],[11,51,75],[11,52,92],[11,53,9],[11,54,26],[11,55,43],[11,56,60],[11,57,77],[11,58,94],[11,59,11],[11,60,28],[11,61,45],[11,62,62],[11,63,79],[11,64,96],[11,65,13],[11,66,30],[11,67,47],[11,68,64],[11,69,81],[11,70,98],[11,71,15],[11,72,32],[11,73,49],[11,74,66],[11,75,83],[11,76,100],[11,77,17],[11,78,34],[11,79,51],[11,80,68],[11,81,85],[11,82,2],[11,83,19],[11,84,36],[11,85,53],[11,86,70],[11,87,87],[11,88,4],[11,89,21],[11,90,38],[11,91,55],[11,92,72],[11,93,89],[11,94,6],[11,95,23],[11,96,40],[11,97,57],[11,98,74],[11,99,91],[11,100,8],[12,1,62],[12,2,79],[12,3,96],[12,4,13],[12,5,30],[12,6,47],[12,7,64],[12,8,81],[12,9,98],[12,10,15],[12,13,66],[12,14,83],[12,15,100],[12,16,17],[12,17,34],[12,18,51],[12,19,68],[12,20,85],[12,21,2],[12,22,19],[12,23,36],[12,24,53],[12,25,70],[12,26,87],[12,27,4],[12,28,21],[12,29,38],[12,30,55],[12,31,72],[12,32,89],[12,33,6],[12,34,23],[12,35,40],[12,36,57],[12,37,74],[12,38,91],[12,39,8],[12,40,25],[12,41,42],[12,42,59],[12,43,76],[12,44,93],[12,45,10],[12,46,27],[12,47,44],[12,48,61],[12,49,78],[12,50,95],[12,51,12],[12,52,29],[12,53,46],[12,54,63],[12,55,80],[12,56,97],[12,57,14],[12,58,31],[12,59,48],[12,60,65],[12,61,82],[12,62,99],[12,63,16],[12,64,33],[12,65,50],[12,66,67],[12,67,84],[12,68,1],[12,69,18],[12,70,35],[12,71,52],[12,72,69],[12,73,86],[12,74,3],[12,75,20],[12,76,37],[12,77,54],[12,78,71],[12,79,88],[12,80,5],[12,81,22],[12,82,39],[12,83,56],[12,84,73],[12,85,90],[12,86,7],[12,87,24],[12,88,41],[12,89,58],[12,90,75],[12,91,92],[12,92,9],[12,93,26],[12,94,43],[12,95,60],[12,96,77],[12,97,94],[12,98,11],[12,99,28],[12,100,45],[13,1,99],[13,2,16],[13,3,33],[13,4,50],[13,5,67],[13,6,84],[13,7,1],[13,8,18],[13,9,35],[13,10,52],[13,11,69],[13,14,20],[13,15,37],[13,16,54],[13,17,71],[13,18,88],[13,19,5],[13,20,22],[13,21,39],[13,22,56],[13,23,73],[13,24,90],[13,25,7],[13,26,24],[13,27,41],[13,28,58],[13,29,75],[13,30,92],[13,31,9],[13,32,26],[13,33,43],[13,34,60],[13,35,77],[13,36,94],[13,37,11],[13,38,28],[13,39,45],[13,40,62],[13,41,79],[13,42,96],[13,43,13],[13,44,30],[13,45,47],[13,46,64],[13,47,81],[13,48,98],[13,49,15],[13,50,32],[13,51,49],[13,52,66],[13,53,83],[13,54,100],[13,55,17],[13,56,34],[13,57,51],[13,58,68],[13,59,85],[13,60,2],[13,61,19],[13,62,36],[13,63,53],[13,64,70],[13,65,87],[13,66,4],[13,67,21],[13,68,38],[13,69,55],[13,70,72],[13,71,89],[13,72,6],[13,73,23],[13,74,40],[13,75,57],[13,76,74],[13,77,91],[13,78,8],[13,79,25],[13,80,42],[13,81,59],[13,82,76],[13,83,93],[13,84,10],[13,85,27],[13,86,44],[13,87,61],[13,88,78],[13,89,95],[13,90,12],[13,91,29],[13,92,46],[13,93,63],[13,94,80],[13,95,97],[13,96,14],[13,97,31],[13,98,48],[13,99,65],[13,100,82],[14,1,36],[14,2,53],[14,3,70],[14,4,87],[14,5,4],[14,6,21],[14,7,38],[14,8,55],[14,9,72],[14,10,89],[14,11,6],[14,12,23],[14,15,74],[14,16,91],[14,17,8],[14,18,25],[14,19,42],[14,20,59],[14,21,76],[14,22,93],[14,23,10],[14,24,27],[14,25,44],[14,26,61],[14,27,78],[14,28,95],[14,29,12],[14,30,29],[14,31,46],[14,32,63],[14,33,80],[14,34,97],[14,35,14],[14,36,31],[14,37,48],[14,38,65],[14,39,82],[14,40,99],[14,41,16],[14,42,33],[14,43,50],[14,44,67],[14,45,84],[14,46,1],[14,47,18],[14,48,35],[14,49,52],[14,50,69],[14,51,86],[14,52,3],[14,53,20],[14,54,37],[14,55,54],[14,56,71],[14,57,88],[14,58,5],[14,59,22],[14,60,39],[14,61,56],[14,62,73],[14,63,90],[14,64,7],[14,65,24],[14,66,41],[14,67,58],[14,68,75],[14,69,92],[14,70,9],[14,71,26],[14,72,43],[14,73,60],[14,74,77],[14,75,94],[14,76,11],[14,77,28],[14,78,45],[14,79,62],[14,80,79],[14,81,96],[14,82,13],[14,83,30],[14,84,47],[14,85,64],[14,86,81],[14,87,98],[14,88,15],[14,89,32],[14,90,49],[14,91,66],[14,92,83],[14,93,100],[14,94,17],[14,95,34],[14,96,51],[14,97,68],[14,98,85],[14,99,2],[14,100,19],[15,1,73],[15,2,90],[15,3,7],[15,4,24],[15,5,41],[15,6,58],[15,7,75],[15,8,92],[15,9,9],[15,10,26],[15,11,43],[15,12,60],[15,13,77],[15,16,28],[15,17,45],[15,18,62],[15,19,79],[15,20,96],[15,21,13],[15,22,30],[15,23,47],[15,24,64],[15,25,81],[15,26,98],[15,27,15],[15,28,32],[15,29,49],[15,30,66],[15,31,83],[15,32,100],[15,33,17],[15,34,34],[15,35,51],[15,36,68],[15,37,85],[15,38,2],[15,39,19],[15,40,36],[15,41,53],[15,42,70],[15,43,87],[15,44,4],[15,45,21],[15,46,38],[15,47,55],[15,48,72],[15,49,89],[15,50,6],[15,51,23],[15,52,40],[15,53,57],[15,54,74],[15,55,91],[15,56,8],[15,57,25],[15,58,42],[15,59,59],[15,60,76],[15,61,93],[15,62,10],[15,63,27],[15,64,44],[15,65,61],[15,66,78],[15,67,95],[15,68,12],[15,69,29],[15,70,46],[15,71,63],[15,72,80],[15,73,97],[15,74,14],[15,75,31],[15,76,48],[15,77,65],[15,78,82],[15,79,99],[15,80,16],[15,81,33],[15,82,50],[15,83,67],[15,84,84],[15,85,1],[15,86,18],[15,87,35],[15,88,52],[15,89,69],[15,90,86],[15,91,3],[15,92,20],[15,93,37],[15,94,54],[15,95,71],[15,96,88],[15,97,5],[15,98,22],[15,99,39],[15,100,56],[16,1,10],[16,2,27],[16,3,44],[16,4,61],[16,5,78],[16,6,95],[16,7,12],[16,8,29],[16,9,46],[16,10,63],[16,11,80],[16,12,97],[16,13,14],[16,14,31],[16,17,82],[16,18,99],[16,19,16],[16,20,33],[16,21,50],[16,22,67],[16,23,84],[16,24,1],[16,25,18],[16,26,35],[16,27,52],[16,28,69],[16,29,86],[16,30,3],[16,31,20],[16,32,37],[16,33,54],[16,34,71],[16,35,88],[16,36,5],[16,37,22],[16,38,39],[16,39,56],[16,40,73],[16,41,90],[16,42,7],[16,43,24],[16,44,41],[16,45,58],[16,46,75],[16,47,92],[16,48,9],[16,49,26],[16,50,43],[16,51,60],[16,52,77],[16,53,94],[16,54,11],[16,55,28],[16,56,45],[16,57,62],[16,58,79],[16,59,96],[16,60,13],[16,61,30],[16,62,47],[16,63,64],[16,64,81],[16,65,98],[16,66,15],[16,67,32],[16,68,49],[16,69,66],[16,70,83],[16,71,100],[16,72,17],[16,73,34],[16,74,51],[16,75,68],[16,76,85],[16,77,2],[16,78,19],[16,79,36],[16,80,53],[16,81,70],[16,82,87],[16,83,4],[16,84,21],[16,85,38],[16,86,55],[16,87,72],[16,88,89],[16,89,6],[16,90,23],[16,91,40],[16,92,57],[16,93,74],[16,94,91],[16,95,8],[16,96,25],[16,97,42],[16,98,59],[16,99,76],[16,100,93],[17,1,47],[17,2,64],[17,3,81],[17,4,98],[17,5,15],[17,6,32],[17,7,49],[17,8,66],[17,9,83],[17,10,100],[17,11,17],[17,12,34],[17,13,51],[17,14,68],[17,15,85],[17,18,36],[17,19,53],[17,20,70],[17,21,87],[17,22,4],[17,23,21],[17,24,38],[17,25,55],[17,26,72],[17,27,89],[17,28,6],[17,29,23],[17,30,40],[17,31,57],[17,32,74],[17,33,91],[17,34,8],[17,35,25],[17,36,42],[17,37,59],[17,38,76],[17,39,93],[17,40,10],[17,41,27],[17,42,44],[17,43,61],[17,44,78],[17,45,95],[17,46,12],[17,47,29],[17,48,46],[17,49,63],[17,50,80],[17,51,97],[17,52,14],[17,53,31],[17,54,48],[17,55,65],[17,56,82],[17,57,99],[17,58,16],[17,59,33],[17,60,50],[17,61,67],[17,62,84],[17,63,1],[17,64,18],[17,65,35],[17,66,52],[17,67,69],[17,68,86],[17,69,3],[17,70,20],[17,71,37],[17,72,54],[17,73,71],[17,74,88],[17,75,5],[17,76,22],[17,77,39],[17,78,56],[17,79,73],[17,80,90],[17,81,7],[17,82,24],[17,83,41],[17,84,58],[17,85,75],[17,86,92],[17,87,9],[17,88,26],[17,89,43],[17,90,60],[17,91,77],[17,92,94],[17,93,11],[17,94,28],[17,95,45],[17,96,62],[17,97,79],[17,98,96],[17,99,13],[17,100,30],[18,1,84],[18,2,1],[18,3,18],[18,4,35],[18,5,52],[18,6,69],[18,7,86],[18,8,3],[18,9,20],[18,10,37],[18,11,54],[18,12,71],[18,13,88],[18,14,5],[18,15,22],[18,16,39],[18,19,90],[18,20,7],[18,21,24],[18,22,41],[18,23,58],[18,24,75],[18,25,92],[18,26,9],[18,27,26],[18,28,43],[18,29,60],[18,30,77],[18,31,94],[18,32,11],[18,33,28],[18,34,45],[18,35,62],[18,36,79],[18,37,96],[18,38,13],[18,39,30],[18,40,47],[18,41,64],[18,42,81],[18,43,98],[18,44,15],[18,45,32],[18,46,49],[18,47,66],[18,48,83],[18,49,100],[18,50,17],[18,51,34],[18,52,51],[18,53,68],[18,54,85],[18,55,2],[18,56,19],[18,57,36],[18,58,53],[18,59,70],[18,60,87],[18,61,4],[18,62,21],[18,63,38],[18,64,55],[18,65,72],[18,66,89],[18,67,6],[18,68,23],[18,69,40],[18,70,57],[18,71,74],[18,72,91],[18,73,8],[18,74,25],[18,75,42],[18,76,59],[18,77,76],[18,78,93],[18,79,10],[18,80,27],[18,81,44],[18,82,61],[18,83,78],[18,84,95],[18,85,12],[18,86,29],[18,87,46],[18,88,63],[18,89,80],[18,90,97],[18,91,14],[18,92,31],[18,93,48],[18,94,65],[18,95,82],[18,96,99],[18,97,16],[18,98,33],[18,99,50],[18,100,67],[19,1,21],[19,2,38],[19,3,55],[19,4,72],[19,5,89],[19,6,6],[19,7,23],[19,8,40],[19,9,57],[19,10,74],[19,11,91],[19,12,8],[19,13,25],[19,14,42],[19,15,59],[19,16,76],[19,17,93],[19,20,44],[19,21,61],[19,22,78],[19,23,95],[19,24,12],[19,25,29],[19,26,46],[19,27,63],[19,28,80],[19,29,97],[19,30,14],[19,31,31],[19,32,48],[19,33,65],[19,34,82],[19,35,99],[19,36,16],[19,37,33],[19,38,50],[19,39,67],[19,40,84],[19,41,1],[19,42,18],[19,43,35],[19,44,52],[19,45,69],[19,46,86],[19,47,3],[19,48,20],[19,49,37],[19,50,54],[19,51,71],[19,52,88],[19,53,5],[19,54,22],[19,55,39],[19,56,56],[19,57,73],[19,58,90],[19,59,7],[19,60,24],[19,61,41],[19,62,58],[19,63,75],[19,64,92],[19,65,9],[19,66,26],[19,67,43],[19,68,60],[19,69,77],[19,70,94],[19,71,11],[19,72,28],[19,73,45],[19,74,62],[19,75,79],[19,76,96],[19,77,13],[19,78,30],[19,79,47],[19,80,64],[19,81,81],[19,82,98],[19,83,15],[19,84,32],[19,85,49],[19,86,66],[19,87,83],[19,88,100],[19,89,17],[19,90,34],[19,91,51],[19,92,68],[19,93,85],[19,94,2],[19,95,19],[19,96,36],[19,97,53],[19,98,70],[19,99,87],[19,100,4],[20,1,58],[20,2,75],[20,3,92],[20,4,9],[20,5,26],[20,6,43],[20,7,60],[20,8,77],[20,9,94],[20,10,11],[20,11,28],[20,12,45],[20,13,62],[20,14,79],[20,15,96],[20,16,13],[20,17,30],[20,18,47],[20,21,98],[20,22,15],[20,23,32],[20,24,49],[20,25,66],[20,26,83],[20,27,100],[20,28,17],[20,29,34],[20,30,51],[20,31,68],[20,32,85],[20,33,2],[20,34,19],[20,35,36],[20,36,53],[20,37,70],[20,38,87],[20,39,4],[20,40,21],[20,41,38],[20,42,55],[20,43,72],[20,44,89],[20,45,6],[20,46,23],[20,47,40],[20,48,57],[20,49,74],[20,50,91],[20,51,8],[20,52,25],[20,53,42],[20,54,59],[20,55,76],[20,56,93],[20,57,10],[20,58,27],[20,59,44],[20,60,61],[20,61,78],[20,62,95],[20,63,12],[20,64,29],[20,65,46],[20,66,63],[20,67,80],[20,68,97],[20,69,14],[20,70,31],[20,71,48],[20,72,65],[20,73,82],[20,74,99],[20,75,16],[20,76,33],[20,77,50],[20,78,67],[20,79,84],[20,80,1],[20,81,18],[20,82,35],[20,83,52],[20,84,69],[20,85,86],[20,86,3],[20,87,20],[20,88,37],[20,89,54],[20,90,71],[20,91,88],[20,92,5],[20,93,22],[20,94,39],[20,95,56],[20,96,73],[20,97,90],[20,98,7],[20,99,24],[20,100,41],[21,1,95],[21,2,12],[21,3,29],[21,4,46],[21,5,63],[21,6,80],[21,7,97],[21,8,14],[21,9,31],[21,10,48],[21,11,65],[21,12,82],[21,13,99],[21,14,16],[21,15,33],[21,16,50],[21,17,67],[21,18,84],[21,19,1],[21,22,52],[21,23,69],[21,24,86],[21,25,3],[21,26,20],[21,27,37],[21,28,54],[21,29,71],[21,30,88],[21,31,5],[21,32,22],[21,33,39],[21,34,56],[21,35,73],[21,36,90],[21,37,7],[21,38,24],[21,39,41],[21,40,58],[21,41,75],[21,42,92],[21,43,9],[21,44,26],[21,45,43],[21,46,60],[21,47,77],[21,48,94],[21,49,11],[21,50,28],[21,51,45],[21,52,62],[21,53,79],[21,54,96],[21,55,13],[21,56,30],[21,57,47],[21,58,64],[21,59,81],[21,60,98],[21,61,15],[21,62,32],[21,63,49],[21,64,66],[21,65,83],[21,66,100],[21,67,17],[21,68,34],[21,69,51],[21,70,68],[21,71,85],[21,72,2],[21,73,19],[21,74,36],[21,75,53],[21,76,70],[21,77,87],[21,78,4],[21,79,21],[21,80,38],[21,81,55],[21,82,72],[21,83,89],[21,84,6],[21,85,23],[21,86,40],[21,87,57],[21,88,74],[21,89,91],[21,90,8],[21,91,25],[21,92,42],[21,93,59],[21,94,76],[21,95,93],[21,96,10],[21,97,27],[21,98,44],[21,99,61],[21,100,78],[22,1,32],[22,2,49],[22,3,66],[22,4,83],[22,5,100],[22,6,17],[22,7,34],[22,8,51],[22,9,68],[22,10,85],[22,11,2],[22,12,19],[22,13,36],[22,14,53],[22,15,70],[22,16,87],[22,17,4],[22,18,21],[22,19,38],[22,20,55],[22,23,6],[22,24,23],[22,25,40],[22,26,57],[22,27,74],[22,28,91],[22,29,8],[22,30,25],[22,31,42],[22,32,59],[22,33,76],[22,34,93],[22,35,10],[22,36,27],[22,37,44],[22,38,61],[22,39,78],[22,40,95],[22,41,12],[22,42,29],[22,43,46],[22,44,63],[22,45,80],[22,46,97],[22,47,14],[22,48,31],[22,49,48],[22,50,65],[22,51,82],[22,52,99],[22,53,16],[22,54,33],[22,55,50],[22,56,67],[22,57,84],[22,58,1],[22,59,18],[22,60,35],[22,61,52],[22,62,69],[22,63,86],[22,64,3],[22,65,20],[22,66,37],[22,67,54],[22,68,71],[22,69,88],[22,70,5],[22,71,22],[22,72,39],[22,73,56],[22,74,73],[22,75,90],[22,76,7],[22,77,24],[22,78,41],[22,79,58],[22,80,75],[22,81,92],[22,82,9],[22,83,26],[22,84,43],[22,85,60],[22,86,77],[22,87,94],[22,88,11],[22,89,28],[22,90,45],[22,91,62],[22,92,79],[22,93,96],[22,94,13],[22,95,30],[22,96,47],[22,97,64],[22,98,81],[22,99,98],[22,100,15],[23,1,69],[23,2,86],[23,3,3],[23,4,20],[23,5,37],[23,6,54],[23,7,71],[23,8,88],[23,9,5],[23,10,22],[23,11,39],[23,12,56],[23,13,73],[23,14,90],[23,15,7],[23,16,24],[23,17,41],[23,18,58],[23,19,75],[23,20,92],[23,21,9],[23,24,60],[23,25,77],[23,26,94],[23,27,11],[23,28,28],[23,29,45],[23,30,62],[23,31,79],[23,32,96],[23,33,13],[23,34,30],[23,35,47],[23,36,64],[23,37,81],[23,38,98],[23,39,15],[23,40,32],[23,41,49],[23,42,66],[23,43,83],[23,44,100],[23,45,17],[23,46,34],[23,47,51],[23,48,68],[23,49,85],[23,50,2],[23,51,19],[23,52,36],[23,53,53],[23,54,70],[23,55,87],[23,56,4],[23,57,21],[23,58,38],[23,59,55],[23,60,72],[23,61,89],[23,62,6],[23,63,23],[23,64,40],[23,65,57],[23,66,74],[23,67,91],[23,68,8],[23,69,25],[23,70,42],[23,71,59],[23,72,76],[23,73,93],[23,74,10],[23,75,27],[23,76,44],[23,77,61],[23,78,78],[23,79,95],[23,80,12],[23,81,29],[23,82,46],[23,83,63],[23,84,80],[23,85,97],[23,86,14],[23,87,31],[23,88,48],[23,89,65],[23,90,82],[23,91,99],[23,92,16],[23,93,33],[23,94,50],[23,95,67],[23,96,84],[23,97,1],[23,98,18],[23,99,35],[23,100,52],[24,1,6],[24,2,23],[24,3,40],[24,4,57],[24,5,74],[24,6,91],[24,7,8],[24,8,25],[24,9,42],[24,10,59],[24,11,76],[24,12,93],[24,13,10],[24,14,27],[24,15,44],[24,16,61],[24,17,78],[24,18,95],[24,19,12],[24,20,29],[24,21,46],[24,22,63],[24,25,14],[24,26,31],[24,27,48],[24,28,65],[24,29,82],[24,30,99],[24,31,16],[24,32,33],[24,33,50],[24,34,67],[24,35,84],[24,36,1],[24,37,18],[24,38,35],[24,39,52],[24,40,69],[24,41,86],[24,42,3],[24,43,20],[24,44,37],[24,45,54],[24,46,71],[24,47,88],[24,48,5],[24,49,22],[24,50,39],[24,51,56],[24,52,73],[24,53,90],[24,54,7],[24,55,24],[24,56,41],[24,57,58],[24,58,75],[24,59,92],[24,60,9],[24,61,26],[24,62,43],[24,63,60],[24,64,77],[24,65,94],[24,66,11],[24,67,28],[24,68,45],[24,69,62],[24,70,79],[24,71,96],[24,72,13],[24,73,30],[24,74,47],[24,75,64],[24,76,81],[24,77,98],[24,78,15],[24,79,32],[24,80,49],[24,81,66],[24,82,83],[24,83,100],[24,84,17],[24,85,34],[24,86,51],[24,87,68],[24,88,85],[24,89,2],[24,90,19],[24,91,36],[24,92,53],[24,93,70],[24,94,87],[24,95,4],[24,96,21],[24,97,38],[24,98,55],[24,99,72],[24,100,89],[25,1,43],[25,2,60],[25,3,77],[25,4,94],[25,5,11],[25,6,28],[25,7,45],[25,8,62],[25,9,79],[25,10,96],[25,11,13],[25,12,30],[25,13,47],[25,14,64],[25,15,81],[25,16,98],[25,17,15],[25,18,32],[25,19,49],[25,20,66],[25,21,83],[25,22,100],[25,23,17],[25,26,68],[25,27,85],[25,28,2],[25,29,19],[25,30,36],[25,31,53],[25,32,70],[25,33,87],[25,34,4],[25,35,21],[25,36,38],[25,37,55],[25,38,72],[25,39,89],[25,40,6],[25,41,23],[25,42,40],[25,43,57],[25,44,74],[25,45,91],[25,46,8],[25,47,25],[25,48,42],[25,49,59],[25,50,76],[25,51,93],[25,52,10],[25,53,27],[25,54,44],[25,55,61],[25,56,78],[25,57,95],[25,58,12],[25,59,29],[25,60,46],[25,61,63],[25,62,80],[25,63,97],[25,64,14],[25,65,31],[25,66,48],[25,67,65],[25,68,82],[25,69,99],[25,70,16],[25,71,33],[25,72,50],[25,73,67],[25,74,84],[25,75,1],[25,76,18],[25,77,35],[25,78,52],[25,79,69],[25,80,86],[25,81,3],[25,82,20],[25,83,37],[25,84,54],[25,85,71],[25,86,88],[25,87,5],[25,88,22],[25,89,39],[25,90,56],[25,91,73],[25,92,90],[25,93,7],[25,94,24],[25,95,41],[25,96,58],[25,97,75],[25,98,92],[25,99,9],[25,100,26],[26,1,80],[26,2,97],[26,3,14],[26,4,31],[26,5,48],[26,6,65],[26,7,82],[26,8,99],[26,9,16],[26,10,33],[26,11,50],[26,12,67],[26,13,84],[26,14,1],[26,15,18],[26,16,35],[26,17,52],[26,18,69],[26,19,86],[26,20,3],[26,21,20],[26,22,37],[26,23,54],[26,24,71],[26,27,22],[26,28,39],[26,29,56],[26,30,73],[26,31,90],[26,32,7],[26,33,24],[26,34,41],[26,35,58],[26,36,75],[26,37,92],[26,38,9],[26,39,26],[26,40,43],[26,41,60],[26,42,77],[26,43,94],[26,44,11],[26,45,28],[26,46,45],[26,47,62],[26,48,79],[26,49,96],[26,50,13],[26,51,30],[26,52,47],[26,53,64],[26,54,81],[26,55,98],[26,56,15],[26,57,32],[26,58,49],[26,59,66],[26,60,83],[26,61,100],[26,62,17],[26,63,34],[26,64,51],[26,65,68],[26,66,85],[26,67,2],[26,68,19],[26,69,36],[26,70,53],[26,71,70],[26,72,87],[26,73,4],[26,74,21],[26,75,38],[26,76,55],[26,77,72],[26,78,89],[26,79,6],[26,80,23],[26,81,40],[26,82,57],[26,83,74],[26,84,91],[26,85,8],[26,86,25],[26,87,42],[26,88,59],[26,89,76],[26,90,93],[26,91,10],[26,92,27],[26,93,44],[26,94,61],[26,95,78],[26,96,95],[26,97,12],[26,98,29],[26,99,46],[26,100,63],[27,1,17],[27,2,34],[27,3,51],[27,4,68],[27,5,85],[27,6,2],[27,7,19],[27,8,36],[27,9,53],[27,10,70],[27,11,87],[27,12,4],[27,13,21],[27,14,38],[27,15,55],[27,16,72],[27,17,89],[27,18,6],[27,19,23],[27,20,40],[27,21,57],[27,22,74],[27,23,91],[27,24,8],[27,25,25],[27,28,76],[27,29,93],[27,30,10],[27,31,27],[27,32,44],[27,33,61],[27,34,78],[27,35,95],[27,36,12],[27,37,29],[27,38,46],[27,39,63],[27,40,80],[27,41,97],[27,42,14],[27,43,31],[27,44,48],[27,45,65],[27,46,82],[27,47,99],[27,48,16],[27,49,33],[27,50,50],[27,51,67],[27,52,84],[27,53,1],[27,54,18],[27,55,35],[27,56,52],[27,57,69],[27,58,86],[27,59,3],[27,60,20],[27,61,37],[27,62,54],[27,63,71],[27,64,88],[27,65,5],[27,66,22],[27,67,39],[27,68,56],[27,69,73],[27,70,90],[27,71,7],[27,72,24],[27,73,41],[27,74,58],[27,75,75],[27,76,92],[27,77,9],[27,78,26],[27,79,43],[27,80,60],[27,81,77],[27,82,94],[27,83,11],[27,84,28],[27,85,45],[27,86,62],[27,87,79],[27,88,96],[27,89,13],[27,90,30],[27,91,47],[27,92,64],[27,93,81],[27,94,98],[27,95,15],[27,96,32],[27,97,49],[27,98,66],[27,99,83],[27,100,100],[28,1,54],[28,2,71],[28,3,88],[28,4,5],[28,5,22],[28,6,39],[28,7,56],[28,8,73],[28,9,90],[28,10,7],[28,11,24],[28,12,41],[28,13,58],[28,14,75],[28,15,92],[28,16,9],[28,17,26],[28,18,43],[28,19,60],[28,20,77],[28,21,94],[28,22,11],[28,23,28],[28,24,45],[28,25,62],[28,26,79],[28,29,30],[28,30,47],[28,31,64],[28,32,81],[28,33,98],[28,34,15],[28,35,32],[28,36,49],[28,37,66],[28,38,83],[28,39,100],[28,40,17],[28,41,34],[28,42,51],[28,43,68],[28,44,85],[28,45,2],[28,46,19],[28,47,36],[28,48,53],[28,49,70],[28,50,87],[28,51,4],[28,52,21],[28,53,38],[28,54,55],[28,55,72],[28,56,89],[28,57,6],[28,58,23],[28,59,40],[28,60,57],[28,61,74],[28,62,91],[28,63,8],[28,64,25],[28,65,42],[28,66,59],[28,67,76],[28,68,93],[28,69,10],[28,70,27],[28,71,44],[28,72,61],[28,73,78],[28,74,95],[28,75,12],[28,76,29],[28,77,46],[28,78,63],[28,79,80],[28,80,97],[28,81,14],[28,82,31],[28,83,48],[28,84,65],[28,85,82],[28,86,99],[28,87,16],[28,88,33],[28,89,50],[28,90,67],[28,91,84],[28,92,1],[28,93,18],[28,94,35],[28,95,52],[28,96,69],[28,97,86],[28,98,3],[28,99,20],[28,100,37],[29,1,91],[29,2,8],[29,3,25],[29,4,42],[29,5,59],[29,6,76],[29,7,93],[29,8,10],[29,9,27],[29,10,44],[29,11,61],[29,12,78],[29,13,95],[29,14,12],[29,15,29],[29,16,46],[29,17,63],[29,18,80],[29,19,97],[29,20,14],[29,21,31],[29,22,48],[29,23,65],[29,24,82],[29,25,99],[29,26,16],[29,27,33],[29,30,84],[29,31,1],[29,32,18],[29,33,35],[29,34,52],[29,35,69],[29,36,86],[29,37,3],[29,38,20],[29,39,37],[29,40,54],[29,41,71],[29,42,88],[29,43,5],[29,44,22],[29,45,39],[29,46,56],[29,47,73],[29,48,90],[29,49,7],[29,50,24],[29,51,41],[29,52,58],[29,53,75],[29,54,92],[29,55,9],[29,56,26],[29,57,43],[29,58,60],[29,59,77],[29,60,94],[29,61,11],[29,62,28],[29,63,45],[29,64,62],[29,65,79],[29,66,96],[29,67,13],[29,68,30],[29,69,47],[29,70,64],[29,71,81],[29,72,98],[29,73,15],[29,74,32],[29,75,49],[29,76,66],[29,77,83],[29,78,100],[29,79,17],[29,80,34],[29,81,51],[29,82,68],[29,83,85],[29,84,2],[29,85,19],[29,86,36],[29,87,53],[29,88,70],[29,89,87],[29,90,4],[29,91,21],[29,92,38],[29,93,55],[29,94,72],[29,95,89],[29,96,6],[29,97,23],[29,98,40],[29,99,57],[29,100,74],[30,1,28],[30,2,45],[30,3,62],[30,4,79],[30,5,96],[30,6,13],[30,7,30],[30,8,47],[30,9,64],[30,10,81],[30,11,98],[30,12,15],[30,13,32],[30,14,49],[30,15,66],[30,16,83],[30,17,100],[30,18,17],[30,19,34],[30,20,51],[30,21,68],[30,22,85],[30,23,2],[30,24,19],[30,25,36],[30,26,53],[30,27,70],[30,28,87],[30,31,38],[30,32,55],[30,33,72],[30,34,89],[30,35,6],[30,36,23],[30,37,40],[30,38,57],[30,39,74],[30,40,91],[30,41,8],[30,42,25],[30,43,42],[30,44,59],[30,45,76],[30,46,93],[30,47,10],[30,48,27],[30,49,44],[30,50,61],[30,51,78],[30,52,95],[30,53,12],[30,54,29],[30,55,46],[30,56,63],[30,57,80],[30,58,97],[30,59,14],[30,60,31],[30,61,48],[30,62,65],[30,63,82],[30,64,99],[30,65,16],[30,66,33],[30,67,50],[30,68,67],[30,69,84],[30,70,1],[30,71,18],[30,72,35],[30,73,52],[30,74,69],[30,75,86],[30,76,3],[30,77,20],[30,78,37],[30,79,54],[30,80,71],[30,81,88],[30,82,5],[30,83,22],[30,84,39],[30,85,56],[30,86,73],[30,87,90],[30,88,7],[30,89,24],[30,90,41],[30,91,58],[30,92,75],[30,93,92],[30,94,9],[30,95,26],[30,96,43],[30,97,60],[30,98,77],[30,99,94],[30,100,11],[31,1,65],[31,2,82],[31,3,99],[31,4,16],[31,5,33],[31,6,50],[31,7,67],[31,8,84],[31,9,1],[31,10,18],[31,11,35],[31,12,52],[31,13,69],[31,14,86],[31,15,3],[31,16,20],[31,17,37],[31,18,54],[31,19,71],[31,20,88],[31,21,5],[31,22,22],[31,23,39],[31,24,56],[31,25,73],[31,26,90],[31,27,7],[31,28,24],[31,29,41],[31,32,92],[31,33,9],[31,34,26],[31,35,43],[31,36,60],[31,37,77],[31,38,94],[31,39,11],[31,40,28],[31,41,45],[31,42,62],[31,43,79],[31,44,96],[31,45,13],[31,46,30],[31,47,47],[31,48,64],[31,49,81],[31,50,98],[31,51,15],[31,52,32],[31,53,49],[31,54,66],[31,55,83],[31,56,100],[31,57,17],[31,58,34],[31,59,51],[31,60,68],[31,61,85],[31,62,2],[31,63,19],[31,64,36],[31,65,53],[31,66,70],[31,67,87],[31,68,4],[31,69,21],[31,70,38],[31,71,55],[31,72,72],[31,73,89],[31,74,6],[31,75,23],[31,76,40],[31,77,57],[31,78,74],[31,79,91],[31,80,8],[31,81,25],[31,82,42],[31,83,59],[31,84,76],[31,85,93],[31,86,10],[31,87,27],[31,88,44],[31,89,61],[31,90,78],[31,91,95],[31,92,12],[31,93,29],[31,94,46],[31,95,63],[31,96,80],[31,97,97],[31,98,14],[31,99,31],[31,100,48],[32,1,2],[32,2,19],[32,3,36],[32,4,53],[32,5,70],[32,6,87],[32,7,4],[32,8,21],[32,9,38],[32,10,55],[32,11,72],[32,12,89],[32,13,6],[32,14,23],[32,15,40],[32,16,57],[32,17,74],[32,18,91],[32,19,8],[32,20,25],[32,21,42],[32,22,59],[32,23,76],[32,24,93],[32,25,10],[32,26,27],[32,27,44],[32,28,61],[32,29,78],[32,30,95],[32,33,46],[32,34,63],[32,35,80],[32,36,97],[32,37,14],[32,38,31],[32,39,48],[32,40,65],[32,41,82],[32,42,99],[32,43,16],[32,44,33],[32,45,50],[32,46,67],[32,47,84],[32,48,1],[32,49,18],[32,50,35],[32,51,52],[32,52,69],[32,53,86],[32,54,3],[32,55,20],[32,56,37],[32,57,54],[32,58,71],[32,59,88],[32,60,5],[32,61,22],[32,62,39],[32,63,56],[32,64,73],[32,65,90],[32,66,7],[32,67,24],[32,68,41],[32,69,58],[32,70,75],[32,71,92],[32,72,9],[32,73,26],[32,74,43],[32,75,60],[32,76,77],[32,77,94],[32,78,11],[32,79,28],[32,80,45],[32,81,62],[32,82,79],[32,83,96],[32,84,13],[32,85,30],[32,86,47],[32,87,64],[32,88,81],[32,89,98],[32,90,15],[32,91,32],[32,92,49],[32,93,66],[32,94,83],[32,95,100],[32,96,17],[32,97,34],[32,98,51],[32,99,68],[32,100,85],[33,1,39],[33,2,56],[33,3,73],[33,4,90],[33,5,7],[33,6,24],[33,7,41],[33,8,58],[33,9,75],[33,10,92],[33,11,9],[33,12,26],[33,13,43],[33,14,60],[33,15,77],[33,16,94],[33,17,11],[33,18,28],[33,19,45],[33,20,62],[33,21,79],[33,22,96],[33,23,13],[33,24,30],[33,25,47],[33,26,64],[33,27,81],[33,28,98],[33,29,15],[33,30,32],[33,31,49],[33,34,100],[33,35,17],[33,36,34],[33,37,51],[33,38,68],[33,39,85],[33,40,2],[33,41,19],[33,42,36],[33,43,53],[33,44,70],[33,45,87],[33,46,4],[33,47,21],[33,48,38],[33,49,55],[33,50,72],[33,51,89],[33,52,6],[33,53,23],[33,54,40],[33,55,57],[33,56,74],[33,57,91],[33,58,8],[33,59,25],[33,60,42],[33,61,59],[33,62,76],[33,63,93],[33,64,10],[33,65,27],[33,66,44],[33,67,61],[33,68,78],[33,69,95],[33,70,12],[33,71,29],[33,72,46],[33,73,63],[33,74,80],[33,75,97],[33,76,14],[33,77,31],[33,78,48],[33,79,65],[33,80,82],[33,81,99],[33,82,16],[33,83,33],[33,84,50],[33,85,67],[33,86,84],[33,87,1],[33,88,18],[33,89,35],[33,90,52],[33,91,69],[33,92,86],[33,93,3],[33,94,20],[33,95,37],[33,96,54],[33,97,71],[33,98,88],[33,99,5],[33,100,22],[34,1,76],[34,2,93],[34,3,10],[34,4,27],[34,5,44],[34,6,61],[34,7,78],[34,8,95],[34,9,12],[34,10,29],[34,11,46],[34,12,63],[34,13,80],[34,14,97],[34,15,14],[34,16,31],[34,17,48],[34,18,65],[34,19,82],[34,20,99],[34,21,16],[34,22,33],[34,23,50],[34,24,67],[34,25,84],[34,26,1],[34,27,18],[34,28,35],[34,29,52],[34,30,69],[34,31,86],[34,32,3],[34,35,54],[34,36,71],[34,37,88],[34,38,5],[34,39,22],[34,40,39],[34,41,56],[34,42,73],[34,43,90],[34,44,7],[34,45,24],[34,46,41],[34,47,58],[34,48,75],[34,49,92],[34,50,9],[34,51,26],[34,52,43],[34,53,60],[34,54,77],[34,55,94],[34,56,11],[34,57,28],[34,58,45],[34,59,62],[34,60,79],[34,61,96],[34,62,13],[34,63,30],[34,64,47],[34,65,64],[34,66,81],[34,67,98],[34,68,15],[34,69,32],[34,70,49],[34,71,66],[34,72,83],[34,73,100],[34,74,17],[34,75,34],[34,76,51],[34,77,68],[34,78,85],[34,79,2],[34,80,19],[34,81,36],[34,82,53],[34,83,70],[34,84,87],[34,85,4],[34,86,21],[34,87,38],[34,88,55],[34,89,72],[34,90,89],[34,91,6],[34,92,23],[34,93,40],[34,94,57],[34,95,74],[34,96,91],[34,97,8],[34,98,25],[34,99,42],[34,100,59],[35,1,13],[35,2,30],[35,3,47],[35,4,64],[35,5,81],[35,6,98],[35,7,15],[35,8,32],[35,9,49],[35,10,66],[35,11,83],[35,12,100],[35,13,17],[35,14,34],[35,15,51],[35,16,68],[35,17,85],[35,18,2],[35,19,19],[35,20,36],[35,21,53],[35,22,70],[35,23,87],[35,24,4],[35,25,21],[35,26,38],[35,27,55],[35,28,72],[35,29,89],[35,30,6],[35,31,23],[35,32,40],[35,33,57],[35,36,8],[35,37,25],[35,38,42],[35,39,59],[35,40,76],[35,41,93],[35,42,10],[35,43,27],[35,44,44],[35,45,61],[35,46,78],[35,47,95],[35,48,12],[35,49,29],[35,50,46],[35,51,63],[35,52,80],[35,53,97],[35,54,14],[35,55,31],[35,56,48],[35,57,65],[35,58,82],[35,59,99],[35,60,16],[35,61,33],[35,62,50],[35,63,67],[35,64,84],[35,65,1],[35,66,18],[35,67,35],[35,68,52],[35,69,69],[35,70,86],[35,71,3],[35,72,20],[35,73,37],[35,74,54],[35,75,71],[35,76,88],[35,77,5],[35,78,22],[35,79,39],[35,80,56],[35,81,73],[35,82,90],[35,83,7],[35,84,24],[35,85,41],[35,86,58],[35,87,75],[35,88,92],[35,89,9],[35,90,26],[35,91,43],[35,92,60],[35,93,77],[35,94,94],[35,95,11],[35,96,28],[35,97,45],[35,98,62],[35,99,79],[35,100,96],[36,1,50],[36,2,67],[36,3,84],[36,4,1],[36,5,18],[36,6,35],[36,7,52],[36,8,69],[36,9,86],[36,10,3],[36,11,20],[36,12,37],[36,13,54],[36,14,71],[36,15,88],[36,16,5],[36,17,22],[36,18,39],[36,19,56],[36,20,73],[36,21,90],[36,22,7],[36,23,24],[36,24,41],[36,25,58],[36,26,75],[36,27,92],[36,28,9],[36,29,26],[36,30,43],[36,31,60],[36,32,77],[36,33,94],[36,34,11],[36,37,62],[36,38,79],[36,39,96],[36,40,13],[36,41,30],[36,42,47],[36,43,64],[36,44,81],[36,45,98],[36,46,15],[36,47,32],[36,48,49],[36,49,66],[36,50,83],[36,51,100],[36,52,17],[36,53,34],[36,54,51],[36,55,68],[36,56,85],[36,57,2],[36,58,19],[36,59,36],[36,60,53],[36,61,70],[36,62,87],[36,63,4],[36,64,21],[36,65,38],[36,66,55],[36,67,72],[36,68,89],[36,69,6],[36,70,23],[36,71,40],[36,72,57],[36,73,74],[36,74,91],[36,75,8],[36,76,25],[36,77,42],[36,78,59],[36,79,76],[36,80,93],[36,81,10],[36,82,27],[36,83,44],[36,84,61],[36,85,78],[36,86,95],[36,87,12],[36,88,29],[36,89,46],[36,90,63],[36,91,80],[36,92,97],[36,93,14],[36,94,31],[36,95,48],[36,96,65],[36,97,82],[36,98,99],[36,99,16],[36,100,33],[37,1,87],[37,2,4],[37,3,21],[37,4,38],[37,5,55],[37,6,72],[37,7,89],[37,8,6],[37,9,23],[37,10,40],[37,11,57],[37,12,74],[37,13,91],[37,14,8],[37,15,25],[37,16,42],[37,17,59],[37,18,76],[37,19,93],[37,20,10],[37,21,27],[37,22,44],[37,23,61],[37,24,78],[37,25,95],[37,26,12],[37,27,29],[37,28,46],[37,29,63],[37,30,80],[37,31,97],[37,32,14],[37,33,31],[37,34,48],[37,35,65],[37,38,16],[37,39,33],[37,40,50],[37,41,67],[37,42,84],[37,43,1],[37,44,18],[37,45,35],[37,46,52],[37,47,69],[37,48,86],[37,49,3],[37,50,20],[37,51,37],[37,52,54],[37,53,71],[37,54,88],[37,55,5],[37,56,22],[37,57,39],[37,58,56],[37,59,73],[37,60,90],[37,61,7],[37,62,24],[37,63,41],[37,64,58],[37,65,75],[37,66,92],[37,67,9],[37,68,26],[37,69,43],[37,70,60],[37,71,77],[37,72,94],[37,73,11],[37,74,28],[37,75,45],[37,76,62],[37,77,79],[37,78,96],[37,79,13],[37,80,30],[37,81,47],[37,82,64],[37,83,81],[37,84,98],[37,85,15],[37,86,32],[37,87,49],[37,88,66],[37,89,83],[37,90,100],[37,91,17],[37,92,34],[37,93,51],[37,94,68],[37,95,85],[37,96,2],[37,97,19],[37,98,36],[37,99,53],[37,100,70],[38,1,24],[38,2,41],[38,3,58],[38,4,75],[38,5,92],[38,6,9],[38,7,26],[38,8,43],[38,9,60],[38,10,77],[38,11,94],[38,12,11],[38,13,28],[38,14,45],[38,15,62],[38,16,79],[38,17,96],[38,18,13],[38,19,30],[38,20,47],[38,21,64],[38,22,81],[38,23,98],[38,24,15],[38,25,32],[38,26,49],[38,27,66],[38,28,83],[38,29,100],[38,30,17],[38,31,34],[38,32,51],[38,33,68],[38,34,85],[38,35,2],[38,36,19],[38,39,70],[38,40,87],[38,41,4],[38,42,21],[38,43,38],[38,44,55],[38,45,72],[38,46,89],[38,47,6],[38,48,23],[38,49,40],[38,50,57],[38,51,74],[38,52,91],[38,53,8],[38,54,25],[38,55,42],[38,56,59],[38,57,76],[38,58,93],[38,59,10],[38,60,27],[38,61,44],[38,62,61],[38,63,78],[38,64,95],[38,65,12],[38,66,29],[38,67,46],[38,68,63],[38,69,80],[38,70,97],[38,71,14],[38,72,31],[38,73,48],[38,74,65],[38,75,82],[38,76,99],[38,77,16],[38,78,33],[38,79,50],[38,80,67],[38,81,84],[38,82,1],[38,83,18],[38,84,35],[38,85,52],[38,86,69],[38,87,86],[38,88,3],[38,89,20],[38,90,37],[38,91,54],[38,92,71],[38,93,88],[38,94,5],[38,95,22],[38,96,39],[38,97,56],[38,98,73],[38,99,90],[38,100,7],[39,1,61],[39,2,78],[39,3,95],[39,4,12],[39,5,29],[39,6,46],[39,7,63],[39,8,80],[39,9,97],[39,10,14],[39,11,31],[39,12,48],[39,13,65],[39,14,82],[39,15,99],[39,16,16],[39,17,33],[39,18,50],[39,19,67],[39,20,84],[39,21,1],[39,22,18],[39,23,35],[39,24,52],[39,25,69],[39,26,86],[39,27,3],[39,28,20],[39,29,37],[39,30,54],[39,31,71],[39,32,88],[39,33,5],[39,34,22],[39,35,39],[39,36,56],[39,37,73],[39,40,24],[39,41,41],[39,42,58],[39,43,75],[39,44,92],[39,45,9],[39,46,26],[39,47,43],[39,48,60],[39,49,77],[39,50,94],[39,51,11],[39,52,28],[39,53,45],[39,54,62],[39,55,79],[39,56,96],[39,57,13],[39,58,30],[39,59,47],[39,60,64],[39,61,81],[39,62,98],[39,63,15],[39,64,32],[39,65,49],[39,66,66],[39,67,83],[39,68,100],[39,69,17],[39,70,34],[39,71,51],[39,72,68],[39,73,85],[39,74,2],[39,75,19],[39,76,36],[39,77,53],[39,78,70],[39,79,87],[39,80,4],[39,81,21],[39,82,38],[39,83,55],[39,84,72],[39,85,89],[39,86,6],[39,87,23],[39,88,40],[39,89,57],[39,90,74],[39,91,91],[39,92,8],[39,93,25],[39,94,42],[39,95,59],[39,96,76],[39,97,93],[39,98,10],[39,99,27],[39,100,44],[40,1,98],[40,2,15],[40,3,32],[40,4,49],[40,5,66],[40,6,83],[40,7,100],[40,8,17],[40,9,34],[40,10,51],[40,11,68],[40,12,85],[40,13,2],[40,14,19],[40,15,36],[40,16,53],[40,17,70],[40,18,87],[40,19,4],[40,20,21],[40,21,38],[40,22,55],[40,23,72],[40,24,89],[40,25,6],[40,26,23],[40,27,40],[40,28,57],[40,29,74],[40,30,91],[40,31,8],[40,32,25],[40,33,42],[40,34,59],[40,35,76],[40,36,93],[40,37,10],[40,38,27],[40,41,78],[40,42,95],[40,43,12],[40,44,29],[40,45,46],[40,46,63],[40,47,80],[40,48,97],[40,49,14],[40,50,31],[40,51,48],[40,52,65],[40,53,82],[40,54,99],[40,55,16],[40,56,33],[40,57,50],[40,58,67],[40,59,84],[40,60,1],[40,61,18],[40,62,35],[40,63,52],[40,64,69],[40,65,86],[40,66,3],[40,67,20],[40,68,37],[40,69,54],[40,70,71],[40,71,88],[40,72,5],[40,73,22],[40,74,39],[40,75,56],[40,76,73],[40,77,90],[40,78,7],[40,79,24],[40,80,41],[40,81,58],[40,82,75],[40,83,92],[40,84,9],[40,85,26],[40,86,43],[40,87,60],[40,88,77],[40,89,94],[40,90,11],[40,91,28],[40,92,45],[40,93,62],[40,94,79],[40,95,96],[40,96,13],[40,97,30],[40,98,47],[40,99,64],[40,100,81],[41,1,35],[41,2,52],[41,3,69],[41,4,86],[41,5,3],[41,6,20],[41,7,37],[41,8,54],[41,9,71],[41,10,88],[41,11,5],[41,12,22],[41,13,39],[41,14,56],[41,15,73],[41,16,90],[41,17,7],[41,18,24],[41,19,41],[41,20,58],[41,21,75],[41,22,92],[41,23,9],[41,24,26],[41,25,43],[41,26,60],[41,27,77],[41,28,94],[41,29,11],[41,30,28],[41,31,45],[41,32,62],[41,33,79],[41,34,96],[41,35,13],[41,36,30],[41,37,47],[41,38,64],[41,39,81],[41,42,32],[41,43,49],[41,44,66],[41,45,83],[41,46,100],[41,47,17],[41,48,34],[41,49,51],[41,50,68],[41,51,85],[41,52,2],[41,53,19],[41,54,36],[41,55,53],[41,56,70],[41,57,87],[41,58,4],[41,59,21],[41,60,38],[41,61,55],[41,62,72],[41,63,89],[41,64,6],[41,65,23],[41,66,40],[41,67,57],[41,68,74],[41,69,91],[41,70,8],[41,71,25],[41,72,42],[41,73,59],[41,74,76],[41,75,93],[41,76,10],[41,77,27],[41,78,44],[41,79,61],[41,80,78],[41,81,95],[41,82,12],[41,83,29],[41,84,46],[41,85,63],[41,86,80],[41,87,97],[41,88,14],[41,89,31],[41,90,48],[41,91,65],[41,92,82],[41,93,99],[41,94,16],[41,95,33],[41,96,50],[41,97,67],[41,98,84],[41,99,1],[41,100,18],[42,1,72],[42,2,89],[42,3,6],[42,4,23],[42,5,40],[42,6,57],[42,7,74],[42,8,91],[42,9,8],[42,10,25],[42,11,42],[42,12,59],[42,13,76],[42,14,93],[42,15,10],[42,16,27],[42,17,44],[42,18,61],[42,19,78],[42,20,95],[42,21,12],[42,22,29],[42,23,46],[42,24,63],[42,25,80],[42,26,97],[42,27,14],[42,28,31],[42,29,48],[42,30,65],[42,31,82],[42,32,99],[42,33,16],[42,34,33],[42,35,50],[42,36,67],[42,37,84],[42,38,1],[42,39,18],[42,40,35],[42,43,86],[42,44,3],[42,45,20],[42,46,37],[42,47,54],[42,48,71],[42,49,88],[42,50,5],[42,51,22],[42,52,39],[42,53,56],[42,54,73],[42,55,90],[42,56,7],[42,57,24],[42,58,41],[42,59,58],[42,60,75],[42,61,92],[42,62,9],[42,63,26],[42,64,43],[42,65,60],[42,66,77],[42,67,94],[42,68,11],[42,69,28],[42,70,45],[42,71,62],[42,72,79],[42,73,96],[42,74,13],[42,75,30],[42,76,47],[42,77,64],[42,78,81],[42,79,98],[42,80,15],[42,81,32],[42,82,49],[42,83,66],[42,84,83],[42,85,100],[42,86,17],[42,87,34],[42,88,51],[42,89,68],[42,90,85],[42,91,2],[42,92,19],[42,93,36],[42,94,53],[42,95,70],[42,96,87],[42,97,4],[42,98,21],[42,99,38],[42,100,55],[43,1,9],[43,2,26],[43,3,43],[43,4,60],[43,5,77],[43,6,94],[43,7,11],[43,8,28],[43,9,45],[43,10,62],[43,11,79],[43,12,96],[43,13,13],[43,14,30],[43,15,47],[43,16,64],[43,17,81],[43,18,98],[43,19,15],[43,20,32],[43,21,49],[43,22,66],[43,23,83],[43,24,100],[43,25,17],[43,26,34],[43,27,51],[43,28,68],[43,29,85],[43,30,2],[43,31,19],[43,32,36],[43,33,53],[43,34,70],[43,35,87],[43,36,4],[43,37,21],[43,38,38],[43,39,55],[43,40,72],[43,41,89],[43,44,40],[43,45,57],[43,46,74],[43,47,91],[43,48,8],[43,49,25],[43,50,42],[43,51,59],[43,52,76],[43,53,93],[43,54,10],[43,55,27],[43,56,44],[43,57,61],[43,58,78],[43,59,95],[43,60,12],[43,61,29],[43,62,46],[43,63,63],[43,64,80],[43,65,97],[43,66,14],[43,67,31],[43,68,48],[43,69,65],[43,70,82],[43,71,99],[43,72,16],[43,73,33],[43,74,50],[43,75,67],[43,76,84],[43,77,1],[43,78,18],[43,79,35],[43,80,52],[43,81,69],[43,82,86],[43,83,3],[43,84,20],[43,85,37],[43,86,54],[43,87,71],[43,88,88],[43,89,5],[43,90,22],[43,91,39],[43,92,56],[43,93,73],[43,94,90],[43,95,7],[43,96,24],[43,97,41],[43,98,58],[43,99,75],[43,100,92],[44,1,46],[44,2,63],[44,3,80],[44,4,97],[44,5,14],[44,6,31],[44,7,48],[44,8,65],[44,9,82],[44,10,99],[44,11,16],[44,12,33],[44,13,50],[44,14,67],[44,15,84],[44,16,1],[44,17,18],[44,18,35],[44,19,52],[44,20,69],[44,21,86],[44,22,3],[44,23,20],[44,24,37],[44,25,54],[44,26,71],[44,27,88],[44,28,5],[44,29,22],[44,30,39],[44,31,56],[44,32,73],[44,33,90],[44,34,7],[44,35,24],[44,36,41],[44,37,58],[44,38,75],[44,39,92],[44,40,9],[44,41,26],[44,42,43],[44,45,94],[44,46,11],[44,47,28],[44,48,45],[44,49,62],[44,50,79],[44,51,96],[44,52,13],[44,53,30],[44,54,47],[44,55,64],[44,56,81],[44,57,98],[44,58,15],[44,59,32],[44,60,49],[44,61,66],[44,62,83],[44,63,100],[44,64,17],[44,65,34],[44,66,51],[44,67,68],[44,68,85],[44,69,2],[44,70,19],[44,71,36],[44,72,53],[44,73,70],[44,74,87],[44,75,4],[44,76,21],[44,77,38],[44,78,55],[44,79,72],[44,80,89],[44,81,6],[44,82,23],[44,83,40],[44,84,57],[44,85,74],[44,86,91],[44,87,8],[44,88,25],[44,89,42],[44,90,59],[44,91,76],[44,92,93],[44,93,10],[44,94,27],[44,95,44],[44,96,61],[44,97,78],[44,98,95],[44,99,12],[44,100,29],[45,1,83],[45,2,100],[45,3,17],[45,4,34],[45,5,51],[45,6,68],[45,7,85],[45,8,2],[45,9,19],[45,10,36],[45,11,53],[45,12,70],[45,13,87],[45,14,4],[45,15,21],[45,16,38],[45,17,55],[45,18,72],[45,19,89],[45,20,6],[45,21,23],[45,22,40],[45,23,57],[45,24,74],[45,25,91],[45,26,8],[45,27,25],[45,28,42],[45,29,59],[45,30,76],[45,31,93],[45,32,10],[45,33,27],[45,34,44],[45,35,61],[45,36,78],[45,37,95],[45,38,12],[45,39,29],[45,40,46],[45,41,63],[45,42,80],[45,43,97],[45,46,48],[45,47,65],[45,48,82],[45,49,99],[45,50,16],[45,51,33],[45,52,50],[45,53,67],[45,54,84],[45,55,1],[45,56,18],[45,57,35],[45,58,52],[45,59,69],[45,60,86],[45,61,3],[45,62,20],[45,63,37],[45,64,54],[45,65,71],[45,66,88],[45,67,5],[45,68,22],[45,69,39],[45,70,56],[45,71,73],[45,72,90],[45,73,7],[45,74,24],[45,75,41],[45,76,58],[45,77,75],[45,78,92],[45,79,9],[45,80,26],[45,81,43],[45,82,60],[45,83,77],[45,84,94],[45,85,11],[45,86,28],[45,87,45],[45,88,62],[45,89,79],[45,90,96],[45,91,13],[45,92,30],[45,93,47],[45,94,64],[45,95,81],[45,96,98],[45,97,15],[45,98,32],[45,99,49],[45,100,66],[46,1,20],[46,2,37],[46,3,54],[46,4,71],[46,5,88],[46,6,5],[46,7,22],[46,8,39],[46,9,56],[46,10,73],[46,11,90],[46,12,7],[46,13,24],[46,14,41],[46,15,58],[46,16,75],[46,17,92],[46,18,9],[46,19,26],[46,20,43],[46,21,60],[46,22,77],[46,23,94],[46,24,11],[46,25,28],[46,26,45],[46,27,62],[46,28,79],[46,29,96],[46,30,13],[46,31,30],[46,32,47],[46,33,64],[46,34,81],[46,35,98],[46,36,15],[46,37,32],[46,38,49],[46,39,66],[46,40,83],[46,41,100],[46,42,17],[46,43,34],[46,44,51],[46,47,2],[46,48,19],[46,49,36],[46,50,53],[46,51,70],[46,52,87],[46,53,4],[46,54,21],[46,55,38],[46,56,55],[46,57,72],[46,58,89],[46,59,6],[46,60,23],[46,61,40],[46,62,57],[46,63,74],[46,64,91],[46,65,8],[46,66,25],[46,67,42],[46,68,59],[46,69,76],[46,70,93],[46,71,10],[46,72,27],[46,73,44],[46,74,61],[46,75,78],[46,76,95],[46,77,12],[46,78,29],[46,79,46],[46,80,63],[46,81,80],[46,82,97],[46,83,14],[46,84,31],[46,85,48],[46,86,65],[46,87,82],[46,88,99],[46,89,16],[46,90,33],[46,91,50],[46,92,67],[46,93,84],[46,94,1],[46,95,18],[46,96,35],[46,97,52],[46,98,69],[46,99,86],[46,100,3],[47,1,57],[47,2,74],[47,3,91],[47,4,8],[47,5,25],[47,6,42],[47,7,59],[47,8,76],[47,9,93],[47,10,10],[47,11,27],[47,12,44],[47,13,61],[47,14,78],[47,15,95],[47,16,12],[47,17,29],[47,18,46],[47,19,63],[47,20,80],[47,21,97],[47,22,14],[47,23,31],[47,24,48],[47,25,65],[47,26,82],[47,27,99],[47,28,16],[47,29,33],[47,30,50],[47,31,67],[47,32,84],[47,33,1],[47,34,18],[47,35,35],[47,36,52],[47,37,69],[47,38,86],[47,39,3],[47,40,20],[47,41,37],[47,42,54],[47,43,71],[47,44,88],[47,45,5],[47,48,56],[47,49,73],[47,50,90],[47,51,7],[47,52,24],[47,53,41],[47,54,58],[47,55,75],[47,56,92],[47,57,9],[47,58,26],[47,59,43],[47,60,60],[47,61,77],[47,62,94],[47,63,11],[47,64,28],[47,65,45],[47,66,62],[47,67,79],[47,68,96],[47,69,13],[47,70,30],[47,71,47],[47,72,64],[47,73,81],[47,74,98],[47,75,15],[47,76,32],[47,77,49],[47,78,66],[47,79,83],[47,80,100],[47,81,17],[47,82,34],[47,83,51],[47,84,68],[47,85,85],[47,86,2],[47,87,19],[47,88,36],[47,89,53],[47,90,70],[47,91,87],[47,92,4],[47,93,21],[47,94,38],[47,95,55],[47,96,72],[47,97,89],[47,98,6],[47,99,23],[47,100,40],[48,1,94],[48,2,11],[48,3,28],[48,4,45],[48,5,62],[48,6,79],[48,7,96],[48,8,13],[48,9,30],[48,10,47],[48,11,64],[48,12,81],[48,13,98],[48,14,15],[48,15,32],[48,16,49],[48,17,66],[48,18,83],[48,19,100],[48,20,17],[48,21,34],[48,22,51],[48,23,68],[48,24,85],[48,25,2],[48,26,19],[48,27,36],[48,28,53],[48,29,70],[48,30,87],[48,31,4],[48,32,21],[48,33,38],[48,34,55],[48,35,72],[48,36,89],[48,37,6],[48,38,23],[48,39,40],[48,40,57],[48,41,74],[48,42,91],[48,43,8],[48,44,25],[48,45,42],[48,46,59],[48,49,10],[48,50,27],[48,51,44],[48,52,61],[48,53,78],[48,54,95],[48,55,12],[48,56,29],[48,57,46],[48,58,63],[48,59,80],[48,60,97],[48,61,14],[48,62,31],[48,63,48],[48,64,65],[48,65,82],[48,66,99],[48,67,16],[48,68,33],[48,69,50],[48,70,67],[48,71,84],[48,72,1],[48,73,18],[48,74,35],[48,75,52],[48,76,69],[48,77,86],[48,78,3],[48,79,20],[48,80,37],[48,81,54],[48,82,71],[48,83,88],[48,84,5],[48,85,22],[48,86,39],[48,87,56],[48,88,73],[48,89,90],[48,90,7],[48,91,24],[48,92,41],[48,93,58],[48,94,75],[48,95,92],[48,96,9],[48,97,26],[48,98,43],[48,99,60],[48,100,77],[49,1,31],[49,2,48],[49,3,65],[49,4,82],[49,5,99],[49,6,16],[49,7,33],[49,8,50],[49,9,67],[49,10,84],[49,11,1],[49,12,18],[49,13,35],[49,14,52],[49,15,69],[49,16,86],[49,17,3],[49,18,20],[49,19,37],[49,20,54],[49,21,71],[49,22,88],[49,23,5],[49,24,22],[49,25,39],[49,26,56],[49,27,73],[49,28,90],[49,29,7],[49,30,24],[49,31,41],[49,32,58],[49,33,75],[49,34,92],[49,35,9],[49,36,26],[49,37,43],[49,38,60],[49,39,77],[49,40,94],[49,41,11],[49,42,28],[49,43,45],[49,44,62],[49,45,79],[49,46,96],[49,47,13],[49,50,64],[49,51,81],[49,52,98],[49,53,15],[49,54,32],[49,55,49],[49,56,66],[49,57,83],[49,58,100],[49,59,17],[49,60,34],[49,61,51],[49,62,68],[49,63,85],[49,64,2],[49,65,19],[49,66,36],[49,67,53],[49,68,70],[49,69,87],[49,70,4],[49,71,21],[49,72,38],[49,73,55],[49,74,72],[49,75,89],[49,76,6],[49,77,23],[49,78,40],[49,79,57],[49,80,74],[49,81,91],[49,82,8],[49,83,25],[49,84,42],[49,85,59],[49,86,76],[49,87,93],[49,88,10],[49,89,27],[49,90,44],[49,91,61],[49,92,78],[49,93,95],[49,94,12],[49,95,29],[49,96,46],[49,97,63],[49,98,80],[49,99,97],[49,100,14],[50,1,68],[50,2,85],[50,3,2],[50,4,19],[50,5,36],[50,6,53],[50,7,70],[50,8,87],[50,9,4],[50,10,21],[50,11,38],[50,12,55],[50,13,72],[50,14,89],[50,15,6],[50,16,23],[50,17,40],[50,18,57],[50,19,74],[50,20,91],[50,21,8],[50,22,25],[50,23,42],[50,24,59],[50,25,76],[50,26,93],[50,27,10],[50,28,27],[50,29,44],[50,30,61],[50,31,78],[50,32,95],[50,33,12],[50,34,29],[50,35,46],[50,36,63],[50,37,80],[50,38,97],[50,39,14],[50,40,31],[50,41,48],[50,42,65],[50,43,82],[50,44,99],[50,45,16],[50,46,33],[50,47,50],[50,48,67],[50,51,18],[50,52,35],[50,53,52],[50,54,69],[50,55,86],[50,56,3],[50,57,20],[50,58,37],[50,59,54],[50,60,71],[50,61,88],[50,62,5],[50,63,22],[50,64,39],[50,65,56],[50,66,73],[50,67,90],[50,68,7],[50,69,24],[50,70,41],[50,71,58],[50,72,75],[50,73,92],[50,74,9],[50,75,26],[50,76,43],[50,77,60],[50,78,77],[50,79,94],[50,80,11],[50,81,28],[50,82,45],[50,83,62],[50,84,79],[50,85,96],[50,86,13],[50,87,30],[50,88,47],[50,89,64],[50,90,81],[50,91,98],[50,92,15],[50,93,32],[50,94,49],[50,95,66],[50,96,83],[50,97,100],[50,98,17],[50,99,34],[50,100,51],[51,1,5],[51,2,22],[51,3,39],[51,4,56],[51,5,73],[51,6,90],[51,7,7],[51,8,24],[51,9,41],[51,10,58],[51,11,75],[51,12,92],[51,13,9],[51,14,26],[51,15,43],[51,16,60],[51,17,77],[51,18,94],[51,19,11],[51,20,28],[51,21,45],[51,22,62],[51,23,79],[51,24,96],[51,25,13],[51,26,30],[51,27,47],[51,28,64],[51,29,81],[51,30,98],[51,31,15],[51,32,32],[51,33,49],[51,34,66],[51,35,83],[51,36,100],[51,37,17],[51,38,34],[51,39,51],[51,40,68],[51,41,85],[51,42,2],[51,43,19],[51,44,36],[51,45,53],[51,46,70],[51,47,87],[51,48,4],[51,49,21],[51,52,72],[51,53,89],[51,54,6],[51,55,23],[51,56,40],[51,57,57],[51,58,74],[51,59,91],[51,60,8],[51,61,25],[51,62,42],[51,63,59],[51,64,76],[51,65,93],[51,66,10],[51,67,27],[51,68,44],[51,69,61],[51,70,78],[51,71,95],[51,72,12],[51,73,29],[51,74,46],[51,75,63],[51,76,80],[51,77,97],[51,78,14],[51,79,31],[51,80,48],[51,81,65],[51,82,82],[51,83,99],[51,84,16],[51,85,33],[51,86,50],[51,87,67],[51,88,84],[51,89,1],[51,90,18],[51,91,35],[51,92,52],[51,93,69],[51,94,86],[51,95,3],[51,96,20],[51,97,37],[51,98,54],[51,99,71],[51,100,88],[52,1,42],[52,2,59],[52,3,76],[52,4,93],[52,5,10],[52,6,27],[52,7,44],[52,8,61],[52,9,78],[52,10,95],[52,11,12],[52,12,29],[52,13,46],[52,14,63],[52,15,80],[52,16,97],[52,17,14],[52,18,31],[52,19,48],[52,20,65],[52,21,82],[52,22,99],[52,23,16],[52,24,33],[52,25,50],[52,26,67],[52,27,84],[52,28,1],[52,29,18],[52,30,35],[52,31,52],[52,32,69],[52,33,86],[52,34,3],[52,35,20],[52,36,37],[52,37,54],[52,38,71],[52,39,88],[52,40,5],[52,41,22],[52,42,39],[52,43,56],[52,44,73],[52,45,90],[52,46,7],[52,47,24],[52,48,41],[52,49,58],[52,50,75],[52,53,26],[52,54,43],[52,55,60],[52,56,77],[52,57,94],[52,58,11],[52,59,28],[52,60,45],[52,61,62],[52,62,79],[52,63,96],[52,64,13],[52,65,30],[52,66,47],[52,67,64],[52,68,81],[52,69,98],[52,70,15],[52,71,32],[52,72,49],[52,73,66],[52,74,83],[52,75,100],[52,76,17],[52,77,34],[52,78,51],[52,79,68],[52,80,85],[52,81,2],[52,82,19],[52,83,36],[52,84,53],[52,85,70],[52,86,87],[52,87,4],[52,88,21],[52,89,38],[52,90,55],[52,91,72],[52,92,89],[52,93,6],[52,94,23],[52,95,40],[52,96,57],[52,97,74],[52,98,91],[52,99,8],[52,100,25],[53,1,79],[53,2,96],[53,3,13],[53,4,30],[53,5,47],[53,6,64],[53,7,81],[53,8,98],[53,9,15],[53,10,32],[53,11,49],[53,12,66],[53,13,83],[53,14,100],[53,15,17],[53,16,34],[53,17,51],[53,18,68],[53,19,85],[53,20,2],[53,21,19],[53,22,36],[53,23,53],[53,24,70],[53,25,87],[53,26,4],[53,27,21],[53,28,38],[53,29,55],[53,30,72],[53,31,89],[53,32,6],[53,33,23],[53,34,40],[53,35,57],[53,36,74],[53,37,91],[53,38,8],[53,39,25],[53,40,42],[53,41,59],[53,42,76],[53,43,93],[53,44,10],[53,45,27],[53,46,44],[53,47,61],[53,48,78],[53,49,95],[53,50,12],[53,51,29],[53,54,80],[53,55,97],[53,56,14],[53,57,31],[53,58,48],[53,59,65],[53,60,82],[53,61,99],[53,62,16],[53,63,33],[53,64,50],[53,65,67],[53,66,84],[53,67,1],[53,68,18],[53,69,35],[53,70,52],[53,71,69],[53,72,86],[53,73,3],[53,74,20],[53,75,37],[53,76,54],[53,77,71],[53,78,88],[53,79,5],[53,80,22],[53,81,39],[53,82,56],[53,83,73],[53,84,90],[53,85,7],[53,86,24],[53,87,41],[53,88,58],[53,89,75],[53,90,92],[53,91,9],[53,92,26],[53,93,43],[53,94,60],[53,95,77],[53,96,94],[53,97,11],[53,98,28],[53,99,45],[53,100,62],[54,1,16],[54,2,33],[54,3,50],[54,4,67],[54,5,84],[54,6,1],[54,7,18],[54,8,35],[54,9,52],[54,10,69],[54,11,86],[54,12,3],[54,13,20],[54,14,37],[54,15,54],[54,16,71],[54,17,88],[54,18,5],[54,19,22],[54,20,39],[54,21,56],[54,22,73],[54,23,90],[54,24,7],[54,25,24],[54,26,41],[54,27,58],[54,28,75],[54,29,92],[54,30,9],[54,31,26],[54,32,43],[54,33,60],[54,34,77],[54,35,94],[54,36,11],[54,37,28],[54,38,45],[54,39,62],[54,40,79],[54,41,96],[54,42,13],[54,43,30],[54,44,47],[54,45,64],[54,46,81],[54,47,98],[54,48,15],[54,49,32],[54,50,49],[54,51,66],[54,52,83],[54,55,34],[54,56,51],[54,57,68],[54,58,85],[54,59,2],[54,60,19],[54,61,36],[54,62,53],[54,63,70],[54,64,87],[54,65,4],[54,66,21],[54,67,38],[54,68,55],[54,69,72],[54,70,89],[54,71,6],[54,72,23],[54,73,40],[54,74,57],[54,75,74],[54,76,91],[54,77,8],[54,78,25],[54,79,42],[54,80,59],[54,81,76],[54,82,93],[54,83,10],[54,84,27],[54,85,44],[54,86,61],[54,87,78],[54,88,95],[54,89,12],[54,90,29],[54,91,46],[54,92,63],[54,93,80],[54,94,97],[54,95,14],[54,96,31],[54,97,48],[54,98,65],[54,99,82],[54,100,99],[55,1,53],[55,2,70],[55,3,87],[55,4,4],[55,5,21],[55,6,38],[55,7,55],[55,8,72],[55,9,89],[55,10,6],[55,11,23],[55,12,40],[55,13,57],[55,14,74],[55,15,91],[55,16,8],[55,17,25],[55,18,42],[55,19,59],[55,20,76],[55,21,93],[55,22,10],[55,23,27],[55,24,44],[55,25,61],[55,26,78],[55,27,95],[55,28,12],[55,29,29],[55,30,46],[55,31,63],[55,32,80],[55,33,97],[55,34,14],[55,35,31],[55,36,48],[55,37,65],[55,38,82],[55,39,99],[55,40,16],[55,41,33],[55,42,50],[55,43,67],[55,44,84],[55,45,1],[55,46,18],[55,47,35],[55,48,52],[55,49,69],[55,50,86],[55,51,3],[55,52,20],[55,53,37],[55,56,88],[55,57,5],[55,58,22],[55,59,39],[55,60,56],[55,61,73],[55,62,90],[55,63,7],[55,64,24],[55,65,41],[55,66,58],[55,67,75],[55,68,92],[55,69,9],[55,70,26],[55,71,43],[55,72,60],[55,73,77],[55,74,94],[55,75,11],[55,76,28],[55,77,45],[55,78,62],[55,79,79],[55,80,96],[55,81,13],[55,82,30],[55,83,47],[55,84,64],[55,85,81],[55,86,98],[55,87,15],[55,88,32],[55,89,49],[55,90,66],[55,91,83],[55,92,100],[55,93,17],[55,94,34],[55,95,51],[55,96,68],[55,97,85],[55,98,2],[55,99,19],[55,100,36],[56,1,90],[56,2,7],[56,3,24],[56,4,41],[56,5,58],[56,6,75],[56,7,92],[56,8,9],[56,9,26],[56,10,43],[56,11,60],[56,12,77],[56,13,94],[56,14,11],[56,15,28],[56,16,45],[56,17,62],[56,18,79],[56,19,96],[56,20,13],[56,21,30],[56,22,47],[56,23,64],[56,24,81],[56,25,98],[56,26,15],[56,27,32],[56,28,49],[56,29,66],[56,30,83],[56,31,100],[56,32,17],[56,33,34],[56,34,51],[56,35,68],[56,36,85],[56,37,2],[56,38,19],[56,39,36],[56,40,53],[56,41,70],[56,42,87],[56,43,4],[56,44,21],[56,45,38],[56,46,55],[56,47,72],[56,48,89],[56,49,6],[56,50,23],[56,51,40],[56,52,57],[56,53,74],[56,54,91],[56,57,42],[56,58,59],[56,59,76],[56,60,93],[56,61,10],[56,62,27],[56,63,44],[56,64,61],[56,65,78],[56,66,95],[56,67,12],[56,68,29],[56,69,46],[56,70,63],[56,71,80],[56,72,97],[56,73,14],[56,74,31],[56,75,48],[56,76,65],[56,77,82],[56,78,99],[56,79,16],[56,80,33],[56,81,50],[56,82,67],[56,83,84],[56,84,1],[56,85,18],[56,86,35],[56,87,52],[56,88,69],[56,89,86],[56,90,3],[56,91,20],[56,92,37],[56,93,54],[56,94,71],[56,95,88],[56,96,5],[56,97,22],[56,98,39],[56,99,56],[56,100,73],[57,1,27],[57,2,44],[57,3,61],[57,4,78],[57,5,95],[57,6,12],[57,7,29],[57,8,46],[57,9,63],[57,10,80],[57,11,97],[57,12,14],[57,13,31],[57,14,48],[57,15,65],[57,16,82],[57,17,99],[57,18,16],[57,19,33],[57,20,50],[57,21,67],[57,22,84],[57,23,1],[57,24,18],[57,25,35],[57,26,52],[57,27,69],[57,28,86],[57,29,3],[57,30,20],[57,31,37],[57,32,54],[57,33,71],[57,34,88],[57,35,5],[57,36,22],[57,37,39],[57,38,56],[57,39,73],[57,40,90],[57,41,7],[57,42,24],[57,43,41],[57,44,58],[57,45,75],[57,46,92],[57,47,9],[57,48,26],[57,49,43],[57,50,60],[57,51,77],[57,52,94],[57,53,11],[57,54,28],[57,55,45],[57,58,96],[57,59,13],[57,60,30],[57,61,47],[57,62,64],[57,63,81],[57,64,98],[57,65,15],[57,66,32],[57,67,49],[57,68,66],[57,69,83],[57,70,100],[57,71,17],[57,72,34],[57,73,51],[57,74,68],[57,75,85],[57,76,2],[57,77,19],[57,78,36],[57,79,53],[57,80,70],[57,81,87],[57,82,4],[57,83,21],[57,84,38],[57,85,55],[57,86,72],[57,87,89],[57,88,6],[57,89,23],[57,90,40],[57,91,57],[57,92,74],[57,93,91],[57,94,8],[57,95,25],[57,96,42],[57,97,59],[57,98,76],[57,99,93],[57,100,10],[58,1,64],[58,2,81],[58,3,98],[58,4,15],[58,5,32],[58,6,49],[58,7,66],[58,8,83],[58,9,100],[58,10,17],[58,11,34],[58,12,51],[58,13,68],[58,14,85],[58,15,2],[58,16,19],[58,17,36],[58,18,53],[58,19,70],[58,20,87],[58,21,4],[58,22,21],[58,23,38],[58,24,55],[58,25,72],[58,26,89],[58,27,6],[58,28,23],[58,29,40],[58,30,57],[58,31,74],[58,32,91],[58,33,8],[58,34,25],[58,35,42],[58,36,59],[58,37,76],[58,38,93],[58,39,10],[58,40,27],[58,41,44],[58,42,61],[58,43,78],[58,44,95],[58,45,12],[58,46,29],[58,47,46],[58,48,63],[58,49,80],[58,50,97],[58,51,14],[58,52,31],[58,53,48],[58,54,65],[58,55,82],[58,56,99],[58,59,50],[58,60,67],[58,61,84],[58,62,1],[58,63,18],[58,64,35],[58,65,52],[58,66,69],[58,67,86],[58,68,3],[58,69,20],[58,70,37],[58,71,54],[58,72,71],[58,73,88],[58,74,5],[58,75,22],[58,76,39],[58,77,56],[58,78,73],[58,79,90],[58,80,7],[58,81,24],[58,82,41],[58,83,58],[58,84,75],[58,85,92],[58,86,9],[58,87,26],[58,88,43],[58,89,60],[58,90,77],[58,91,94],[58,92,11],[58,93,28],[58,94,45],[58,95,62],[58,96,79],[58,97,96],[58,98,13],[58,99,30],[58,100,47],[59,1,1],[59,2,18],[59,3,35],[59,4,52],[59,5,69],[59,6,86],[59,7,3],[59,8,20],[59,9,37],[59,10,54],[59,11,71],[59,12,88],[59,13,5],[59,14,22],[59,15,39],[59,16,56],[59,17,73],[59,18,90],[59,19,7],[59,20,24],[59,21,41],[59,22,58],[59,23,75],[59,24,92],[59,25,9],[59,26,26],[59,27,43],[59,28,60],[59,29,77],[59,30,94],[59,31,11],[59,32,28],[59,33,45],[59,34,62],[59,35,79],[59,36,96],[59,37,13],[59,38,30],[59,39,47],[59,40,64],[59,41,81],[59,42,98],[59,43,15],[59,44,32],[59,45,49],[59,46,66],[59,47,83],[59,48,100],[59,49,17],[59,50,34],[59,51,51],[59,52,68],[59,53,85],[59,54,2],[59,55,19],[59,56,36],[59,57,53],[59,60,4],[59,61,21],[59,62,38],[59,63,55],[59,64,72],[59,65,89],[59,66,6],[59,67,23],[59,68,40],[59,69,57],[59,70,74],[59,71,91],[59,72,8],[59,73,25],[59,74,42],[59,75,59],[59,76,76],[59,77,93],[59,78,10],[59,79,27],[59,80,44],[59,81,61],[59,82,78],[59,83,95],[59,84,12],[59,85,29],[59,86,46],[59,87,63],[59,88,80],[59,89,97],[59,90,14],[59,91,31],[59,92,48],[59,93,65],[59,94,82],[59,95,99],[59,96,16],[59,97,33],[59,98,50],[59,99,67],[59,100,84],[60,1,38],[60,2,55],[60,3,72],[60,4,89],[60,5,6],[60,6,23],[60,7,40],[60,8,57],[60,9,74],[60,10,91],[60,11,8],[60,12,25],[60,13,42],[60,14,59],[60,15,76],[60,16,93],[60,17,10],[60,18,27],[60,19,44],[60,20,61],[60,21,78],[60,22,95],[60,23,12],[60,24,29],[60,25,46],[60,26,63],[60,27,80],[60,28,97],[60,29,14],[60,30,31],[60,31,48],[60,32,65],[60,33,82],[60,34,99],[60,35,16],[60,36,33],[60,37,50],[60,38,67],[60,39,84],[60,40,1],[60,41,18],[60,42,35],[60,43,52],[60,44,69],[60,45,86],[60,46,3],[60,47,20],[60,48,37],[60,49,54],[60,50,71],[60,51,88],[60,52,5],[60,53,22],[60,54,39],[60,55,56],[60,56,73],[60,57,90],[60,58,7],[60,61,58],[60,62,75],[60,63,92],[60,64,9],[60,65,26],[60,66,43],[60,67,60],[60,68,77],[60,69,94],[60,70,11],[60,71,28],[60,72,45],[60,73,62],[60,74,79],[60,75,96],[60,76,13],[60,77,30],[60,78,47],[60,79,64],[60,80,81],[60,81,98],[60,82,15],[60,83,32],[60,84,49],[60,85,66],[60,86,83],[60,87,100],[60,88,17],[60,89,34],[60,90,51],[60,91,68],[60,92,85],[60,93,2],[60,94,19],[60,95,36],[60,96,53],[60,97,70],[60,98,87],[60,99,4],[60,100,21],[61,1,75],[61,2,92],[61,3,9],[61,4,26],[61,5,43],[61,6,60],[61,7,77],[61,8,94],[61,9,11],[61,10,28],[61,11,45],[61,12,62],[61,13,79],[61,14,96],[61,15,13],[61,16,30],[61,17,47],[61,18,64],[61,19,81],[61,20,98]]", "100", "100"]], "expected": [100, 0, 1, -1, 7, 5, 3, 5, -1, 3, 2, 2, -1, 6, 2, 3, 3, 4, 1, -1, -1, 9, 8, 8, 4, 4, -1, 6, 8, 300, 15, 2, 5, 11, -1, 5, 9, 12, 2, 7, 14, -1, 42, 28, 15, 14, 9, 9, 16, 9, -1, 23, 10, 42, 146], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "835", "slug": "new-21-game", "id": 835, "title": "New 21 Game", "difficulty": "Medium", "category": "dp", "link": "https://leetcode.com/problems/new-21-game/", "examples": [{"input": "n = 10, k = 1, maxPts = 10", "output": "\"1.0\"", "explanation": "Every first draw stops the game within the limit."}, {"input": "n = 6, k = 1, maxPts = 10", "output": "\"0.6\"", "explanation": "Six of ten faces stay within 6."}, {"input": "n = 21, k = 17, maxPts = 10", "output": "\"0.73278\""}], "hints": ["This is a portable adaptation: return the probability as a finite decimal string; grading allows 1e-5 absolute error.", "Let dp[i] be the chance of ever holding exactly i points; then dp[i] is the average of the previous maxPts values that are still below k.", "Maintain a sliding window sum so each dp[i] is O(1), and add up dp[k] through dp[n] for the answer."], "statement": "Alice plays a drawing game. She starts with 0 points and repeatedly draws a random whole number uniformly from `1` to `maxPts`, adding it to her score. She stops as soon as her score reaches at least `k`. Given `n`, return the probability that her final score is at most `n`.\n\n**Portable adaptation:** Cojudge has no floating-point type, so return the probability as a decimal string that parses as a finite double (for example `\"0.73278\"` or `\"1.0\"`). Answers are accepted when they differ from the reference by at most `1e-5` in absolute value.\n\n**Constraints:**\n- `0 <= k <= n <= 10^4`\n- `1 <= maxPts <= 10^4`\n", "solution": "## Approach\n\nTrack dp[i], the probability of ever holding exactly i points: each such probability is the mean of the up to maxPts preceding probabilities that belong to scores below k, because only those scores draw again. A sliding window keeps that running sum so every state costs O(1). Summing dp[k] through dp[n] gives the chance of stopping within the limit, formatted as a decimal string.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n) where n is the limit.\n- **Space Complexity:** O(n) for the probability table.\n\n## Implementation\n\n```python\nclass Solution:\n def new21Game(self, n: int, k: int, maxPts: int) -> str:\n if k == 0:\n return \"1.0\"\n if n >= k - 1 + maxPts:\n return \"1.0\"\n dp = [0.0] * (n + 1)\n dp[0] = 1.0\n window = 1.0\n for i in range(1, n + 1):\n dp[i] = window / maxPts\n if i < k:\n window += dp[i]\n if i - maxPts >= 0:\n window -= dp[i - maxPts]\n return str(sum(dp[k:]))\n```\n", "starter": {"go": "package main\n\nfunc New21Game(n int, k int, maxPts int) string {\n return \"\"\n}", "python": "class Solution:\n def new21Game(self, n: int, k: int, maxPts: int) -> str:\n return \"\"\n", "cpp": "#include <string>\nusing namespace std;\nclass Solution {\npublic:\n string new21Game(int n, int k, int maxPts) {\n return \"\";\n }\n};"}, "fn": "new21Game", "params": [{"name": "n", "type": "int"}, {"name": "k", "type": "int"}, {"name": "maxPts", "type": "int"}], "outputType": "string", "tests": [["10", "1", "10"], ["6", "1", "10"], ["21", "17", "10"], ["0", "0", "1"], ["1", "0", "5"], ["5", "5", "5"], ["5", "4", "5"], ["10", "10", "1"], ["9", "9", "1"], ["2", "1", "2"], ["1", "1", "2"], ["3", "2", "2"], ["7", "3", "3"], ["12", "8", "5"], ["20", "10", "10"], ["100", "50", "10"], ["10000", "10000", "10000"], ["10000", "0", "10000"], ["5000", "4999", "10000"], ["15", "10", "3"], ["30", "20", "7"], ["50", "25", "25"], ["21", "21", "10"], ["21", "20", "10"], ["19", "17", "10"], ["17", "17", "10"], ["17", "16", "10"], ["100", "1", "10"]], "expected": ["1.0", "0.6", "0.7327777870686082", "1.0", "1.0", "0.41472", "0.6912", "1.0", "1.0", "1.0", "0.5", "1.0", "1.0", "1.0", "1.0", "1.0", "2.717874139411285E-4", "1.0", "3.296700738747606E-4", "1.0", "1.0", "1.0", "0.17758097982256005", "0.342166808058291", "0.5022134049071649", "0.18571059863572162", "0.3508325338831302", "1.0"], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "698", "slug": "next-closest-time", "id": 698, "title": "Next Closest Time", "difficulty": "Medium", "category": "string", "link": "https://leetcode.com/problems/next-closest-time/", "examples": [{"input": "time = \"19:34\"", "output": "\"19:39\"", "explanation": "39 is the next minute whose digits both appear in 19:34."}, {"input": "time = \"23:59\"", "output": "\"22:22\"", "explanation": "Wrapping past midnight, 22:22 is the earliest reachable time."}, {"input": "time = \"00:00\"", "output": "\"00:00\"", "explanation": "Only digit 0 is available, so the next valid time is the same."}], "hints": ["Collect the distinct digits appearing in the input.", "Step forward minute by minute (wrapping after 23:59) and test whether every digit of the candidate belongs to the set.", "At most 24*60 steps are needed."], "statement": "You are given a time string `time` in 24-hour format `\"HH:MM\"`.\n\nUsing only the digits that already appear in `time` (each may be reused any number of times), form the next time strictly after `time` when read on a clock that wraps from `23:59` to `00:00`. The answer must itself be a valid time.\n\nReturn that next time as `\"HH:MM\"`.\n\n**Constraints:**\n- `time` matches `\"HH:MM\"` with `00 <= HH <= 23` and `00 <= MM <= 59`.\n", "solution": "## Approach\n\nRecord which digits occur in the input. Convert the time to minutes, then advance one minute at a time with wrap-around, formatting each candidate and accepting the first whose four digits all belong to the recorded set.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(24*60) steps with constant work each.\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def nextClosestTime(self, time: str) -> str:\n allowed = {c for c in time if c != \":\"}\n cur = int(time[:2]) * 60 + int(time[3:])\n for d in range(1, 24 * 60 + 1):\n nxt = (cur + d) % (24 * 60)\n cand = f\"{nxt // 60:02d}:{nxt % 60:02d}\"\n if all(c in allowed or c == \":\" for c in cand):\n return cand\n return time\n```\n", "starter": {"go": "package main\n\nfunc NextClosestTime(time string) string {\n return \"\"\n}", "python": "class Solution:\n def nextClosestTime(self, time: str) -> str:\n pass", "cpp": "#include <string>\nusing namespace std;\nclass Solution {\npublic:\n string nextClosestTime(string time) {\n return \"\";\n }\n};"}, "fn": "nextClosestTime", "params": [{"name": "time", "type": "string"}], "outputType": "string", "tests": [["19:34"], ["23:59"], ["00:00"], ["01:34"], ["12:09"], ["13:55"], ["20:48"], ["11:11"], ["22:22"], ["01:00"], ["02:00"], ["15:29"], ["18:42"], ["09:59"], ["00:01"], ["12:34"], ["19:39"], ["23:58"], ["23:57"], ["05:55"], ["10:10"], ["14:59"], ["06:07"], ["21:37"], ["03:33"], ["17:00"], ["08:08"], ["19:00"]], "expected": ["19:39", "22:22", "00:00", "01:40", "12:10", "15:11", "22:00", "11:11", "22:22", "01:01", "02:02", "15:51", "18:44", "00:00", "00:10", "12:41", "11:11", "22:22", "22:22", "00:00", "10:11", "15:11", "07:00", "22:11", "00:00", "17:01", "00:00", "19:01"], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "559", "slug": "next-greater-element-i", "id": 559, "title": "Next Greater Element I", "difficulty": "Easy", "category": "stack", "link": "https://leetcode.com/problems/next-greater-element-i/", "examples": [{"input": "nums1 = [4,1,2], nums2 = [1,3,4,2]", "output": "[-1,3,-1]", "explanation": "4 has nothing larger to its right; 1 sees 3 next; 2 is last."}, {"input": "nums1 = [2,4], nums2 = [1,2,3,4]", "output": "[3,-1]", "explanation": "2 is followed by 3; 4 has no larger successor."}], "hints": ["Precompute next-greater for all of nums2 in one pass with a decreasing monotonic stack.", "Store the computed mapping in a hash table, then answer each nums1 query in O(1).", "Elements left on the stack at the end map to -1."], "statement": "For an element `x` inside a list, its next greater element is the first value to the right of `x` that is strictly larger. If no such value exists the answer for `x` is `-1`.\n\nYou receive two lists with all distinct entries where every value of `nums1` also occurs somewhere in `nums2`. For each entry of `nums1`, locate its position in `nums2` and report its next greater element within `nums2`. Collect the results in the order of `nums1`.\n\n**Constraints:**\n- `1 <= nums1.length <= nums2.length <= 1000`\n- `0 <= nums1[i], nums2[i] <= 10^4`\n- All values in each list are unique and `nums1` is a subset of `nums2`\n", "solution": "## Approach\n\nScan `nums2` once while maintaining a strictly decreasing stack. When a new value exceeds the stack top, it is the next greater element for all popped smaller values. Remaining stack entries have no greater successor and map to `-1`. Each query from `nums1` is then answered by table lookup in order.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(m + n) where m and n are the lengths of nums2 and nums1.\n- **Space Complexity:** O(m) for the stack and map.\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]:\n nxt = {}\n st: List[int] = []\n for x in nums2:\n while st and x > st[-1]:\n nxt[st.pop()] = x\n st.append(x)\n for x in st:\n nxt[x] = -1\n return [nxt[v] for v in nums1]\n```\n", "starter": {"go": "package main\n\nfunc NextGreaterElement(nums1 []int, nums2 []int) []int {\n \n}", "python": "from typing import List\nclass Solution:\n def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]:\n pass\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {\n return {};\n }\n};"}, "fn": "nextGreaterElement", "params": [{"name": "nums1", "type": "int_array"}, {"name": "nums2", "type": "int_array"}], "outputType": "int_array", "tests": [["[4,1,2]", "[1,3,4,2]"], ["[2,4]", "[1,2,3,4]"], ["[1]", "[1]"], ["[1]", "[2,1]"], ["[2]", "[2,1]"], ["[5]", "[5,4,3,2,1]"], ["[1,2,3]", "[1,2,3]"], ["[3,2,1]", "[3,2,1]"], ["[1,3,5]", "[5,4,3,2,1,6]"], ["[6]", "[5,4,3,2,1,6]"], ["[1,2]", "[2,1]"], ["[10,20]", "[10,5,20,15]"], ["[0]", "[0,10000]"], ["[10000]", "[0,10000]"], ["[1,2,3,4]", "[4,3,2,1,5]"], ["[7,8]", "[1,7,2,8,3]"], ["[4]", "[1,2,3,4,5]"], ["[5]", "[1,2,3,4,5]"], ["[2,3]", "[3,2,5,1]"], ["[9,1]", "[9,8,7,1,2]"], ["[1,9]", "[1,9,8]"], ["[0,1,2]", "[2,1,0,3]"], ["[3]", "[1,2,3]"], ["[1,2]", "[1,2,10000]"], ["[4,5,6]", "[6,5,4,7]"], ["[11,22]", "[11,22,33,44]"], ["[44]", "[11,22,33,44]"], ["[2,1]", "[5,4,3,2,1,6,7]"]], "expected": [[-1, 3, -1], [3, -1], [-1], [-1], [-1], [-1], [2, 3, -1], [-1, -1, -1], [6, 6, 6], [-1], [-1, -1], [20, -1], [10000], [-1], [5, 5, 5, 5], [8, -1], [5], [-1], [5, 5], [-1, 2], [9, -1], [3, 3, 3], [-1], [2, 10000], [7, 7, 7], [22, 33], [-1], [6, 6]], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "565", "slug": "next-greater-element-ii", "id": 565, "title": "Next Greater Element II", "difficulty": "Medium", "category": "stack", "link": "https://leetcode.com/problems/next-greater-element-ii/", "examples": [{"input": "nums = [1,2,1]", "output": "[2,-1,2]", "explanation": "The first 1 sees 2; 2 sees nothing larger in the circle; the last 1 wraps to 2."}, {"input": "nums = [1,2,3,4,3]", "output": "[2,3,4,-1,4]", "explanation": "Each element except the maximum 4 finds a larger successor, with the final 3 wrapping to 4."}], "hints": ["Scan twice around the array while keeping a decreasing stack of indices awaiting their greater element.", "Only push indices during the first lap; the second lap only resolves pending entries.", "Unresolved indices at the end keep -1."], "statement": "Imagine the list wrapped into a circle so the element after the last position is the first position again. For each entry, look forward along this circular order for the first strictly larger value. If the full loop contains no larger value, record `-1` for that spot.\n\nReturn the list of answers aligned with the input order.\n\n**Constraints:**\n- `1 <= nums.length <= 10^4`\n- `-10^9 <= nums[i] <= 10^9`\n", "solution": "## Approach\n\nDuplicate the circular walk by iterating `2*n` steps over indices modulo `n`. A decreasing stack holds positions still waiting for a larger value; whenever the current value exceeds the stack top, it resolves those positions. Indices are pushed only during the first lap so each is resolved at most once.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n) with each index pushed and popped once.\n- **Space Complexity:** O(n) for the stack and answer.\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def nextGreaterElements(self, nums: List[int]) -> List[int]:\n n = len(nums)\n ans = [-1] * n\n st: List[int] = []\n for i in range(2 * n):\n idx = i % n\n while st and nums[idx] > nums[st[-1]]:\n ans[st.pop()] = nums[idx]\n if i < n:\n st.append(idx)\n return ans\n```\n", "starter": {"go": "package main\n\nfunc NextGreaterElements(nums []int) []int {\n \n}", "python": "from typing import List\nclass Solution:\n def nextGreaterElements(self, nums: List[int]) -> List[int]:\n pass\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n vector<int> nextGreaterElements(vector<int>& nums) {\n return {};\n }\n};"}, "fn": "nextGreaterElements", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int_array", "tests": [["[1,2,1]"], ["[1,2,3,4,3]"], ["[5,4,3,2,1]"], ["[1]"], ["[1,1,1]"], ["[1,2,3,4,5]"], ["[5,5,5,4,5]"], ["[3,1,2]"], ["[2,1,2]"], ["[1,3,2,1]"], ["[-1,0,1]"], ["[100,-100,50]"], ["[4,3,2,1,5]"], ["[1,5,2,3,4]"], ["[2,2,2,3]"], ["[9,8,7,6,10]"], ["[1,2]"], ["[2,1]"], ["[0,0]"], ["[1,0,1]"], ["[3,3,3,4]"], ["[5,1,2,3,4,0]"], ["[-3,-2,-1]"], ["[1000000000,-1000000000]"], ["[7,7,7,7]"], ["[1,2,3,2,1]"], ["[4,5,2,25]"], ["[13,7,6,12]"]], "expected": [[2, -1, 2], [2, 3, 4, -1, 4], [-1, 5, 5, 5, 5], [-1], [-1, -1, -1], [2, 3, 4, 5, -1], [-1, -1, -1, 5, -1], [-1, 2, 3], [-1, 2, -1], [3, -1, 3, 3], [0, 1, -1], [-1, 50, 100], [5, 5, 5, 5, -1], [5, -1, 3, 4, 5], [3, 3, 3, -1], [10, 10, 10, 10, -1], [2, -1], [-1, 2], [-1, -1], [-1, 1, -1], [4, 4, 4, -1], [-1, 2, 3, 4, 5, 5], [-2, -1, -1], [-1, 1000000000], [-1, -1, -1, -1], [2, 3, -1, 3, 2], [5, 25, 25, -1], [-1, 12, 12, 13]], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "612", "slug": "next-greater-element-iii", "id": 612, "title": "Next Greater Element III", "difficulty": "Medium", "category": "math", "link": "https://leetcode.com/problems/next-greater-element-iii/", "examples": [{"input": "n = 12", "output": "21", "explanation": "21 is the smallest larger integer using the same digits."}, {"input": "n = 21", "output": "-1", "explanation": "Descending digits admit no larger permutation."}, {"input": "n = 12443322", "output": "13222344", "explanation": "Pivot swap plus sorted tail yields the next arrangement."}], "hints": ["Scan the digits from right to left to find the first rise (a pivot smaller than its right neighbor).", "Swap the pivot with the smallest digit on its right that is larger than it, then reverse the suffix.", "If the digits never rise, or the result exceeds 2147483647, return -1."], "statement": "Given a positive integer `n`, rearrange its decimal digits into the smallest larger integer that uses exactly the same digits. If no larger arrangement exists, or if the rearranged value does not fit in a 32-bit signed integer, return `-1`.\n\nThink of it as finding the next permutation of the digit sequence: scan from the right for the first position where a digit is smaller than its right neighbor, exchange it with the smallest bigger digit on its right, then order the trailing digits increasingly. A fully non-increasing digit sequence has no greater permutation.\n\n**Constraints:**\n- `1 <= n <= 2^31 - 1`\n", "solution": "## Approach\n\nTreat the number as a digit sequence and locate its next lexicographic permutation: find the rightmost pivot that is smaller than the digit after it, swap it with the smallest larger digit to its right, and reverse the tail so it is increasing. A missing pivot means the digits descend and no greater value exists. The rebuilt number is checked against the 32-bit signed limit before returning.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(d), where d is the number of digits (at most 10).\n- **Space Complexity:** O(d) for the digit array.\n\n## Implementation\n\n```python\nclass Solution:\n def nextGreaterElement(self, n: int) -> int:\n d = list(str(n))\n i = len(d) - 2\n while i >= 0 and d[i] >= d[i + 1]:\n i -= 1\n if i < 0:\n return -1\n j = len(d) - 1\n while d[j] <= d[i]:\n j -= 1\n d[i], d[j] = d[j], d[i]\n d[i + 1:] = reversed(d[i + 1:])\n v = int(\"\".join(d))\n return v if v <= 2 ** 31 - 1 else -1\n```\n", "starter": {"go": "package main\n\nfunc NextGreaterElement(n int) int {\n return -1\n}", "python": "class Solution:\n def nextGreaterElement(self, n: int) -> int:\n return -1\n", "cpp": "class Solution {\npublic:\n int nextGreaterElement(int n) {\n return -1;\n }\n};"}, "fn": "nextGreaterElement", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["12"], ["21"], ["1234"], ["4321"], ["123"], ["321"], ["230241"], ["12443322"], ["2147483647"], ["2147483476"], ["1999999999"], ["1"], ["9"], ["10"], ["100"], ["101"], ["110"], ["123456789"], ["987654321"], ["111"], ["112"], ["1221"], ["211"], ["2001"], ["1200"], ["54321"], ["12321"], ["999"]], "expected": [21, -1, 1243, -1, 132, -1, 230412, 13222344, -1, 2147483647, -1, -1, -1, -1, -1, 110, -1, 123456798, -1, -1, 121, 2112, -1, 2010, 2001, -1, 13122, -1], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "260", "slug": "next-permutation", "id": 260, "title": "Next Permutation", "difficulty": "Medium", "category": "array", "link": "https://leetcode.com/problems/next-permutation/", "examples": [{"input": "nums = [1,2,3]", "output": "[1,3,2]", "explanation": "Among orderings above [1,2,3], [1,3,2] is the smallest."}, {"input": "nums = [3,2,1]", "output": "[1,2,3]", "explanation": "[3,2,1] is the largest ordering, so wrap to the smallest."}, {"input": "nums = [1,1,5]", "output": "[1,5,1]", "explanation": "With duplicates included, [1,5,1] is the next larger ordering."}], "hints": ["Scan from the right for the first position that is smaller than its successor (the pivot); everything right of it is descending.", "Swap the pivot with the smallest element to its right that is larger than it, then reverse the suffix into ascending order."], "statement": "A permutation of an integer array is one ordering of its elements. The *next permutation* of `nums` is the smallest ordering that is lexicographically larger than the current one; when the array is already the largest ordering, the next permutation wraps around to the smallest (fully ascending) ordering.\n\nReorganize `nums` into its next permutation and return the rearranged array. (On the original platform this operation is performed in place with `void` return; here you return the updated array so the judge can compare it directly.)\n\n**Constraints:**\n- `1 <= nums.length <= 100`\n- `0 <= nums[i] <= 100`\n\n*Adaptation note:* the classic statement asks for an in-place `void` update; this version returns the rearranged array instead, which carries exactly the same information.\n", "solution": "## Approach\n\nFind the pivot: the rightmost index holding a value smaller than its right neighbor. If none exists the array is fully descending, so reversing everything yields the smallest ordering. Otherwise swap the pivot with the rightmost element larger than it (the minimal viable increase), then reverse the suffix after the pivot to make it ascending.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n) with a few linear scans.\n- **Space Complexity:** O(1) extra space (O(n) here for the returned copy).\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def nextPermutation(self, nums: List[int]) -> List[int]:\n a = list(nums)\n i = len(a) - 2\n while i >= 0 and a[i] >= a[i + 1]:\n i -= 1\n if i >= 0:\n j = len(a) - 1\n while a[j] <= a[i]:\n j -= 1\n a[i], a[j] = a[j], a[i]\n a[i + 1:] = reversed(a[i + 1:])\n return a\n```\n", "starter": {"go": "package main\n\nfunc NextPermutation(nums []int) []int {\n \n}", "python": "from typing import List\nclass Solution:\n def nextPermutation(self, nums: List[int]) -> List[int]:\n ", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> nextPermutation(vector<int>& nums) {\n return {};\n }\n};"}, "fn": "nextPermutation", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int_array", "tests": [["[1,2,3]"], ["[3,2,1]"], ["[1,1,5]"], ["[1]"], ["[1,2]"], ["[2,1]"], ["[1,3,2]"], ["[2,3,1]"], ["[1,5,1]"], ["[1,2,3,4]"], ["[4,3,2,1]"], ["[1,1,1]"], ["[1,1,2]"], ["[2,1,1]"], ["[1,2,4,3]"], ["[5,4,3,2,1]"], ["[1,3,5,4,2]"], ["[2,2,3,3,1]"], ["[1,2,3,5,4]"], ["[3,1,2]"], ["[2,3,1]"], ["[1,4,3,2]"], ["[100,99,98,1]"], ["[0]"], ["[0,0]"], ["[1,2,3,4,5,6]"], ["[6,5,4,3,2,1]"]], "expected": [[1, 3, 2], [1, 2, 3], [1, 5, 1], [1], [2, 1], [1, 2], [2, 1, 3], [3, 1, 2], [5, 1, 1], [1, 2, 4, 3], [1, 2, 3, 4], [1, 1, 1], [1, 2, 1], [1, 1, 2], [1, 3, 2, 4], [1, 2, 3, 4, 5], [1, 4, 2, 3, 5], [2, 3, 1, 2, 3], [1, 2, 4, 3, 5], [3, 2, 1], [3, 1, 2], [2, 1, 3, 4], [1, 98, 99, 100], [0], [0, 0], [1, 2, 3, 4, 6, 5], [1, 2, 3, 4, 5, 6]], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "388", "slug": "nim-game", "id": 388, "title": "Nim Game", "difficulty": "Easy", "category": "dp", "link": "https://leetcode.com/problems/nim-game/", "examples": [{"input": "n = 4", "output": "false", "explanation": "Any first move leaves a winning reply for the opponent."}, {"input": "n = 1", "output": "true", "explanation": "Take the last stone at once."}, {"input": "n = 2", "output": "true", "explanation": "Take both stones at once."}], "hints": ["Work out small piles by hand: 1, 2, 3 are wins; 4 is a loss; 5, 6, 7 are wins again.", "A pile is losing exactly when the opponent can always return it to another losing pile.", "Look for the repeating pattern in the pile size to get an O(1) rule."], "statement": "A pile holds `n` stones. You move first, and the two players alternate. On each turn a player\nmust remove 1, 2, or 3 stones. The player who takes the last stone wins, and both players play\nperfectly. Return whether you, the first player, can force a win.\n\n**Constraints:**\n- `1 <= n <= 2^31 - 1`\n", "solution": "## Approach\n\nPiles whose size is a multiple of 4 are losing: any move away from them lets the opponent restore a multiple of 4. Every other pile can move to a multiple of 4, so it is winning.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(1)\n- **Space Complexity:** O(1)\n\n## Implementation\n\n```python\nclass Solution:\n def canWinNim(self, n: int) -> bool:\n return n % 4 != 0\n```\n", "starter": {"go": "package main\n\nfunc CanWinNim(n int) bool {\n return false\n}", "python": "class Solution:\n def canWinNim(self, n: int) -> bool:\n ", "cpp": "\nclass Solution {\npublic:\n bool canWinNim(int n) {\n return false;\n }\n};"}, "fn": "canWinNim", "params": [{"name": "n", "type": "int"}], "outputType": "boolean", "tests": [["4"], ["1"], ["2"], ["3"], ["5"], ["6"], ["7"], ["8"], ["9"], ["10"], ["11"], ["12"], ["13"], ["15"], ["16"], ["17"], ["20"], ["21"], ["24"], ["25"], ["28"], ["32"], ["33"], ["100"], ["101"], ["1000"], ["1000000"], ["1000000000"], ["2147483647"], ["2147483644"]], "expected": [false, true, true, true, true, true, true, false, true, true, true, false, true, true, false, true, false, true, false, true, false, false, true, false, true, false, false, false, true, false], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "684", "slug": "non-decreasing-array", "id": 684, "title": "Non-decreasing Array", "difficulty": "Medium", "category": "array", "link": "https://leetcode.com/problems/non-decreasing-array/", "examples": [{"input": "nums = [4,2,3]", "output": "true", "explanation": "Lower the 4 to 1 to get [1,2,3]."}, {"input": "nums = [4,2,1]", "output": "false", "explanation": "Two separate drops need two edits."}, {"input": "nums = [3,4,2,3]", "output": "false", "explanation": "Fixing either drop leaves another violation."}], "hints": ["Scan for the first index i with nums[i] > nums[i+1]; more than one such spot (after a fix) means failure.", "At a violation, either lower nums[i] to nums[i+1] or raise nums[i+1] to nums[i] \u2014 pick the one keeping neighbours valid.", "Lowering the left entry works when i is 0 or nums[i-1] <= nums[i+1]; otherwise raise the right entry."], "statement": "You are given an array `nums`.\n\nDecide whether it can become non-decreasing (each entry less than or equal to the next) by changing at most one entry to any value.\n\n**Constraints:**\n- `1 <= nums.length <= 10^4`\n- `-10^5 <= nums[i] <= 10^5`\n", "solution": "## Approach\n\nWalk once and count drops where `a[i] > a[i+1]`. On the first drop, fix it in place: lower the left entry when the entry before still fits, otherwise raise the right entry. A second drop means two edits are needed, so return false.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n) for a single pass.\n- **Space Complexity:** O(1) besides the working copy.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def checkPossibility(self, nums: List[int]) -> bool:\n a = list(nums)\n cnt = 0\n for i in range(len(a) - 1):\n if a[i] > a[i + 1]:\n cnt += 1\n if cnt > 1:\n return False\n if i == 0 or a[i - 1] <= a[i + 1]:\n a[i] = a[i + 1]\n else:\n a[i + 1] = a[i]\n return True\n```\n", "starter": {"go": "package main\n\nfunc CheckPossibility(nums []int) bool {\n \n}", "python": "from typing import List\nclass Solution:\n def checkPossibility(self, nums: List[int]) -> bool:\n pass", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n bool checkPossibility(vector<int>& nums) {\n return false;\n }\n};"}, "fn": "checkPossibility", "params": [{"name": "nums", "type": "int_array"}], "outputType": "boolean", "tests": [["[4,2,3]"], ["[4,2,1]"], ["[3,4,2,3]"], ["[1,2,3]"], ["[1]"], ["[1,2]"], ["[2,1]"], ["[3,2,1]"], ["[1,3,2]"], ["[1,4,2,3]"], ["[2,3,3,2,4]"], ["[5,7,1,8]"], ["[1,2,5,3,5]"], ["[1,5,3,4]"], ["[3,4,2,2]"], ["[-1,4,2,3]"], ["[1,2,3,4,5,3,6]"], ["[2,2,2,2]"], ["[5,4,3,2,1,6]"], ["[1,2,3,2,5,6]"], ["[10,5,5,10]"], ["[1,3,2,2,2]"], ["[4,5,6,7,1]"], ["[1,2,4,5,3]"], ["[0,0,1]"], ["[5,1,2,3,4]"], ["[1,2,3,4,0]"], ["[2,3,1,4,5]"]], "expected": [true, false, false, true, true, true, true, false, true, true, true, true, true, true, false, true, true, true, false, true, true, true, true, true, true, true, true, true], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "555", "slug": "non-decreasing-subsequences", "id": 555, "title": "Non-decreasing Subsequences", "difficulty": "Medium", "category": "array", "link": "https://leetcode.com/problems/non-decreasing-subsequences/", "examples": [{"input": "nums = [4,6,7,7]", "output": "[[4,6],[4,6,7],[4,6,7,7],[4,7],[4,7,7],[6,7],[6,7,7],[7,7]]", "explanation": "All eight distinct non-decreasing groups with length at least two."}, {"input": "nums = [4,4,3,2,1]", "output": "[[4,4]]", "explanation": "Only the leading equal pair is non-decreasing."}], "hints": ["Backtrack over positions, extending the current path only with values at least as large as its last element.", "At each recursion depth skip a value already tried at that depth to avoid duplicate groups.", "Add a copy of the path to the answer whenever its length reaches two or more."], "statement": "You receive a list of integers. A subsequence keeps some elements in their original relative order while possibly skipping others. It is called non-decreasing when each kept value is greater than or equal to the previous kept value.\n\nList every distinct non-decreasing subsequence that uses at least two positions. Two subsequences count as the same when their value sequences match, even if they came from different indices. The order of the returned groups does not matter.\n\n**Constraints:**\n- `1 <= nums.length <= 15`\n- `-100 <= nums[i] <= 100`\n", "solution": "## Approach\n\nDepth-first search builds subsequences in index order. A new element is appended only when it keeps the path non-decreasing. At each depth a per-level set remembers which values were already branched on, so duplicate value sequences from different positions are generated once. Every path of length two or more is recorded.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(2^n * n) with n up to 15; each subset is considered once.\n- **Space Complexity:** O(n) recursion depth plus the output storage.\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def findSubsequences(self, nums: List[int]) -> List[List[int]]:\n res: List[List[int]] = []\n cur: List[int] = []\n\n def dfs(idx: int) -> None:\n if len(cur) >= 2:\n res.append(list(cur))\n used = set()\n for i in range(idx, len(nums)):\n if cur and nums[i] < cur[-1]:\n continue\n if nums[i] in used:\n continue\n used.add(nums[i])\n cur.append(nums[i])\n dfs(i + 1)\n cur.pop()\n\n dfs(0)\n return res\n```\n", "starter": {"go": "package main\n\nfunc FindSubsequences(nums []int) [][]int {\n \n}", "python": "from typing import List\nclass Solution:\n def findSubsequences(self, nums: List[int]) -> List[List[int]]:\n pass\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n vector<vector<int>> findSubsequences(vector<int>& nums) {\n return {};\n }\n};"}, "fn": "findSubsequences", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int_list_2d", "tests": [["[4,6,7,7]"], ["[4,4,3,2,1]"], ["[1,2,3]"], ["[3,2,1]"], ["[1,1]"], ["[1]"], ["[1,1,1]"], ["[1,2,1,2]"], ["[4,6,7,7,7]"], ["[1,3,2,4]"], ["[5,5,5,5]"], ["[1,2,3,4,5]"], ["[5,4,3,2,1]"], ["[1,1,2,2]"], ["[2,1,2,1,2]"], ["[0,0,0,1]"], ["[-1,0,1]"], ["[-2,-1,-1,0]"], ["[1,2,3,1,2,3]"], ["[7,7,7,7,7]"], ["[4,4,4,3,4]"], ["[1,3,5,2,4,6]"], ["[2,2]"], ["[1,2]"], ["[2,1]"], ["[100,-100,100]"], ["[1,1,1,1,2]"], ["[3,3,2,2,1,1]"]], "expected": [[[4, 6], [4, 6, 7], [4, 6, 7, 7], [4, 7], [4, 7, 7], [6, 7], [6, 7, 7], [7, 7]], [[4, 4]], [[1, 2], [1, 2, 3], [1, 3], [2, 3]], [], [[1, 1]], [], [[1, 1], [1, 1, 1]], [[1, 2], [1, 2, 2], [1, 1], [1, 1, 2], [2, 2]], [[4, 6], [4, 6, 7], [4, 6, 7, 7], [4, 6, 7, 7, 7], [4, 7], [4, 7, 7], [4, 7, 7, 7], [6, 7], [6, 7, 7], [6, 7, 7, 7], [7, 7], [7, 7, 7]], [[1, 3], [1, 3, 4], [1, 2], [1, 2, 4], [1, 4], [3, 4], [2, 4]], [[5, 5], [5, 5, 5], [5, 5, 5, 5]], [[1, 2], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5], [1, 2, 3, 5], [1, 2, 4], [1, 2, 4, 5], [1, 2, 5], [1, 3], [1, 3, 4], [1, 3, 4, 5], [1, 3, 5], [1, 4], [1, 4, 5], [1, 5], [2, 3], [2, 3, 4], [2, 3, 4, 5], [2, 3, 5], [2, 4], [2, 4, 5], [2, 5], [3, 4], [3, 4, 5], [3, 5], [4, 5]], [], [[1, 1], [1, 1, 2], [1, 1, 2, 2], [1, 2], [1, 2, 2], [2, 2]], [[2, 2], [2, 2, 2], [1, 2], [1, 2, 2], [1, 1], [1, 1, 2]], [[0, 0], [0, 0, 0], [0, 0, 0, 1], [0, 0, 1], [0, 1]], [[-1, 0], [-1, 0, 1], [-1, 1], [0, 1]], [[-2, -1], [-2, -1, -1], [-2, -1, -1, 0], [-2, -1, 0], [-2, 0], [-1, -1], [-1, -1, 0], [-1, 0]], [[1, 2], [1, 2, 3], [1, 2, 3, 3], [1, 2, 2], [1, 2, 2, 3], [1, 3], [1, 3, 3], [1, 1], [1, 1, 2], [1, 1, 2, 3], [1, 1, 3], [2, 3], [2, 3, 3], [2, 2], [2, 2, 3], [3, 3]], [[7, 7], [7, 7, 7], [7, 7, 7, 7], [7, 7, 7, 7, 7]], [[4, 4], [4, 4, 4], [4, 4, 4, 4], [3, 4]], [[1, 3], [1, 3, 5], [1, 3, 5, 6], [1, 3, 4], [1, 3, 4, 6], [1, 3, 6], [1, 5], [1, 5, 6], [1, 2], [1, 2, 4], [1, 2, 4, 6], [1, 2, 6], [1, 4], [1, 4, 6], [1, 6], [3, 5], [3, 5, 6], [3, 4], [3, 4, 6], [3, 6], [5, 6], [2, 4], [2, 4, 6], [2, 6], [4, 6]], [[2, 2]], [[1, 2]], [], [[100, 100], [-100, 100]], [[1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 2], [1, 1, 1, 2], [1, 1, 2], [1, 2]], [[3, 3], [2, 2], [1, 1]]], "loose": true}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "639", "slug": "non-negative-integers-without-consecutive-ones", "id": 639, "title": "Non-negative Integers without Consecutive Ones", "difficulty": "Hard", "category": "dp", "link": "https://leetcode.com/problems/non-negative-integers-without-consecutive-ones/", "examples": [{"input": "n = 5", "output": "5", "explanation": "Values 0,1,2,4,5 qualify; 3 is 11 in binary."}, {"input": "n = 1", "output": "2", "explanation": "Both 0 and 1 qualify."}, {"input": "n = 2", "output": "3", "explanation": "Values 0,1,2 qualify."}], "hints": ["Count binary strings without adjacent ones using Fibonacci numbers.", "Scan bits from high to low, adding block counts when a 1 appears.", "Stop early on consecutive ones; otherwise add one for n itself."], "statement": "Count how many integers `x` with `0 <= x <= n` have no two adjacent `1` bits in binary. For example 5 is `101` and qualifies, while 3 is `11` and does not.\n\n**Constraints:**\n- `0 <= n <= 10^9`.\n", "solution": "## Approach\n\nLet f[k] count binary strings of length k without adjacent ones (Fibonacci). Walking the bits of n from the top, each 1 lets the lower k bits vary freely, contributing f[k]; meeting two ones in a row ends the walk, otherwise n itself counts once more.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(31).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def findIntegers(self, n: int) -> int:\n f = [1, 2] + [0] * 30\n for i in range(2, 32):\n f[i] = f[i-1] + f[i-2]\n ans, prev = 0, 0\n for k in range(30, -1, -1):\n if (n >> k) & 1:\n ans += f[k]\n if prev:\n return ans\n prev = 1\n else:\n prev = 0\n return ans + 1\n```\n", "starter": {"go": "package main\n\nfunc FindIntegers(n int) int {\n return 0\n}", "python": "class Solution:\n def findIntegers(self, n: int) -> int:\n pass", "cpp": "using namespace std;\nclass Solution {\npublic:\n int findIntegers(int n) {\n return 0;\n }\n};"}, "fn": "findIntegers", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["5"], ["1"], ["2"], ["0"], ["3"], ["4"], ["6"], ["7"], ["8"], ["9"], ["10"], ["11"], ["12"], ["13"], ["20"], ["100"], ["1000"], ["10000"], ["100000"], ["1000000"], ["10000000"], ["100000000"], ["1000000000"], ["15"], ["16"], ["21"], ["42"], ["99"]], "expected": [5, 2, 3, 1, 3, 4, 5, 5, 6, 7, 8, 8, 8, 8, 12, 34, 144, 843, 4181, 17711, 103682, 514229, 2178309, 8, 9, 13, 21, 34], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "37", "slug": "non-overlapping-intervals", "id": 37, "title": "Non-overlapping Intervals", "difficulty": "Medium", "category": "interval", "link": "https://leetcode.com/problems/non-overlapping-intervals/", "examples": [{"input": "intervals = [[1,2],[2,3],[3,4],[1,3]]", "output": "1", "explanation": "Remove [1,3] and the remaining intervals [[1,2],[2,3],[3,4]] have no overlaps, so 1 removal is enough. Intervals that only touch (one ends exactly when another starts) are not considered overlapping."}, {"input": "intervals = [[1,2],[1,2],[1,2]]", "output": "2", "explanation": "There are 2 overlapping intervals that must be removed to eliminate all overlaps."}, {"input": "intervals = [[1,2],[2,3]]", "output": "0", "explanation": "No intervals overlap, so 0 removals are needed."}], "hints": ["Sort intervals by end time and greedily keep intervals with the earliest finishing time.", "Track the end of the last kept interval; when an interval starts < lastEnd, count a removal, else update lastEnd.", "This is equivalent to selecting a maximum set of non-overlapping intervals. Answer = n - size of that set."], "statement": "You are given an array `intervals` of start/end pairs. Delete as few of them as possible so that the survivors are pairwise non-overlapping. Return that smallest deletion count.\n\nTwo intervals that meet only at an endpoint do not count as overlapping. As an illustration, `[1, 2]` and `[2, 3]` may both be kept.\n\n**Constraints:**\n\n- 1 \u2264 intervals.length \u2264 10^5\n- intervals[i].length == 2\n- -5 * 10^4 \u2264 starti < endi \u2264 5 * 10^4\n", "solution": "## Approach\n\nSort intervals by end time and greedily select the interval that finishes earliest. Whenever a new interval starts before the last selected interval ends, count it as an overlap to remove.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n log n)\n- **Space Complexity:** O(1)\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:\n intervals.sort(key=lambda x: x[1])\n cnt = 0\n end = float('-inf')\n for s, e in intervals:\n if s < end:\n cnt += 1\n else:\n end = e\n return cnt\n```\n", "starter": {"go": "package main\n\nfunc EraseOverlapIntervals(intervals [][]int) int {\n \n}", "python": "from typing import List\nclass Solution:\n def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:\n pass\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int eraseOverlapIntervals(vector<vector<int>>& intervals) {\n return 0;\n }\n};"}, "fn": "eraseOverlapIntervals", "params": [{"name": "intervals", "type": "int_array_2d"}], "outputType": "int", "tests": [["[[1,2],[2,3],[3,4],[1,3]]"], ["[[1,2],[1,2],[1,2]]"], ["[[1,2],[2,3]]"], ["[[1,100],[11,22],[1,11],[2,12]]"], ["[[0,2],[1,3],[2,4],[3,5],[4,6]]"], ["[[1,2]]"], ["[[1,2],[2,3],[3,4],[4,5]]"], ["[[1,10],[2,3],[4,5]]"], ["[[1,2],[1,2],[2,3],[2,3]]"], ["[[5,6],[5,6],[5,6],[5,6]]"], ["[[-5,-4],[-4,-3],[-3,-2],[-2,1]]"], ["[[1,100],[1,100],[2,50],[3,25],[4,10]]"], ["[[-50000,50000]]"], ["[[-50000,-49999],[49999,50000]]"], ["[[0,1]]"], ["[[-10,10]]"], ["[[1,3],[2,4],[3,5]]"], ["[[1,5],[2,3],[3,6],[4,7]]"], ["[[-5,0],[0,5],[-5,5]]"], ["[[1,4],[2,3]]"], ["[[3,5],[1,2],[2,3],[4,6]]"], ["[[-2,2],[-2,2],[0,1]]"], ["[[10,20],[20,30],[30,40]]"], ["[[10,20],[15,25],[20,30],[25,35]]"], ["[[1,10],[2,9],[3,8],[4,7]]"], ["[[-3,-1],[-2,0],[0,2],[1,3]]"], ["[[5,10],[0,6],[1,2],[3,4]]"], ["[[0,5],[5,10],[0,10]]"], ["[[-100,100],[90,95],[91,92]]"], ["[[1,2],[3,4],[5,6],[7,8],[2,3],[4,5],[6,7]]"]], "expected": [1, 2, 0, 2, 2, 0, 0, 1, 2, 3, 0, 4, 0, 0, 0, 0, 1, 2, 1, 1, 1, 2, 0, 2, 3, 2, 1, 1, 2, 0], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "474", "slug": "nth-digit", "id": 474, "title": "Nth Digit", "difficulty": "Medium", "category": "math", "link": "https://leetcode.com/problems/nth-digit/", "examples": [{"explanation": "The prefix is \"123...\", so position 3 holds 3.", "input": "n = 3", "output": "3"}, {"explanation": "Positions 10-11 hold \"10\"; the second is 0.", "input": "n = 11", "output": "0"}, {"explanation": "Position 15 is the '2' of 12.", "input": "n = 15", "output": "2"}], "hints": ["Group numbers by digit length: 9 one-digit, 90 two-digit, 900 three-digit, and so on.", "Subtract whole groups from n until the target group is found.", "Within the group, locate the exact number and the digit offset inside it."], "statement": "Write out all positive integers in order, glued together into one endless digit string: `12345678910111213...`. Given a one-based position `n` into that string, report which digit sits there.\n\nFor example, positions `1` through `9` hold `1` through `9`, position `10` holds the `'1'` of `10`, and position `11` holds the `'0'` of `10`.\n\n**Constraints:**\n- `1 <= n <= 2^31 - 1`\n", "solution": "## Approach\n\nNumbers with the same digit length form blocks: 9 numbers use 1 digit each, 90 use 2 each, 900 use 3 each, and so on. Subtract whole blocks from `n` until the block holding the answer is reached. Then divide the remaining offset by the block's digit length to pick the exact number, and use the remainder to pick the digit inside that number's decimal text.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log n), one step per digit length.\n- **Space Complexity:** O(log n) for the number's string form.\n\n## Implementation\n\n```python\nclass Solution:\n def findNthDigit(self, n: int) -> int:\n pos = n\n length = 1\n count = 9\n start = 1\n while pos > length * count:\n pos -= length * count\n length += 1\n count *= 10\n start *= 10\n num = start + (pos - 1) // length\n idx = (pos - 1) % length\n return int(str(num)[idx])\n```\n", "starter": {"go": "package main\n\nfunc FindNthDigit(n int) int {\n return 0\n}", "python": "class Solution:\n def findNthDigit(self, n: int) -> int:\n pass", "cpp": "class Solution {\npublic:\n int findNthDigit(int n) {\n return 0;\n }\n};"}, "fn": "findNthDigit", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["3"], ["11"], ["15"], ["1"], ["9"], ["10"], ["12"], ["13"], ["14"], ["19"], ["20"], ["100"], ["101"], ["1000"], ["10000"], ["100000"], ["1000000"], ["10000000"], ["100000000"], ["1000000000"], ["2147483647"], ["190"], ["191"], ["192"], ["2889"], ["2890"], ["2891"], ["11"], ["9"], ["21"]], "expected": [3, 0, 2, 1, 9, 1, 1, 1, 1, 4, 1, 5, 5, 3, 7, 2, 1, 7, 8, 1, 2, 1, 0, 0, 9, 1, 0, 0, 9, 5], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "870", "slug": "nth-magical-number", "id": 870, "title": "Nth Magical Number", "difficulty": "Hard", "category": "math", "link": "https://leetcode.com/problems/nth-magical-number/", "examples": [{"input": "n = 1, a = 2, b = 3", "output": "2", "explanation": "The magical numbers start 2, 3, 4, 6, 8, ..., so the first one is 2."}, {"input": "n = 4, a = 2, b = 3", "output": "6", "explanation": "Listing them in order gives 2, 3, 4, 6, so the fourth is 6."}, {"input": "n = 5, a = 2, b = 4", "output": "10", "explanation": "Every even number is magical here, so the fifth one is 10."}], "hints": ["Count how many magical numbers are at most x with x/a + x/b - x/lcm(a,b), then binary search the smallest x whose count reaches n.", "Use 64-bit integers for the search bounds and take the result modulo 10^9 + 7 only at the very end."], "statement": "A positive integer counts as magical when it is divisible by `a` or by `b`. Given `n`, `a` and `b`, return the `n`-th magical number. Because the answer can be huge, return it modulo `10^9 + 7`.\n\n**Constraints:**\n- `1 <= n <= 10^9`\n- `2 <= a, b <= 4 * 10^4`\n", "solution": "## Approach\n\nThe count of magical numbers up to `x` follows from inclusion-exclusion: multiples of `a` plus multiples of `b` minus multiples of their least common multiple. That count grows monotonically, so binary search finds the smallest `x` with a count of at least `n`. All search arithmetic uses 64-bit integers, and the modulo `10^9 + 7` is applied once to the final answer.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log(n * min(a, b))) for the binary search, with O(log(min(a, b))) extra for the gcd.\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nimport math\n\nclass Solution:\n def nthMagicalNumber(self, n: int, a: int, b: int) -> int:\n MOD = 1000000007\n l = a // math.gcd(a, b) * b\n lo, hi = 1, n * min(a, b)\n while lo < hi:\n mid = (lo + hi) // 2\n if mid // a + mid // b - mid // l >= n:\n hi = mid\n else:\n lo = mid + 1\n return lo % MOD\n```\n", "starter": {"go": "package main\n\nfunc NthMagicalNumber(n int, a int, b int) int {\n \n}", "python": "class Solution:\n def nthMagicalNumber(self, n: int, a: int, b: int) -> int:\n pass", "cpp": "class Solution {\npublic:\n int nthMagicalNumber(int n, int a, int b) {\n return 0;\n }\n};"}, "fn": "nthMagicalNumber", "params": [{"name": "n", "type": "int"}, {"name": "a", "type": "int"}, {"name": "b", "type": "int"}], "outputType": "int", "tests": [["1", "2", "3"], ["4", "2", "3"], ["5", "2", "4"], ["3", "6", "4"], ["2", "2", "3"], ["3", "2", "3"], ["6", "2", "3"], ["7", "2", "3"], ["10", "2", "3"], ["5", "3", "5"], ["4", "5", "7"], ["3", "4", "6"], ["8", "4", "6"], ["2", "40000", "39999"], ["1", "40000", "40000"], ["64", "6", "8"], ["20", "7", "11"], ["15", "4", "9"], ["9", "5", "5"], ["100", "2", "3"], ["50", "3", "7"], ["30", "9", "12"], ["12", "10", "15"], ["25", "8", "12"], ["7", "13", "17"], ["40", "11", "13"], ["1000000000", "2", "3"], ["1000000000", "40000", "40000"]], "expected": [2, 6, 10, 8, 3, 4, 9, 10, 15, 10, 14, 8, 24, 40000, 40000, 256, 91, 45, 45, 150, 117, 180, 90, 152, 52, 247, 499999993, 999720007], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "540", "slug": "number-complement", "id": 540, "title": "Number Complement", "difficulty": "Easy", "category": "binary", "link": "https://leetcode.com/problems/number-complement/", "examples": [{"input": "num = 5", "output": "2", "explanation": "101 becomes 010."}, {"input": "num = 1", "output": "0", "explanation": "1 becomes 0."}, {"input": "num = 7", "output": "0", "explanation": "111 becomes 000."}], "hints": ["Build a mask of all 1s with the same bit-length as num.", "XOR the mask with num to flip exactly those bits.", "Shifting a 64-bit value avoids overflow when num is near 2^31."], "statement": "Write the binary form of a positive integer without extra leading zeroes, then swap every `0` to `1` and every `1` to `0`. Return the integer value of the swapped form.\n\n**Constraints:**\n\n- `1 <= num < 2^31`\n", "solution": "## Approach\n\nFind how many bits the input actually uses, then make a mask with that many low bits set. XOR-ing the input with the mask flips exactly the meaningful bits while leaving any higher zeroes untouched. Using a wider integer while building the mask keeps the shift safe near the 31-bit limit.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log num), one step per binary digit.\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def findComplement(self, num: int) -> int:\n mask = 0\n t = num\n while t > 0:\n mask = (mask << 1) | 1\n t >>= 1\n return mask ^ num\n```\n", "starter": {"go": "package main\n\nfunc FindComplement(num int) int {\n return 0\n}", "python": "class Solution:\n def findComplement(self, num: int) -> int:\n return 0\n", "cpp": "class Solution {\npublic:\n int findComplement(int num) {\n return 0;\n }\n};"}, "fn": "findComplement", "params": [{"name": "num", "type": "int"}], "outputType": "int", "tests": [["5"], ["1"], ["7"], ["2"], ["3"], ["4"], ["8"], ["10"], ["16"], ["31"], ["32"], ["100"], ["255"], ["256"], ["1000"], ["1024"], ["2147483647"], ["2147483646"], ["1073741824"], ["999999999"], ["6"], ["9"], ["12"], ["15"], ["33"], ["127"], ["512"], ["1000000"]], "expected": [2, 0, 0, 1, 0, 3, 7, 5, 15, 0, 31, 27, 0, 255, 23, 1023, 0, 1, 1073741823, 73741824, 1, 6, 3, 0, 30, 0, 511, 48575], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "12", "slug": "number-of-1-bits", "id": 12, "title": "Number of 1 Bits", "difficulty": "Easy", "category": "binary", "link": "https://leetcode.com/problems/number-of-1-bits/", "examples": [{"input": "n = 11 (0b1011)", "output": "3", "explanation": "The binary representation of 11 is 0b1011, which contains 3 bits set to 1."}, {"input": "n = 128 (0b10000000)", "output": "1", "explanation": "The binary representation of 128 is 0b10000000, which contains 1 bit set to 1."}], "hints": ["Use Kernighan's algorithm: repeatedly clear the lowest set bit with n &= (n - 1) and count iterations."], "statement": "Write a function that takes the binary representation of a positive integer and returns the number of '1' bits it has (the Hamming weight).\n\n**Constraints:**\n\n- 1 \u2264 n \u2264 2^31 - 1\n", "solution": "## Approach\n\nIterate through each bit of the input integer, checking if the least significant bit is set using `n & 1`, then shift right. Count the number of set bits.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(k) where k is the number of bits\n- **Space Complexity:** O(1)\n\n## Implementation\n\n```python\nclass Solution:\n def hammingWeight(self, n: int) -> int:\n cnt = 0\n while n:\n cnt += n & 1\n n >>= 1\n return cnt\n```\n", "starter": {"go": "package main\n\nfunc HammingWeight(n int) int {\n \n}", "python": "class Solution:\n def hammingWeight(self, n: int) -> int:\n pass\n", "cpp": "class Solution {\npublic:\n int hammingWeight(uint32_t n) {\n return 0;\n }\n};"}, "fn": "hammingWeight", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["11"], ["128"], ["2147483647"], ["1431655765"], ["614316765"], ["51435765"], ["3145765"], ["21222"], ["1434"], ["1"], ["2"], ["3"], ["7"], ["15"], ["16"], ["31"], ["255"], ["1023"], ["65535"], ["1000000"], ["123456789"], ["1000000000"], ["2147483646"], ["2147483645"], ["1365"], ["65536"], ["1073741824"], ["999999999"], ["42"], ["429496729"]], "expected": [3, 1, 31, 16, 18, 13, 5, 8, 6, 1, 1, 2, 3, 4, 1, 5, 8, 10, 16, 7, 16, 13, 30, 30, 6, 1, 1, 21, 3, 15], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "733", "slug": "number-of-atoms", "id": 733, "title": "Number of Atoms", "difficulty": "Hard", "category": "stack", "link": "https://leetcode.com/problems/number-of-atoms/", "examples": [{"input": "formula = \"H2O\"", "output": "\"H2O\"", "explanation": "Two H and one O; the count 1 is hidden."}, {"input": "formula = \"Mg(OH)2\"", "output": "\"H2MgO2\"", "explanation": "Doubling (OH) yields H2, Mg and O2 in sorted order."}, {"input": "formula = \"K4(ON(SO3)2)2\"", "output": "\"K4N2O14S4\""}], "hints": ["Scan with a stack of count maps: push a fresh map on '(' and pop on ')', multiplying the popped counts before merging.", "Parse element names as one uppercase letter plus following lowercase letters, then read the optional digits as the multiplier.", "Sort the final keys alphabetically and skip the digit 1 when building the answer."], "statement": "A chemical formula is written with element names, multipliers, and parentheses:\n\n- An element name starts with one uppercase letter and may be followed by lowercase letters (for example `H`, `Mg`, `He`).\n- A number written right after an element or a closing parenthesis tells how many copies to take. When no number is present, the count is one.\n- Parentheses group a section; a number after `)` multiplies every count inside that group. Groups may nest.\n\nGiven such a formula, compute how many atoms of each element it holds. Return a compact string that lists every distinct element in alphabetical order, writing the element name followed by its count, but leaving out the count when it equals one.\n\n**Constraints:**\n- `1 <= formula.length <= 1000`\n- Element names, digits and parentheses only; parentheses are balanced and the formula is valid.\n", "solution": "## Approach\n\nWalk the formula left to right while keeping a stack of frequency tables. An opening bracket pushes a new table; an element name adds its parsed count to the table on top; a closing bracket pops the table, scales every entry by the multiplier that follows, and merges it downward. At the end one table remains, which is printed with keys sorted and counts of one hidden.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n log m), where n is the formula length and m the number of distinct elements, dominated by the final sort.\n- **Space Complexity:** O(n) for the stack of tables in deeply nested input.\n\n## Implementation\n\n```python\nclass Solution:\n def countOfAtoms(self, formula: str) -> str:\n stack = [dict()]\n i, n = 0, len(formula)\n while i < n:\n c = formula[i]\n if c == '(':\n stack.append(dict())\n i += 1\n elif c == ')':\n i += 1\n j = i\n while j < n and formula[j].isdigit():\n j += 1\n mult = int(formula[i:j]) if j > i else 1\n i = j\n top = stack.pop()\n for k, v in top.items():\n stack[-1][k] = stack[-1].get(k, 0) + v * mult\n else:\n j = i + 1\n while j < n and formula[j].islower():\n j += 1\n name = formula[i:j]\n k = j\n while k < n and formula[k].isdigit():\n k += 1\n cnt = int(formula[j:k]) if k > j else 1\n stack[-1][name] = stack[-1].get(name, 0) + cnt\n i = k\n parts = []\n for k in sorted(stack[0]):\n parts.append(k)\n if stack[0][k] > 1:\n parts.append(str(stack[0][k]))\n return \"\".join(parts)\n```\n", "starter": {"go": "package main\n\nfunc CountOfAtoms(formula string) string {\n return \"\"\n}", "python": "class Solution:\n def countOfAtoms(self, formula: str) -> str:\n return \"\"\n", "cpp": "#include <string>\nusing namespace std;\nclass Solution {\npublic:\n string countOfAtoms(string formula) {\n return \"\";\n }\n};"}, "fn": "countOfAtoms", "params": [{"name": "formula", "type": "string"}], "outputType": "string", "tests": [["H2O"], ["Mg(OH)2"], ["K4(ON(SO3)2)2"], ["H"], ["O2"], ["H2O2"], ["C6H12O6"], ["NaCl"], ["Be32"], ["((H)2)3"], ["Mg2(OH)3"], ["Fe2(SO4)3"], ["Al2(SO4)3"], ["C2H6O"], ["C2H4O2"], ["((Be)2)2"], ["A2(B3(C4)5)6"], ["Z"], ["XY2Z3"], ["H2(H2(H2)2)2"], ["Na2(CO3)2"], ["Ca(OH)2"], ["NH3"], ["H2SO4"], ["C12H22O11"], ["U"], ["He2O3He"], ["(H2O)10"]], "expected": ["H2O", "H2MgO2", "K4N2O14S4", "H", "O2", "H2O2", "C6H12O6", "ClNa", "Be32", "H6", "H3Mg2O3", "Fe2O12S3", "Al2O12S3", "C2H6O", "C2H4O2", "Be4", "A2B18C120", "Z", "XY2Z3", "H14", "C2Na2O6", "CaH2O2", "H3N", "H2O4S", "C12H22O11", "U", "He3O3", "H20O10"], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "515", "slug": "number-of-boomerangs", "id": 515, "title": "Number of Boomerangs", "difficulty": "Medium", "category": "hash-table", "link": "https://leetcode.com/problems/number-of-boomerangs/", "examples": [{"input": "points = [[0,0],[1,0],[2,0]]", "output": "2", "explanation": "Middle index 1 with outer orderings (0,2) and (2,0)."}, {"input": "points = [[1,1],[2,2],[3,3]]", "output": "2", "explanation": "Middle index 1 sees equal gaps to the other two."}, {"input": "points = [[1,1]]", "output": "0", "explanation": "Fewer than three points."}], "hints": ["Fix the middle index first, then group the other points by squared distance from it.", "A group of size c contributes c*(c-1) ordered outer pairs.", "Squared distances avoid floating point and fit in 64-bit math."], "statement": "You are given distinct points `points` on a plane, each written as `[x, y]`. A boomerang is an ordered triple `(i, j, k)` of different indices where point `i` sits equally far from `j` and `k`. The order of the two outer points matters, so `(i,j,k)` and `(i,k,j)` count as two boomerangs when both qualify.\n\nReturn the total number of boomerangs.\n\nDistances are compared by squared length, so no square roots are needed.\n\n**Constraints:**\n- `1 <= points.length <= 500`\n- Each point is `[x, y]` with `-10^4 <= x, y <= 10^4`.\n- All points are distinct.\n", "solution": "## Approach\n\nTreat every point in turn as the middle. Measure squared distances to all other points and tally how many share each distance. A distance group of size `c` yields `c*(c-1)` ordered outer pairs, since either member can come first. Summing over all middles gives the total.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2), one distance per ordered pair of distinct points.\n- **Space Complexity:** O(n) for the distance tally of the current middle.\n\n## Implementation\n\n```python\nfrom typing import List\nfrom collections import defaultdict\nclass Solution:\n def numberOfBoomerangs(self, points: List[List[int]]) -> int:\n ans = 0\n n = len(points)\n for i in range(n):\n freq = defaultdict(int)\n xi, yi = points[i]\n for j in range(n):\n if i == j:\n continue\n dx = xi - points[j][0]\n dy = yi - points[j][1]\n freq[dx * dx + dy * dy] += 1\n for c in freq.values():\n ans += c * (c - 1)\n return ans\n```\n", "starter": {"go": "package main\n\nfunc NumberOfBoomerangs(points [][]int) int {\n return 0\n}", "python": "from typing import List\nclass Solution:\n def numberOfBoomerangs(self, points: List[List[int]]) -> int:\n pass", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int numberOfBoomerangs(vector<vector<int>>& points) {\n return 0;\n }\n};"}, "fn": "numberOfBoomerangs", "params": [{"name": "points", "type": "int_array_2d"}], "outputType": "int", "tests": [["[[0,0],[1,0],[2,0]]"], ["[[1,1],[2,2],[3,3]]"], ["[[1,1]]"], ["[[0,0],[1,0],[0,1],[1,1]]"], ["[[0,0],[2,0],[1,1]]"], ["[[0,0],[1,0],[2,0],[3,0]]"], ["[[0,0],[0,1],[0,2]]"], ["[[1,0],[-1,0],[0,1],[0,-1]]"], ["[[0,0]]"], ["[[5,5],[5,6],[5,7]]"], ["[[0,0],[1,1],[2,0],[1,-1]]"], ["[[3,4],[5,6],[7,8]]"], ["[[0,0],[3,0],[0,4]]"], ["[[-1,-1],[1,1],[2,2]]"], ["[[0,0],[1,1],[2,2],[3,3]]"], ["[[0,0],[0,2],[2,0],[2,2]]"], ["[[0,0],[1,0],[0,1]]"], ["[[5,5],[6,5],[7,5],[8,5]]"], ["[[0,0],[3,4]]"], ["[[10,10],[20,20]]"], ["[[0,0],[1,0],[0,1],[1,1],[2,2]]"], ["[[-5,-5],[0,0],[5,5]]"], ["[[1,2],[3,4],[5,6],[7,8],[9,10]]"], ["[[0,0],[4,0],[2,3]]"], ["[[100,100],[100,101],[100,102]]"], ["[[0,0],[2,2],[4,4],[1,1]]"], ["[[-10,0],[10,0],[0,10],[0,-10],[0,0]]"], ["[[1,1],[1,2],[2,1],[2,2]]"]], "expected": [2, 2, 0, 8, 2, 4, 2, 8, 0, 2, 8, 2, 0, 0, 4, 8, 2, 4, 0, 0, 12, 2, 8, 2, 2, 4, 20, 8], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "34", "slug": "number-of-connected-components-in-an-undirected-graph", "id": 34, "title": "Number of Connected Components in an Undirected Graph", "difficulty": "Medium", "category": "graph", "link": "https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/", "examples": [{"input": "n=5, edges=[[0,1],[1,2],[3,4]]", "output": "2", "explanation": "The 5 nodes with 3 edges form 2 connected components."}, {"input": "n=5, edges=[[0,1],[1,2],[2,3],[3,4]]", "output": "1", "explanation": "The 5 nodes with 4 edges form 1 connected component."}], "hints": ["Use Union-Find to union endpoints and count unique roots, or BFS/DFS to count visited components."], "statement": "Given n nodes labeled 0..n-1 and a list of undirected edges, return the number of connected components.\n\n**Constraints:**\n\n- 1 <= n <= 2000\n- 0 <= edges.length <= 10^4\n- edges[i].length == 2\n- 0 <= ai, bi < n\n", "solution": "## Approach\n\nUse Union-Find with path compression and union by rank to connect nodes. Each successful union decreases the component count, starting from n.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n * \u03b1(n))\n- **Space Complexity:** O(n)\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def countComponents(self, n: int, edges: List[List[int]]) -> int:\n parent = list(range(n))\n rank = [0] * n\n def find(x):\n if parent[x] != x:\n parent[x] = find(parent[x])\n return parent[x]\n def union(x, y):\n rx, ry = find(x), find(y)\n if rx == ry:\n return False\n if rank[rx] < rank[ry]:\n parent[rx] = ry\n elif rank[rx] > rank[ry]:\n parent[ry] = rx\n else:\n parent[ry] = rx\n rank[rx] += 1\n return True\n for u, v in edges:\n if union(u, v):\n n -= 1\n return n\n```\n", "starter": {"go": "package main\n\nfunc CountComponents(n int, edges [][]int) int {\n \n}", "python": "from typing import List\nclass Solution:\n def countComponents(self, n: int, edges: List[List[int]]) -> int:\n pass\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int countComponents(int n, vector<vector<int>>& edges) {\n return 0;\n }\n};"}, "fn": "countComponents", "params": [{"name": "n", "type": "int"}, {"name": "edges", "type": "int_array_2d", "visualizeType": "undirected_edges", "numNodesRef": "n"}], "outputType": "int", "tests": [["5", "[[0,1],[1,2],[3,4]]"], ["5", "[[0,1],[1,2],[2,3],[3,4]]"], ["4", "[]"], ["1", "[]"], ["3", "[[0,1]]"], ["2", "[]"], ["2", "[[0,1]]"], ["3", "[]"], ["3", "[[0,1],[1,2]]"], ["3", "[[0,1],[1,2],[0,2]]"], ["4", "[[0,1],[2,3]]"], ["4", "[[0,1],[1,2],[2,3]]"], ["4", "[[0,1],[0,2],[0,3]]"], ["5", "[]"], ["5", "[[0,1],[2,3]]"], ["6", "[[0,1],[1,2],[3,4],[4,5]]"], ["6", "[]"], ["6", "[[0,1],[0,2],[0,3],[0,4],[0,5]]"], ["7", "[[0,1],[2,3],[4,5]]"], ["8", "[[0,1],[1,2],[2,3],[4,5],[5,6],[6,7]]"], ["10", "[]"], ["10", "[[0,1],[2,3],[4,5],[6,7],[8,9]]"], ["5", "[[0,1],[1,2],[2,0],[3,4]]"], ["6", "[[0,1],[2,3],[4,5],[1,2]]"], ["9", "[[0,1],[1,2],[3,4],[5,6],[7,8]]"], ["4", "[[0,2],[1,3]]"], ["5", "[[0,4],[1,4],[2,4],[3,4]]"], ["7", "[[0,6],[1,2],[3,4]]"], ["8", "[[0,7]]"], ["9", "[]"]], "expected": [2, 1, 4, 1, 2, 2, 1, 3, 1, 1, 2, 1, 1, 5, 3, 2, 6, 1, 4, 2, 10, 5, 2, 2, 4, 2, 1, 4, 7, 9], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "753", "slug": "number-of-corner-rectangles", "id": 753, "title": "Number Of Corner Rectangles", "difficulty": "Medium", "category": "matrix", "link": "https://leetcode.com/problems/number-of-corner-rectangles/", "examples": [{"input": "grid = [[1,0,0,1,0],[0,0,1,0,1],[0,0,0,1,0],[1,0,1,0,1]]", "output": "1", "explanation": "Only rows 1,3 with columns 2,4 form all-one corners."}, {"input": "grid = [[1,1,1],[1,1,1],[1,1,1]]", "output": "9", "explanation": "3 row pairs times 3 column pairs."}, {"input": "grid = [[1,1,1,1]]", "output": "0", "explanation": "Need two distinct rows."}], "hints": ["Fix one row at a time and look at every pair of 1s inside it as a potential base.", "Keep a table counting how many earlier rows already contained each column pair; each prior occurrence closes that many new rectangles.", "Summing over rows gives an O(m * n^2) scan with O(n^2) memory."], "statement": "You are given a binary grid `grid` holding only `0` and `1`.\n\nAn axis-aligned corner rectangle is a choice of two different rows `r1 < r2` and two different columns `c1 < c2` such that all four crossings `(r1,c1)`, `(r1,c2)`, `(r2,c1)` and `(r2,c2)` hold `1`. Cells inside or on the edges may be anything; only the four corners matter.\n\nReturn how many such rectangles appear in the grid.\n\n**Constraints:**\n- `m == grid.length`, `n == grid[i].length`\n- `1 <= m <= 200`\n- `1 <= n <= 200`\n- Each entry is `0` or `1`.\n- The count fits in a 32-bit signed integer.\n", "solution": "## Approach\n\nHandle rows from top to bottom while remembering, for every column pair, how many earlier rows held ones in both columns. Within the current row, each pair of ones can close one rectangle with every earlier row that shared the pair, so add the stored count and then increment it. This counts each rectangle once at its lower row.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(m * n^2), where m is the row count and n is the column count, from enumerating column pairs per row.\n- **Space Complexity:** O(n^2) for the pair counters.\n\n## Implementation\n\n```python\nfrom typing import List\nfrom collections import defaultdict\nclass Solution:\n def countCornerRectangles(self, grid: List[List[int]]) -> int:\n ans = 0\n cnt = defaultdict(int)\n for row in grid:\n ones = [i for i, v in enumerate(row) if v == 1]\n for a in range(len(ones)):\n for b in range(a + 1, len(ones)):\n key = (ones[a], ones[b])\n ans += cnt[key]\n cnt[key] += 1\n return ans\n```\n", "starter": {"go": "package main\n\nfunc CountCornerRectangles(grid [][]int) int {\n return 0\n}", "python": "from typing import List\nclass Solution:\n def countCornerRectangles(self, grid: List[List[int]]) -> int:\n pass", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int countCornerRectangles(vector<vector<int>>& grid) {\n return 0;\n }\n};"}, "fn": "countCornerRectangles", "params": [{"name": "grid", "type": "int_array_2d"}], "outputType": "int", "tests": [["[[1,0,0,1,0],[0,0,1,0,1],[0,0,0,1,0],[1,0,1,0,1]]"], ["[[1,1,1],[1,1,1],[1,1,1]]"], ["[[1,1,1,1]]"], ["[[0,0,0],[0,0,0]]"], ["[[1]]"], ["[[0]]"], ["[[1,1],[1,1]]"], ["[[1,0,1],[0,0,0],[1,0,1]]"], ["[[1,0,1],[1,0,1]]"], ["[[1,1,0],[1,1,0],[0,0,0]]"], ["[[1,1,1,1],[1,1,1,1]]"], ["[[1,0],[1,0],[1,0]]"], ["[[1,1],[1,1],[1,1]]"], ["[[0,1,0,1,0],[1,0,1,0,1]]"], ["[[1,0,0,0,1],[0,0,0,0,0],[1,0,0,0,1]]"], ["[[1,1,0,0],[1,1,0,0],[0,0,1,1],[0,0,1,1]]"], ["[[1,0,1,0,1],[0,1,0,1,0],[1,0,1,0,1]]"], ["[[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]]"], ["[[1],[1],[1]]"], ["[[1,0],[0,1]]"], ["[[1,1,0,1],[0,1,1,0],[1,0,1,1]]"], ["[[0,0,0,0],[0,0,0,0],[0,0,0,0]]"], ["[[1,0,0],[0,1,0],[0,0,1]]"], ["[[1,1,1,0,0],[1,1,1,0,0],[1,1,1,0,0]]"], ["[[1,0,1],[0,1,0],[1,0,1],[0,1,0]]"], ["[[1,1],[0,0],[1,1]]"], ["[[1,0,0,1],[0,0,0,0],[1,0,0,1]]"], ["[[1,1,0,1,1],[1,1,0,1,1]]"]], "expected": [1, 9, 0, 0, 0, 0, 1, 1, 1, 1, 6, 0, 3, 0, 1, 2, 3, 36, 0, 0, 1, 0, 0, 9, 1, 1, 1, 6], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "343", "slug": "number-of-digit-one", "id": 343, "title": "Number of Digit One", "difficulty": "Hard", "category": "math", "link": "https://leetcode.com/problems/number-of-digit-one/", "examples": [{"input": "n = 13", "output": "6", "explanation": "The digit 1 occurs once each in 1, 10, 12, 13, and twice in 11."}, {"input": "n = 0", "output": "0", "explanation": "The only value considered is 0, which contains no digit 1."}], "hints": ["Process the number one decimal position at a time using a place factor of 1, 10, 100, ...", "For each position, split n into higher, current, and lower parts to count full cycles plus any partial cycle."], "statement": "Given a non-negative integer `n`, count how many times the digit `1` appears across every integer from `0` to `n` inclusive.\n\nFor instance, when `n` is `13`, the digit `1` shows up in `1`, `10`, `11` (twice), `12`, and `13`, for a total of `6` occurrences.\n\nReturn that total count.\n\n**Constraints:**\n- `0 <= n <= 10^9`\n", "solution": "## Approach\n\nScan the decimal positions from right to left with a place factor of 1, 10, 100, and so on. At each position, divide `n` into the higher part, the current digit, and the lower part. Positions with a current digit of 0 contribute only the complete cycles before them, a current digit of 1 adds one partial cycle covering the lower part, and larger digits add a full extra cycle.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log n), one step per decimal digit.\n- **Space Complexity:** O(1), only a few counters.\n\n## Implementation\n\n```python\nclass Solution:\n def countDigitOne(self, n: int) -> int:\n count = 0\n factor = 1\n while factor <= n:\n lower = n % factor\n cur = (n // factor) % 10\n higher = n // (factor * 10)\n if cur == 0:\n count += higher * factor\n elif cur == 1:\n count += higher * factor + lower + 1\n else:\n count += (higher + 1) * factor\n factor *= 10\n return count\n```\n", "starter": {"go": "package main\n\nfunc CountDigitOne(n int) int {\n \n}", "python": "class Solution:\n def countDigitOne(self, n: int) -> int:\n pass", "cpp": "class Solution {\npublic:\n int countDigitOne(int n) {\n return 0;\n }\n};"}, "fn": "countDigitOne", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["13"], ["0"], ["1"], ["9"], ["10"], ["11"], ["20"], ["99"], ["100"], ["101"], ["110"], ["111"], ["1000"], ["10000"], ["12345"], ["100000"], ["1000000"], ["1000000000"], ["999999999"], ["824883294"], ["2"], ["5"], ["19"], ["21"], ["10000000"], ["142271"], ["100000000"], ["500000000"]], "expected": [6, 0, 1, 1, 2, 4, 12, 20, 21, 23, 33, 36, 301, 4001, 8121, 50001, 600001, 900000001, 900000000, 767944060, 1, 1, 12, 13, 7000001, 120030, 80000001, 500000000], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "719", "slug": "number-of-distinct-islands-ii", "id": 719, "title": "Number of Distinct Islands II", "difficulty": "Hard", "category": "matrix", "link": "https://leetcode.com/problems/number-of-distinct-islands-ii/", "examples": [{"input": "grid = [[1,1,0,0,0],[1,0,0,0,0],[0,0,0,0,1],[0,0,0,1,1]]", "output": "1", "explanation": "Two L-shaped islands of different sizes? Actually both single-plus-one shapes are rotations of each other, so they count as one shape."}, {"input": "grid = [[1,1,0,0,0],[1,1,0,0,0],[0,0,0,1,1],[0,0,0,1,1]]", "output": "1", "explanation": "Two 2x2 squares are identical under translation, so there is one distinct shape."}, {"input": "grid = [[1,0,0],[0,1,1],[0,0,0]]", "output": "2", "explanation": "A single cell and a domino are different even after rotation or reflection."}], "hints": ["Collect each island with flood fill, then normalize: translate points so the minimum is at the origin and sort them.", "Generate all 8 rotations/reflections of the point set and keep the lexicographically smallest normalized encoding as the canonical key.", "Count distinct canonical keys in a hash set."], "statement": "You are given a binary grid where `1` marks land and `0` marks water. An island is a group of `1` cells joined up, down, left or right.\n\nTwo islands share a shape when one can be shifted, rotated (0, 90, 180 or 270 degrees) and optionally mirrored to match the other exactly. Translation alone is always free; rotation and reflection are also free here (unlike the simpler distinct-islands variant).\n\nReturn how many different shapes appear. For example, a 2x2 block and another 2x2 block elsewhere count once, and an L shape matches its mirror image.\n\n**Constraints:**\n- `1 <= grid.length, grid[i].length <= 50`\n- Each cell is `0` or `1`.\n", "solution": "## Approach\n\nFlood-fill every island to gather its cells. For each island, apply the eight rotation/reflection maps, shift every variant so its minimum lands at the origin, sort the points and encode them. The smallest encoding is the canonical key; equal keys mean equal shapes under the allowed motions. Counting keys gives the answer.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(m*n*log(k)), where the grid has m*n cells and k is the largest island size.\n- **Space Complexity:** O(m*n) for visited flags and point lists.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def numDistinctIslands2(self, grid: List[List[int]]) -> int:\n m, n = len(grid), len(grid[0])\n vis = [[False]*n for _ in range(m)]\n shapes = set()\n for r in range(m):\n for c in range(n):\n if grid[r][c] == 1 and not vis[r][c]:\n pts = []\n stack = [(r, c)]\n vis[r][c] = True\n while stack:\n x, y = stack.pop()\n pts.append((x, y))\n for dx, dy in ((1,0),(-1,0),(0,1),(0,-1)):\n nx, ny = x+dx, y+dy\n if 0 <= nx < m and 0 <= ny < n and not vis[nx][ny] and grid[nx][ny] == 1:\n vis[nx][ny] = True\n stack.append((nx, ny))\n best = None\n for t in range(8):\n tr = []\n for x, y in pts:\n if t == 0: tr.append((x, y))\n elif t == 1: tr.append((x, -y))\n elif t == 2: tr.append((-x, y))\n elif t == 3: tr.append((-x, -y))\n elif t == 4: tr.append((y, x))\n elif t == 5: tr.append((y, -x))\n elif t == 6: tr.append((-y, x))\n else: tr.append((-y, -x))\n mx = min(p[0] for p in tr); my = min(p[1] for p in tr)\n tr = sorted((x-mx, y-my) for x, y in tr)\n s = ';'.join(f\"{x},{y}\" for x, y in tr)\n if best is None or s < best:\n best = s\n shapes.add(best)\n return len(shapes)\n```\n", "starter": {"go": "package main\n\nfunc NumDistinctIslands2(grid [][]int) int {\n return 0\n}", "python": "from typing import List\nclass Solution:\n def numDistinctIslands2(self, grid: List[List[int]]) -> int:\n return 0", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int numDistinctIslands2(vector<vector<int>>& grid) {\n return 0;\n }\n};"}, "fn": "numDistinctIslands2", "params": [{"name": "grid", "type": "int_array_2d"}], "outputType": "int", "tests": [["[[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 1], [0, 0, 0, 1, 1]]"], ["[[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]"], ["[[1, 0, 0], [0, 1, 1], [0, 0, 0]]"], ["[[0, 0, 0], [0, 0, 0], [0, 0, 0]]"], ["[[1]]"], ["[[0]]"], ["[[1, 0], [0, 1]]"], ["[[1, 1], [1, 1]]"], ["[[1, 0, 1], [0, 0, 0], [1, 0, 1]]"], ["[[1, 1, 1], [1, 0, 0], [0, 0, 0]]"], ["[[1, 1, 0], [1, 0, 0], [0, 0, 0]]"], ["[[1, 1, 1, 0], [0, 0, 0, 0], [0, 1, 1, 1]]"], ["[[1, 0, 0, 0], [1, 1, 0, 0], [0, 0, 0, 0]]"], ["[[1, 1], [1, 0]]"], ["[[1, 0, 0], [1, 1, 0], [0, 0, 0]]"], ["[[1, 0, 1, 0], [0, 0, 0, 0], [1, 1, 0, 0]]"], ["[[1, 1, 0, 1], [0, 0, 0, 0], [1, 0, 1, 1]]"], ["[[1, 0], [1, 0], [1, 0]]"], ["[[1, 1, 1], [0, 0, 0], [1, 1, 1]]"], ["[[1, 0, 0, 1], [0, 0, 0, 0], [0, 1, 1, 0]]"], ["[[1, 1, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1]]"], ["[[0, 1, 0], [1, 1, 1], [0, 1, 0]]"], ["[[1, 0, 1], [1, 1, 1], [0, 0, 0]]"], ["[[1, 1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 1, 1]]"], ["[[1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0]]"], ["[[1, 1, 0], [0, 1, 0], [0, 1, 1]]"], ["[[1, 0, 1, 1], [1, 0, 0, 0], [0, 0, 1, 0]]"], ["[[1, 1, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 1, 0]]"]], "expected": [1, 1, 2, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "709", "slug": "number-of-distinct-islands", "id": 709, "title": "Number of Distinct Islands", "difficulty": "Medium", "category": "matrix", "link": "https://leetcode.com/problems/number-of-distinct-islands/", "examples": [{"input": "grid = [[1,1,0,0,0],[1,1,0,0,0],[0,0,0,1,1],[0,0,0,1,1]]", "output": "1", "explanation": "Two 2x2 blocks share one shape."}, {"input": "grid = [[1,1,0,1,1],[1,0,0,0,0],[0,0,0,0,1],[1,1,0,1,1]]", "output": "3", "explanation": "Four islands fall into three shapes."}, {"input": "grid = [[0,0,0],[0,0,0]]", "output": "0", "explanation": "No land."}], "hints": ["Adaptation: input is int_array_2d and output is the integer count of translation-distinct shapes.", "Flood-fill each island and record every cell relative to the island's first cell; sorting those offsets gives a translation-free signature.", "Store signatures in a set; its size is the answer."], "statement": "A rectangular grid holds `0` for water and `1` for land. Cells touching up, down, left or right belong to the same island; diagonal contact does not join islands.\n\nTwo islands share a shape when one can be slid (without rotation or flipping) to cover the other exactly. Count how many different shapes appear.\n\nThis is a portable adaptation: the grid arrives as `int_array_2d` and the answer is the integer shape count.\n\n**Constraints:**\n- `1 <= grid.length, grid[0].length <= 50`\n- Grid entries are `0` or `1`.\n", "solution": "## Approach\n\nScan every cell and flood-fill each undiscovered land mass with an explicit stack over four neighbours. For one island, shift all its cells by the island's minimum row and column, sort the resulting offsets, and join them into a canonical string that is identical exactly for translation-equal shapes. Collecting those strings in a set and reporting its size counts the distinct forms.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(R * C log(R*C)) in the worst case due to sorting island cells; linear without that term.\n- **Space Complexity:** O(R * C) for visited flags and the shape set.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def numDistinctIslands(self, grid: List[List[int]]) -> int:\n R, C = len(grid), len(grid[0])\n seen = [[False]*C for _ in range(R)]\n shapes = set()\n for r in range(R):\n for c in range(C):\n if grid[r][c] == 1 and not seen[r][c]:\n stack = [(r, c)]\n seen[r][c] = True\n cells = []\n while stack:\n cr, cc = stack.pop()\n cells.append((cr, cc))\n for dr, dc in ((1,0),(-1,0),(0,1),(0,-1)):\n nr, nc = cr+dr, cc+dc\n if 0 <= nr < R and 0 <= nc < C and grid[nr][nc] == 1 and not seen[nr][nc]:\n seen[nr][nc] = True\n stack.append((nr, nc))\n minr = min(x for x, _ in cells)\n minc = min(y for _, y in cells)\n sig = tuple(sorted((x-minr, y-minc) for x, y in cells))\n shapes.add(sig)\n return len(shapes)\n```\n", "starter": {"go": "package main\n\nfunc NumDistinctIslands(grid [][]int) int {\n return 0\n}", "python": "from typing import List\nclass Solution:\n def numDistinctIslands(self, grid: List[List[int]]) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int numDistinctIslands(vector<vector<int>>& grid) {\n return 0;\n }\n};"}, "fn": "numDistinctIslands", "params": [{"name": "grid", "type": "int_array_2d"}], "outputType": "int", "tests": [["[[1,1,0,0,0],[1,1,0,0,0],[0,0,0,1,1],[0,0,0,1,1]]"], ["[[1,1,0,1,1],[1,0,0,0,0],[0,0,0,0,1],[1,1,0,1,1]]"], ["[[0,0,0],[0,0,0]]"], ["[[1]]"], ["[[0]]"], ["[[1,1,1],[1,1,1],[1,1,1]]"], ["[[1,0,1],[0,1,0],[1,0,1]]"], ["[[1,1,0],[0,1,1],[0,0,0]]"], ["[[1,0,0],[1,1,0],[0,1,1]]"], ["[[1,1,0,0],[1,0,0,0],[0,0,1,1],[0,0,1,0]]"], ["[[1,0],[0,1]]"], ["[[1,1],[1,0]]"], ["[[1,0,1,0,1]]"], ["[[1],[1],[0],[1],[1]]"], ["[[1,1,1,0,0],[0,0,0,0,0],[0,0,0,1,1]]"], ["[[1,0,0,1],[1,1,0,1],[0,0,0,0],[1,0,1,1]]"], ["[[0,1,0],[1,1,1],[0,1,0]]"], ["[[1,1,0],[1,1,0],[0,0,1]]"], ["[[1,0,1],[1,1,1],[0,0,0]]"], ["[[1,1,1,1]]"], ["[[1],[0],[1],[1]]"], ["[[1,0,0,0,1],[0,0,0,0,0],[1,0,0,0,1]]"], ["[[1,1,0,1],[0,0,0,0],[1,0,1,1]]"], ["[[0,0,1,1],[0,1,1,0],[1,1,0,0]]"], ["[[1,0,1,1,0],[1,1,0,0,0],[0,0,1,1,1]]"], ["[[1,1],[0,0],[1,1]]"], ["[[1,0,0],[0,0,0],[0,0,1]]"], ["[[1,1,1,0,1,1]]"]], "expected": [1, 3, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 2, 1, 1, 2, 1, 2, 1, 3, 1, 1, 2], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "397", "slug": "number-of-islands-ii", "id": 397, "title": "Number of Islands II", "difficulty": "Hard", "category": "graph", "link": "https://leetcode.com/problems/number-of-islands-ii/", "examples": [{"input": "m = 3, n = 3, positions = [[0,0],[0,1],[1,2],[2,1]]", "output": "[1,1,2,3]", "explanation": "Counts evolve as cells join or seed islands."}, {"input": "m = 1, n = 1, positions = [[0,0]]", "output": "[1]", "explanation": "A lone cell is one island."}, {"input": "m = 2, n = 2, positions = [[0,0],[1,1],[0,1]]", "output": "[1,2,1]", "explanation": "The final cell merges two islands."}], "hints": ["Track connected land with a union-find structure that only adds cells.", "Each new cell starts as its own island, then merges with up to four land neighbours.", "Re-adding an existing cell keeps the current count; record it and move on."], "statement": "An `m x n` grid starts as all water. Land cells are added one at a time in the order given\nby `positions` (adding an already-land cell changes nothing). After each addition, report\nhow many islands exist; an island is a group of land cells linked through shared sides.\n\n**Constraints:**\n- `1 <= m, n <= 1000`\n- `1 <= positions.length <= 10^4`\n- Each position lies inside the grid.\n", "solution": "## Approach\n\nDynamic union-find: activate each cell, then union it with land neighbours; the island count rises by one per new cell and falls per successful merge.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(k x a(mn))\n- **Space Complexity:** O(m x n)\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def numIslands2(self, m: int, n: int, positions: List[List[int]]) -> List[int]:\n parent = {}\n def find(x):\n while parent[x] != x:\n parent[x] = parent[parent[x]]\n x = parent[x]\n return x\n res, count = [], 0\n for r, c in positions:\n if (r, c) in parent:\n res.append(count)\n continue\n parent[(r, c)] = (r, c)\n count += 1\n for dr, dc in ((1, 0), (-1, 0), (0, 1), (0, -1)):\n nb = (r + dr, c + dc)\n if nb in parent and find((r, c)) != find(nb):\n parent[find((r, c))] = find(nb)\n count -= 1\n res.append(count)\n return res\n```\n", "starter": {"go": "package main\n\nfunc NumIslands2(m int, n int, positions [][]int) []int {\n return nil\n}", "python": "from typing import List\nclass Solution:\n def numIslands2(self, m: int, n: int, positions: List[List[int]]) -> List[int]:\n ", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> numIslands2(int m, int n, vector<vector<int>>& positions) {\n return {};\n }\n};"}, "fn": "numIslands2", "params": [{"name": "m", "type": "int"}, {"name": "n", "type": "int"}, {"name": "positions", "type": "int_array_2d"}], "outputType": "int_list", "tests": [["3", "3", "[[0,0],[0,1],[1,2],[2,1]]"], ["1", "1", "[[0,0]]"], ["2", "2", "[[0,0],[1,1],[0,1]]"], ["1", "3", "[[0,0],[0,2],[0,1]]"], ["2", "2", "[[0,0],[0,0],[0,0]]"], ["3", "3", "[[0,0],[1,1],[0,1],[1,0],[2,2]]"], ["2", "4", "[[0,1],[0,3],[1,1],[0,0],[1,3]]"], ["2", "3", "[[1,0],[0,0],[0,1],[1,1]]"], ["2", "4", "[[0,0],[0,1],[1,3],[1,0],[1,0],[0,1],[0,0],[1,1]]"], ["2", "4", "[[0,0],[0,1],[1,2],[0,3],[0,2]]"], ["3", "4", "[[0,0],[2,1],[2,2],[1,1],[2,1],[1,1]]"], ["2", "3", "[[0,0],[0,2],[1,2],[0,1],[0,0],[0,1],[1,1],[0,1],[1,2],[1,0]]"], ["1", "3", "[[0,0],[0,2],[0,1],[0,2]]"], ["3", "1", "[[1,0],[1,0],[2,0],[0,0],[0,0],[1,0]]"], ["1", "4", "[[0,1],[0,1],[0,3],[0,2],[0,2],[0,3],[0,1],[0,1],[0,1]]"], ["4", "2", "[[2,0],[3,0]]"], ["2", "3", "[[0,2],[0,0],[1,0],[1,2],[1,0],[1,1],[0,1]]"], ["2", "1", "[[0,0],[0,0],[1,0],[0,0]]"], ["3", "2", "[[1,1],[1,0],[0,0],[0,0],[2,1]]"], ["4", "2", "[[3,0],[0,0],[2,0],[0,0],[0,0],[2,0],[1,1],[2,0]]"], ["4", "4", "[[2,3],[1,2],[3,3]]"], ["1", "3", "[[0,0],[0,2],[0,1],[0,1],[0,2],[0,2],[0,2],[0,1],[0,1],[0,0]]"], ["3", "2", "[[2,0],[2,1],[2,0],[1,1],[2,1],[0,0],[1,0],[0,1]]"], ["1", "1", "[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]]"], ["3", "3", "[[1,1],[1,1],[1,2],[0,1],[0,0],[0,1],[2,1],[1,2]]"], ["1", "4", "[[0,2],[0,3],[0,2],[0,3],[0,2],[0,3],[0,1],[0,0],[0,3]]"], ["4", "3", "[[1,1],[0,0],[2,0],[2,0],[2,1],[3,2],[3,0],[2,0]]"], ["4", "1", "[[2,0],[1,0],[2,0],[1,0],[3,0],[1,0],[0,0]]"], ["1", "3", "[[0,1],[0,0],[0,0],[0,0],[0,2],[0,0],[0,0]]"], ["2", "4", "[[0,2]]"]], "expected": [[1, 1, 2, 3], [1], [1, 2, 1], [1, 2, 1], [1, 1, 1], [1, 2, 1, 1, 2], [1, 2, 2, 2, 2], [1, 1, 1, 1], [1, 1, 2, 2, 2, 2, 2, 2], [1, 1, 2, 3, 1], [1, 2, 2, 2, 2, 2], [1, 2, 2, 1, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 2, 1, 1, 1, 1, 1, 1], [1, 1], [1, 2, 2, 2, 2, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 3, 3], [1, 2, 2], [1, 2, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 2, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 3, 3, 2, 3, 3, 3], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1]], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "30", "slug": "number-of-islands", "id": 30, "title": "Number of Islands", "difficulty": "Medium", "category": "graph", "link": "https://leetcode.com/problems/number-of-islands/", "examples": [{"input": "grid = [[1,1,1,1,0],[1,1,0,1,0],[1,1,0,0,0],[0,0,0,0,0]]", "output": "1", "explanation": "There is 1 island in the 4x5 grid."}, {"input": "grid = [[1,1,0,0,0],[1,1,0,0,0],[0,0,1,0,0],[0,0,0,1,1]]", "output": "3", "explanation": "There are 3 islands in the 4x5 grid."}], "hints": ["Use DFS/BFS to flood-fill each unvisited land cell and count components."], "statement": "Given an m x n binary matrix grid of 0s (water) and 1s (land), return the number of islands. Islands are connected horizontally or vertically.\n\n**Constraints:**\n\n- m == grid.length\n- n == grid[i].length\n- 1 \u2264 m, n \u2264 300\n- grid[i][j] is '0' or '1'.\n", "solution": "## Approach\n\nIterate through the grid and whenever a land cell (1) is found, increment the island count and use DFS to sink the entire connected component by marking visited cells as 0.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(m * n)\n- **Space Complexity:** O(m * n) worst-case recursion depth\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def numIslands(self, grid: List[List[int]]) -> int:\n if not grid or not grid[0]:\n return 0\n m, n = len(grid), len(grid[0])\n def dfs(i, j):\n if i < 0 or i >= m or j < 0 or j >= n or grid[i][j] != 1:\n return\n grid[i][j] = 0\n dfs(i + 1, j)\n dfs(i - 1, j)\n dfs(i, j + 1)\n dfs(i, j - 1)\n cnt = 0\n for i in range(m):\n for j in range(n):\n if grid[i][j] == 1:\n cnt += 1\n dfs(i, j)\n return cnt\n```\n", "starter": {"go": "package main\n\nfunc NumIslands(grid [][]int) int {\n \n}", "python": "from typing import List\nclass Solution:\n def numIslands(self, grid: List[List[int]]) -> int:\n pass\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int numIslands(vector<vector<int>>& grid) {\n return 0;\n }\n};"}, "fn": "numIslands", "params": [{"name": "grid", "type": "int_array_2d", "visualizeType": "matrix"}], "outputType": "int", "tests": [["[[1,1,1,1,0],[1,1,0,1,0],[1,1,0,0,0],[0,0,0,0,0]]"], ["[[1,1,0,0,0],[1,1,0,0,0],[0,0,1,0,0],[0,0,0,1,1]]"], ["[[0]]"], ["[[1]]"], ["[[1,0,1,0,1],[0,1,0,1,0],[1,0,1,0,1]]"], ["[[0,0,0],[0,0,0],[0,0,0]]"], ["[[1,1],[1,1]]"], ["[[1,0,1,0,1]]"], ["[[1],[0],[1],[0],[1]]"], ["[[1,1,0],[0,1,0],[0,0,1]]"], ["[[0,1,0],[1,1,1],[0,1,0]]"], ["[[0,0],[0,0]]"], ["[[1,1,1],[1,1,1],[1,1,1]]"], ["[[0,0,0],[0,1,0],[0,0,0]]"], ["[[1,0],[0,1]]"], ["[[1,1],[0,0]]"], ["[[0,0],[1,1]]"], ["[[1,0,0],[0,0,0],[0,0,1]]"], ["[[1,1,0,0],[0,1,1,0],[0,0,1,1]]"], ["[[1,0,1],[1,0,1],[1,1,1]]"], ["[[0,1],[1,0]]"], ["[[1,1,1,1,1]]"], ["[[0,0,0,0,0]]"], ["[[0],[0],[0]]"], ["[[1],[1],[1]]"], ["[[1,0,0,0,1],[0,0,0,0,0],[1,0,0,0,1]]"], ["[[1,1,0,1,1]]"], ["[[1,0],[1,0],[1,0]]"], ["[[0,1,0,1,0,1]]"], ["[[1,0,0,1],[0,1,1,0]]"]], "expected": [1, 3, 0, 1, 8, 0, 1, 3, 3, 2, 1, 0, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 0, 0, 1, 4, 2, 1, 3, 3], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "804", "slug": "number-of-lines-to-write-string", "id": 804, "title": "Number of Lines To Write String", "difficulty": "Easy", "category": "string", "link": "https://leetcode.com/problems/number-of-lines-to-write-string/", "examples": [{"input": "widths = [10 x 26], s = \"abcdefghijklmnopqrstuvwxyz\"", "output": "[3,60]", "explanation": "Two full lines plus 60 units."}, {"input": "widths = [4,10 x 25], s = \"bbbcccdddaaa\"", "output": "[2,4]", "explanation": "Overflow creates a second line of width 4."}, {"input": "widths = [10 x 26], s = \"a\"", "output": "[1,10]", "explanation": "Single letter, single line."}], "hints": ["Walk the string once, keeping the current line width.", "Start a new line exactly when adding the next width would exceed 100.", "The answer is the line count and the final occupied width."], "statement": "You are given `widths`, an array of 26 positive widths for the letters `a` through `z`, and a string `s` of lowercase letters. Writing lays characters left to right on lines that each hold at most 100 units. A character is placed on the current line when it fits; otherwise a fresh line is started and the character goes there.\n\nReturn a two-element array `[totalLines, lastLineWidth]`: the number of lines used and the occupied width of the final line.\n\n**Constraints:**\n- `widths.length == 26`\n- `2 <= widths[i] <= 10`\n- `1 <= s.length <= 1000`\n- `s` contains only lowercase English letters\n", "solution": "## Approach\n\nScan the string once while accumulating the width used on the current line. When the next letter would push the total past 100, start a new line with that letter; otherwise extend the current line. The line counter and the final width form the answer.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(m), where m is the length of `s`.\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def numberOfLines(self, widths: List[int], s: str) -> List[int]:\n if not s:\n return [0, 0]\n lines, cur = 1, 0\n for c in s:\n w = widths[ord(c) - 97]\n if cur + w > 100:\n lines += 1\n cur = w\n else:\n cur += w\n return [lines, cur]\n```\n", "starter": {"go": "package main\n\nfunc NumberOfLines(widths []int, s string) []int {\n return nil\n}", "python": "from typing import List\nclass Solution:\n def numberOfLines(self, widths: List[int], s: str) -> List[int]:\n return []", "cpp": "#include <vector>\n#include <string>\nusing namespace std;\nclass Solution {\npublic:\n vector<int> numberOfLines(vector<int>& widths, string s) {\n return {};\n }\n};"}, "fn": "numberOfLines", "params": [{"name": "widths", "type": "int_array"}, {"name": "s", "type": "string"}], "outputType": "int_array", "tests": [["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "abcdefghijklmnopqrstuvwxyz"], ["[4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "bbbcccdddaaa"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "a"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "aaa"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "aaaaaaaaaa"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "aaaaaaaaaaa"], ["[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]", "abcdefghijklmnopqrstuvwxyz"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "zzzzzzzzzz"], ["[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]", "hello"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "helloworld"], ["[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], ["[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], ["[10, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10, 2]", "abcdef"], ["[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]", "abcdefghijklmnopqrstuvwxyz"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "abc"], ["[3, 7, 5, 9, 2, 8, 4, 6, 10, 3, 7, 5, 9, 2, 8, 4, 6, 10, 3, 7, 5, 9, 2, 8, 4, 6]", "hello"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "qwertyuiopasdfghjklzxcvbnm"], ["[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]", "zzzz"], ["[9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]", "aaaaaaaaaaa"], ["[9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]", "aaaaaaaaaaaa"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 2]", "zzzz"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "ab"], ["[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "m"], ["[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]", "teststring"], ["[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]", "aaaabbbbcccc"], ["[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]", "z"]], "expected": [[3, 60], [2, 4], [1, 10], [1, 30], [1, 100], [2, 10], [1, 52], [1, 100], [1, 25], [1, 100], [8, 14], [100, 100], [1, 100], [1, 36], [2, 4], [1, 30], [1, 26], [3, 60], [1, 8], [1, 99], [2, 9], [1, 8], [1, 20], [4, 24], [1, 10], [1, 80], [1, 60], [1, 10]], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "692", "slug": "number-of-longest-increasing-subsequence", "id": 692, "title": "Number of Longest Increasing Subsequence", "difficulty": "Medium", "category": "dp", "link": "https://leetcode.com/problems/number-of-longest-increasing-subsequence/", "examples": [{"input": "nums = [1,3,5,4,7]", "output": "2", "explanation": "The best length is 4 via [1,3,4,7] and [1,3,5,7], so there are 2 such runs."}, {"input": "nums = [2,2,2,2,2]", "output": "5", "explanation": "Every single element is a longest run of length 1, giving 5 runs."}, {"input": "nums = [1,2,3]", "output": "1", "explanation": "Only one increasing run uses all three values."}], "hints": ["For each position store the length of the best increasing run ending there and how many such runs exist.", "Extend position i from every earlier j with nums[j] < nums[i], keeping the max length and summing counts on ties.", "The answer is the total count of positions whose length equals the global maximum."], "statement": "Given an integer array `nums`, consider all strictly increasing subsequences (not necessarily contiguous).\n\nReturn how many distinct subsequences attain the maximum possible length. Two subsequences count separately when their index sets differ, even if the values look alike.\n\n**Constraints:**\n- `1 <= nums.length <= 2000`\n- `-1000 <= nums[i] <= 1000`\n", "solution": "## Approach\n\nMaintain two arrays: `len[i]` is the length of the longest increasing subsequence ending at `i`, and `cnt[i]` counts how many such runs end there. For each `i`, scan earlier positions `j` with `nums[j] < nums[i]`; adopt a longer length with its count, or accumulate counts on ties. Sum counts where the length equals the global best.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2) pairwise comparisons.\n- **Space Complexity:** O(n) for the two tables.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def findNumberOfLIS(self, nums: List[int]) -> int:\n n = len(nums)\n if n == 0:\n return 0\n lens = [1] * n\n cnts = [1] * n\n for i in range(n):\n for j in range(i):\n if nums[j] < nums[i]:\n if lens[j] + 1 > lens[i]:\n lens[i] = lens[j] + 1\n cnts[i] = cnts[j]\n elif lens[j] + 1 == lens[i]:\n cnts[i] += cnts[j]\n best = max(lens)\n return sum(c for l, c in zip(lens, cnts) if l == best)\n```\n", "starter": {"go": "package main\n\nfunc FindNumberOfLIS(nums []int) int {\n return 0\n}", "python": "from typing import List\nclass Solution:\n def findNumberOfLIS(self, nums: List[int]) -> int:\n pass", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int findNumberOfLIS(vector<int>& nums) {\n return 0;\n }\n};"}, "fn": "findNumberOfLIS", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int", "tests": [["[1,3,5,4,7]"], ["[2,2,2,2,2]"], ["[1,2,3]"], ["[3,2,1]"], ["[1]"], ["[1,2]"], ["[2,1]"], ["[1,3,2]"], ["[1,2,4,3,5]"], ["[10,9,2,5,3,7,101,18]"], ["[0,1,0,3,2,3]"], ["[7,7,7,7,7,7,7]"], ["[1,2,3,4,5]"], ["[5,4,3,2,1]"], ["[1,3,6,7,9,4,10,5,6]"], ["[2,4,3,5,1]"], ["[1,1,1,2,2,2,3,3,3]"], ["[100,100,100,1,2,3]"], ["[3,1,2]"], ["[1,2,3,2,1]"], ["[4,6,7,4,1]"], ["[1,5,2,4,3]"], ["[-1,0,1,2]"], ["[2,2,3,3,4,4]"], ["[1,2,1,2,1,2]"], ["[5,1,6,2,7,3,8]"], ["[9,1,2,3,1,2,3]"], ["[1,4,2,3]"]], "expected": [2, 5, 1, 3, 1, 1, 2, 2, 2, 4, 1, 7, 1, 5, 1, 2, 27, 1, 1, 1, 1, 2, 1, 8, 6, 4, 4, 1], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "790", "slug": "number-of-matching-subsequences", "id": 790, "title": "Number of Matching Subsequences", "difficulty": "Medium", "category": "string", "link": "https://leetcode.com/problems/number-of-matching-subsequences/", "examples": [{"input": "s = \"abcde\", words = [\"a\",\"bb\",\"acd\",\"ace\"]", "output": "3", "explanation": "Three candidates embed as subsequences."}, {"input": "s = \"dsahjpjauf\", words = [\"ahjpjau\",\"ja\",\"ahbwzgqnuk\",\"tnmlanowax\"]", "output": "2", "explanation": "The first two candidates trace through s."}, {"input": "s = \"abcd\", words = [\"abc\",\"abd\",\"acd\",\"bcd\",\"abcde\"]", "output": "4", "explanation": "All length-3 deletions work; the longer word fails."}], "hints": ["Precompute for each position in s the next occurrence of every letter so each word scans in O(word length).", "Alternatively bucket words by their current needed character and stream once through s.", "A plain two-pointer check per word is also fast enough for the given limits."], "statement": "You are given a long host string `s` and a list of candidate words `words`.\nA candidate counts when it appears as a subsequence of `s`: its characters\nmust occur in `s` in the same relative order, though not necessarily next\nto each other, with some characters of `s` possibly skipped. Repeated words\ncount repeatedly.\n\nReturn how many entries of `words` satisfy that property.\n\n**Constraints:**\n- `1 <= s.length <= 5 * 10^4`\n- `1 <= words.length <= 5000`\n- `1 <= words[i].length <= 50`\n- `s` and each word hold only lower-case English letters.\n", "solution": "## Approach\n\nPrecompute a next-occurrence table: for every index in `s` and every letter,\nstore where that letter next appears at or after the index. Each candidate\nword then walks through the table, jumping from one matched position to the\nnext; a missing jump means the word is not a subsequence. Counting the words\nthat survive gives the answer.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(|s| * alphabet + total word length). The table costs O(26 * |s|).\n- **Space Complexity:** O(26 * |s|) for the table.\n\n## Implementation\n\n```python\nfrom typing import List\n\n\nclass Solution:\n def numMatchingSubseq(self, s: str, words: List[str]) -> int:\n n = len(s)\n nxt = [[-1] * 26 for _ in range(n + 1)]\n for i in range(n - 1, -1, -1):\n nxt[i] = nxt[i + 1][:]\n nxt[i][ord(s[i]) - 97] = i\n\n def is_subseq(w: str) -> bool:\n pos = 0\n for c in w:\n if pos > n:\n return False\n found = nxt[pos][ord(c) - 97]\n if found == -1:\n return False\n pos = found + 1\n return True\n\n return sum(1 for w in words if is_subseq(w))\n```\n", "starter": {"go": "package main\n\nfunc NumMatchingSubseq(s string, words []string) int {\n return 0\n}", "python": "from typing import List\nclass Solution:\n def numMatchingSubseq(self, s: str, words: List[str]) -> int:\n return 0\n", "cpp": "#include <vector>\n#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n int numMatchingSubseq(string s, vector<string>& words) {\n return 0;\n }\n};"}, "fn": "numMatchingSubseq", "params": [{"name": "s", "type": "string"}, {"name": "words", "type": "string_array"}], "outputType": "int", "tests": [["abcde", "[\"a\",\"bb\",\"acd\",\"ace\"]"], ["dsahjpjauf", "[\"ahjpjau\",\"ja\",\"ahbwzgqnuk\",\"tnmlanowax\"]"], ["abcd", "[\"abc\",\"abd\",\"acd\",\"bcd\",\"abcde\"]"], ["a", "[\"a\",\"b\",\"c\"]"], ["aaaaa", "[\"a\",\"aa\",\"aaa\",\"aaaa\",\"aaaaa\",\"aaaaaa\"]"], ["abc", "[\"abc\",\"acb\",\"bac\",\"cba\"]"], ["xyz", "[\"x\",\"y\",\"z\",\"xy\",\"yz\",\"xyz\",\"w\"]"], ["abcdef", "[\"ace\",\"bdf\",\"abcdef\",\"fedcba\",\"ab\"]"], ["ababa", "[\"aba\",\"bab\",\"aa\",\"bb\",\"abab\"]"], ["hello", "[\"h\",\"e\",\"l\",\"o\",\"he\",\"lo\",\"hello\",\"olleh\"]"], ["abcdefghij", "[\"aij\",\"abc\",\"jih\",\"abcdefghij\",\"abcdefghijk\"]"], ["zzzzzz", "[\"z\",\"zz\",\"zzz\",\"a\"]"], ["abcde", "[\"e\",\"d\",\"c\",\"b\",\"a\",\"edcba\"]"], ["aabbcc", "[\"abc\",\"acb\",\"aabbcc\",\"aaabbbccc\"]"], ["mississippi", "[\"mis\",\"sip\",\"pip\",\"mississippi\",\"iii\"]"], ["abcdabcd", "[\"abcd\",\"aabbccdd\",\"abab\",\"cdcd\"]"], ["qwerty", "[\"qwe\",\"rty\",\"qy\",\"qwety\",\"ytrewq\"]"], ["aaaaabbbbbccccc", "[\"abc\",\"acb\",\"aabbcc\",\"abcabc\"]"], ["abcabcabc", "[\"abc\",\"aaa\",\"bbb\",\"ccc\",\"abcabcabc\"]"], ["thequickbrownfox", "[\"the\",\"quick\",\"brown\",\"fox\",\"thefox\",\"xof\"]"], ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "[\"a\",\"aa\",\"aaa\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"]"], ["abcdefghijklmnopqrstuvwxyz", "[\"abc\",\"xyz\",\"acegik\",\"zyx\",\"mnop\"]"], ["ab", "[\"a\",\"b\",\"ab\",\"ba\",\"aa\",\"bb\"]"], ["leetcode", "[\"let\",\"code\",\"lee\",\"eetcode\",\"edoc\"]"], ["subsequence", "[\"sub\",\"sequence\",\"subsequence\",\"een\",\"qus\"]"], ["aaaabbbb", "[\"ab\",\"aab\",\"abb\",\"aaabbb\",\"bbaa\"]"], ["xyzxyzxyz", "[\"xyz\",\"xzy\",\"xxxyyyzzz\",\"zzz\"]"], ["abcdefghijklmnopqrst", "[\"aceg\",\"bdfh\",\"abcdefghijklmnopqrst\",\"tsrq\"]"]], "expected": [3, 2, 4, 1, 5, 1, 6, 4, 5, 7, 3, 3, 5, 2, 4, 3, 4, 2, 5, 5, 3, 4, 3, 4, 4, 4, 3, 3], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "907", "slug": "number-of-music-playlists", "id": 907, "title": "Number of Music Playlists", "difficulty": "Hard", "category": "dp", "link": "https://leetcode.com/problems/number-of-music-playlists/", "examples": [{"input": "n = 3, goal = 3, k = 1", "output": "6", "explanation": "Every ordering of the 3 distinct songs works: 3! = 6."}, {"input": "n = 2, goal = 3, k = 0", "output": "6", "explanation": "Repeats are unrestricted (k = 0), so any of the 2^3 sequences with both songs present counts: 6."}, {"input": "n = 2, goal = 3, k = 1", "output": "2", "explanation": "Only [1,2,1] and [2,1,2] keep every repeat at distance greater than 1."}], "hints": ["Count lists by (length so far, distinct songs used): appending a new song has n - used choices.", "Replaying an old song is allowed only when more than k distinct others separate repeats, giving used - k choices.", "Take everything modulo 1,000,000,007 and answer with full length and all n songs used."], "statement": "There are `n` different songs. A playlist is a list of exactly `goal` songs satisfying two rules: every one of the `n` songs appears at least once, and whenever a song repeats, at least `k` other songs sit between the two plays (positions of equal songs differ by more than `k`).\n\nReturn the number of valid playlists, modulo `10^9 + 7`.\n\n**Constraints:**\n- `1 <= k < n <= goal <= 100`\n", "solution": "## Approach\n\nBuild a table over playlist length and distinct songs used. Extending a list either introduces a fresh song (`n - used` options) or replays a song already present, which is legal only when at least `k` other songs intervene (`used - k` replayable choices). All operations run modulo 1,000,000,007, and the target cell uses the full length with every song appearing.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(goal * n) table entries, each in O(1).\n- **Space Complexity:** O(goal * n), compressible to O(n).\n\n## Implementation\n\n```python\nclass Solution:\n def numPlaylists(self, n: int, goal: int, k: int) -> int:\n mod = 10 ** 9 + 7\n dp = [[0] * (n + 1) for _ in range(goal + 1)]\n dp[0][0] = 1\n for i in range(1, goal + 1):\n for j in range(1, min(i, n) + 1):\n dp[i][j] = dp[i - 1][j - 1] * (n - j + 1) % mod\n if j > k:\n dp[i][j] = (dp[i][j] + dp[i - 1][j] * (j - k)) % mod\n return dp[goal][n]\n```\n", "starter": {"go": "package main\n\nfunc NumPlaylists(n int, goal int, k int) int {\n \n}", "python": "class Solution:\n def numPlaylists(self, n: int, goal: int, k: int) -> int:\n pass", "cpp": "class Solution {\npublic:\n int numPlaylists(int n, int goal, int k) {\n return 0;\n }\n};"}, "fn": "numPlaylists", "params": [{"name": "n", "type": "int"}, {"name": "goal", "type": "int"}, {"name": "k", "type": "int"}], "outputType": "int", "tests": [["3", "3", "1"], ["2", "3", "0"], ["2", "3", "1"], ["1", "1", "0"], ["1", "3", "0"], ["1", "3", "1"], ["2", "2", "0"], ["2", "2", "1"], ["2", "4", "0"], ["2", "4", "1"], ["3", "4", "1"], ["3", "5", "2"], ["3", "3", "0"], ["3", "3", "2"], ["4", "4", "0"], ["4", "6", "1"], ["5", "5", "4"], ["5", "8", "2"], ["10", "10", "0"], ["10", "12", "3"], ["2", "5", "0"], ["3", "6", "0"], ["3", "6", "2"], ["4", "7", "3"], ["6", "9", "2"], ["8", "10", "1"], ["20", "20", "5"], ["50", "60", "10"]], "expected": [6, 6, 2, 1, 1, 0, 2, 2, 14, 2, 18, 6, 6, 6, 24, 600, 120, 10800, 3628800, 676505593, 30, 540, 6, 24, 252000, 18627840, 146326063, 145632432], "loose": false}
|