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.
Files changed (1038) hide show
  1. package/README.md +38 -2
  2. package/data/index.json +1 -0
  3. package/data/problems/01-matrix.json +1 -0
  4. package/data/problems/1-bit-and-2-bit-characters.json +1 -0
  5. package/data/problems/132-pattern.json +1 -0
  6. package/data/problems/2-keys-keyboard.json +1 -0
  7. package/data/problems/24-game.json +1 -0
  8. package/data/problems/3sum-closest.json +1 -0
  9. package/data/problems/3sum-smaller.json +1 -0
  10. package/data/problems/3sum-with-multiplicity.json +1 -0
  11. package/data/problems/3sum.json +1 -0
  12. package/data/problems/4-keys-keyboard.json +1 -0
  13. package/data/problems/4sum-ii.json +1 -0
  14. package/data/problems/4sum.json +1 -0
  15. package/data/problems/accounts-merge.json +1 -0
  16. package/data/problems/add-binary.json +1 -0
  17. package/data/problems/add-bold-tag-in-string.json +1 -0
  18. package/data/problems/add-digits.json +1 -0
  19. package/data/problems/add-one-row-to-tree.json +1 -0
  20. package/data/problems/add-strings.json +1 -0
  21. package/data/problems/add-to-array-form-of-integer.json +1 -0
  22. package/data/problems/add-two-numbers-ii.json +1 -0
  23. package/data/problems/add-two-numbers.json +1 -0
  24. package/data/problems/additive-number.json +1 -0
  25. package/data/problems/advantage-shuffle.json +1 -0
  26. package/data/problems/alien-dictionary.json +1 -0
  27. package/data/problems/all-nodes-distance-k-in-binary-tree.json +1 -0
  28. package/data/problems/all-oone-data-structure.json +1 -0
  29. package/data/problems/all-paths-from-source-to-target.json +1 -0
  30. package/data/problems/all-possible-full-binary-trees.json +1 -0
  31. package/data/problems/ambiguous-coordinates.json +1 -0
  32. package/data/problems/android-unlock-patterns.json +1 -0
  33. package/data/problems/arithmetic-slices-ii-subsequence.json +1 -0
  34. package/data/problems/arithmetic-slices.json +1 -0
  35. package/data/problems/arranging-coins.json +1 -0
  36. package/data/problems/array-nesting.json +1 -0
  37. package/data/problems/array-of-doubled-pairs.json +1 -0
  38. package/data/problems/array-partition.json +1 -0
  39. package/data/problems/assign-cookies.json +1 -0
  40. package/data/problems/asteroid-collision.json +1 -0
  41. package/data/problems/available-captures-for-rook.json +1 -0
  42. package/data/problems/average-of-levels-in-binary-tree.json +1 -0
  43. package/data/problems/backspace-string-compare.json +1 -0
  44. package/data/problems/bag-of-tokens.json +1 -0
  45. package/data/problems/balanced-binary-tree.json +1 -0
  46. package/data/problems/base-7.json +1 -0
  47. package/data/problems/baseball-game.json +1 -0
  48. package/data/problems/basic-absolute-value.json +1 -0
  49. package/data/problems/basic-array-max.json +1 -0
  50. package/data/problems/basic-array-min.json +1 -0
  51. package/data/problems/basic-array-sum-rec.json +1 -0
  52. package/data/problems/basic-array-sum.json +1 -0
  53. package/data/problems/basic-average-floor.json +1 -0
  54. package/data/problems/basic-bubble-sort.json +1 -0
  55. package/data/problems/basic-calculator-ii.json +1 -0
  56. package/data/problems/basic-calculator-iii.json +1 -0
  57. package/data/problems/basic-calculator-iv.json +1 -0
  58. package/data/problems/basic-calculator.json +1 -0
  59. package/data/problems/basic-collatz-steps.json +1 -0
  60. package/data/problems/basic-contains-value.json +1 -0
  61. package/data/problems/basic-count-above.json +1 -0
  62. package/data/problems/basic-count-char.json +1 -0
  63. package/data/problems/basic-count-digits.json +1 -0
  64. package/data/problems/basic-count-evens.json +1 -0
  65. package/data/problems/basic-count-pairs.json +1 -0
  66. package/data/problems/basic-count-vowels.json +1 -0
  67. package/data/problems/basic-count-words.json +1 -0
  68. package/data/problems/basic-countdown.json +1 -0
  69. package/data/problems/basic-double-array.json +1 -0
  70. package/data/problems/basic-factorial-rec.json +1 -0
  71. package/data/problems/basic-factorial.json +1 -0
  72. package/data/problems/basic-fibonacci.json +1 -0
  73. package/data/problems/basic-find-index.json +1 -0
  74. package/data/problems/basic-gcd.json +1 -0
  75. package/data/problems/basic-grade-letter.json +1 -0
  76. package/data/problems/basic-has-duplicate.json +1 -0
  77. package/data/problems/basic-is-even.json +1 -0
  78. package/data/problems/basic-is-leap-year.json +1 -0
  79. package/data/problems/basic-is-sorted.json +1 -0
  80. package/data/problems/basic-max-frequency.json +1 -0
  81. package/data/problems/basic-max-of-three.json +1 -0
  82. package/data/problems/basic-max-of-two.json +1 -0
  83. package/data/problems/basic-palindrome-text.json +1 -0
  84. package/data/problems/basic-power-rec.json +1 -0
  85. package/data/problems/basic-power.json +1 -0
  86. package/data/problems/basic-repeat-string.json +1 -0
  87. package/data/problems/basic-reverse-array.json +1 -0
  88. package/data/problems/basic-reverse-number.json +1 -0
  89. package/data/problems/basic-reverse-text-rec.json +1 -0
  90. package/data/problems/basic-reverse-text.json +1 -0
  91. package/data/problems/basic-second-largest.json +1 -0
  92. package/data/problems/basic-sort-two.json +1 -0
  93. package/data/problems/basic-staircase.json +1 -0
  94. package/data/problems/basic-string-length.json +1 -0
  95. package/data/problems/basic-sum-1-to-n.json +1 -0
  96. package/data/problems/basic-sum-digits-rec.json +1 -0
  97. package/data/problems/basic-sum-multiples.json +1 -0
  98. package/data/problems/basic-sum-of-digits.json +1 -0
  99. package/data/problems/basic-temperature-advice.json +1 -0
  100. package/data/problems/basic-to-upper.json +1 -0
  101. package/data/problems/basic-triangle-sum.json +1 -0
  102. package/data/problems/battleships-in-a-board.json +1 -0
  103. package/data/problems/beautiful-arrangement-ii.json +1 -0
  104. package/data/problems/beautiful-arrangement.json +1 -0
  105. package/data/problems/beautiful-array.json +1 -0
  106. package/data/problems/best-meeting-point.json +1 -0
  107. package/data/problems/best-time-to-buy-and-sell-stock-ii.json +1 -0
  108. package/data/problems/best-time-to-buy-and-sell-stock-iii.json +1 -0
  109. package/data/problems/best-time-to-buy-and-sell-stock-iv.json +1 -0
  110. package/data/problems/best-time-to-buy-and-sell-stock-with-cooldown.json +1 -0
  111. package/data/problems/best-time-to-buy-and-sell-stock-with-transaction-fee.json +1 -0
  112. package/data/problems/best-time-to-buy-and-sell-stock.json +1 -0
  113. package/data/problems/binary-gap.json +1 -0
  114. package/data/problems/binary-number-with-alternating-bits.json +1 -0
  115. package/data/problems/binary-search-tree-iterator.json +1 -0
  116. package/data/problems/binary-search.json +1 -0
  117. package/data/problems/binary-subarrays-with-sum.json +1 -0
  118. package/data/problems/binary-tree-cameras.json +1 -0
  119. package/data/problems/binary-tree-inorder-traversal.json +1 -0
  120. package/data/problems/binary-tree-level-order-traversal-ii.json +1 -0
  121. package/data/problems/binary-tree-level-order-traversal.json +1 -0
  122. package/data/problems/binary-tree-longest-consecutive-sequence-ii.json +1 -0
  123. package/data/problems/binary-tree-longest-consecutive-sequence.json +1 -0
  124. package/data/problems/binary-tree-maximum-path-sum.json +1 -0
  125. package/data/problems/binary-tree-paths.json +1 -0
  126. package/data/problems/binary-tree-postorder-traversal.json +1 -0
  127. package/data/problems/binary-tree-preorder-traversal.json +1 -0
  128. package/data/problems/binary-tree-pruning.json +1 -0
  129. package/data/problems/binary-tree-right-side-view.json +1 -0
  130. package/data/problems/binary-tree-tilt.json +1 -0
  131. package/data/problems/binary-tree-upside-down.json +1 -0
  132. package/data/problems/binary-tree-vertical-order-traversal.json +1 -0
  133. package/data/problems/binary-tree-zigzag-level-order-traversal.json +1 -0
  134. package/data/problems/binary-trees-with-factors.json +1 -0
  135. package/data/problems/binary-watch.json +1 -0
  136. package/data/problems/bitwise-and-of-numbers-range.json +1 -0
  137. package/data/problems/bitwise-ors-of-subarrays.json +1 -0
  138. package/data/problems/boats-to-save-people.json +1 -0
  139. package/data/problems/bold-words-in-string.json +1 -0
  140. package/data/problems/bomb-enemy.json +1 -0
  141. package/data/problems/boundary-of-binary-tree.json +1 -0
  142. package/data/problems/brick-wall.json +1 -0
  143. package/data/problems/bricks-falling-when-hit.json +1 -0
  144. package/data/problems/broken-calculator.json +1 -0
  145. package/data/problems/buddy-strings.json +1 -0
  146. package/data/problems/build-a-matrix-with-conditions.json +1 -0
  147. package/data/problems/bulb-switcher-ii.json +1 -0
  148. package/data/problems/bulb-switcher.json +1 -0
  149. package/data/problems/bulls-and-cows.json +1 -0
  150. package/data/problems/burst-balloons.json +1 -0
  151. package/data/problems/bus-routes.json +1 -0
  152. package/data/problems/can-i-win.json +1 -0
  153. package/data/problems/can-place-flowers.json +1 -0
  154. package/data/problems/candy-crush.json +1 -0
  155. package/data/problems/candy.json +1 -0
  156. package/data/problems/capacity-to-ship-packages-within-d-days.json +1 -0
  157. package/data/problems/car-fleet.json +1 -0
  158. package/data/problems/car-pooling.json +1 -0
  159. package/data/problems/card-flipping-game.json +1 -0
  160. package/data/problems/cat-and-mouse.json +1 -0
  161. package/data/problems/chalkboard-xor-game.json +1 -0
  162. package/data/problems/champagne-tower.json +1 -0
  163. package/data/problems/cheapest-flights-within-k-stops.json +1 -0
  164. package/data/problems/check-completeness-of-a-binary-tree.json +1 -0
  165. package/data/problems/cherry-pickup.json +1 -0
  166. package/data/problems/circular-array-loop.json +1 -0
  167. package/data/problems/climbing-stairs.json +1 -0
  168. package/data/problems/clone-graph.json +1 -0
  169. package/data/problems/closest-binary-search-tree-value-ii.json +1 -0
  170. package/data/problems/closest-binary-search-tree-value.json +1 -0
  171. package/data/problems/closest-leaf-in-a-binary-tree.json +1 -0
  172. package/data/problems/coin-change-ii.json +1 -0
  173. package/data/problems/coin-change.json +1 -0
  174. package/data/problems/coin-path.json +1 -0
  175. package/data/problems/combination-sum-ii.json +1 -0
  176. package/data/problems/combination-sum-iii.json +1 -0
  177. package/data/problems/combination-sum-iv.json +1 -0
  178. package/data/problems/combination-sum.json +1 -0
  179. package/data/problems/combinations.json +1 -0
  180. package/data/problems/compare-version-numbers.json +1 -0
  181. package/data/problems/complete-binary-tree-inserter.json +1 -0
  182. package/data/problems/complex-number-multiplication.json +1 -0
  183. package/data/problems/concatenated-words.json +1 -0
  184. package/data/problems/concatenation-of-array.json +1 -0
  185. package/data/problems/consecutive-numbers-sum.json +1 -0
  186. package/data/problems/construct-binary-tree-from-inorder-and-postorder-traversal.json +1 -0
  187. package/data/problems/construct-binary-tree-from-preorder-and-inorder-traversal.json +1 -0
  188. package/data/problems/construct-binary-tree-from-preorder-and-postorder-traversal.json +1 -0
  189. package/data/problems/construct-binary-tree-from-string.json +1 -0
  190. package/data/problems/construct-quad-tree.json +1 -0
  191. package/data/problems/construct-string-from-binary-tree.json +1 -0
  192. package/data/problems/construct-the-rectangle.json +1 -0
  193. package/data/problems/contain-virus.json +1 -0
  194. package/data/problems/container-with-most-water.json +1 -0
  195. package/data/problems/contains-duplicate-ii.json +1 -0
  196. package/data/problems/contains-duplicate-iii.json +1 -0
  197. package/data/problems/contains-duplicate.json +1 -0
  198. package/data/problems/contiguous-array.json +1 -0
  199. package/data/problems/continuous-subarray-sum.json +1 -0
  200. package/data/problems/convert-a-number-to-hexadecimal.json +1 -0
  201. package/data/problems/convert-binary-search-tree-to-sorted-doubly-linked-list.json +1 -0
  202. package/data/problems/convert-bst-to-greater-tree.json +1 -0
  203. package/data/problems/convert-sorted-array-to-binary-search-tree.json +1 -0
  204. package/data/problems/convert-sorted-list-to-binary-search-tree.json +1 -0
  205. package/data/problems/convex-polygon.json +1 -0
  206. package/data/problems/copy-list-with-random-pointer.json +1 -0
  207. package/data/problems/count-and-say.json +1 -0
  208. package/data/problems/count-binary-substrings.json +1 -0
  209. package/data/problems/count-complete-tree-nodes.json +1 -0
  210. package/data/problems/count-different-palindromic-subsequences.json +1 -0
  211. package/data/problems/count-good-nodes-in-binary-tree.json +1 -0
  212. package/data/problems/count-numbers-with-unique-digits.json +1 -0
  213. package/data/problems/count-of-range-sum.json +1 -0
  214. package/data/problems/count-of-smaller-numbers-after-self.json +1 -0
  215. package/data/problems/count-primes.json +1 -0
  216. package/data/problems/count-the-repetitions.json +1 -0
  217. package/data/problems/count-unique-characters-of-all-substrings-of-a-given-string.json +1 -0
  218. package/data/problems/count-univalue-subtrees.json +1 -0
  219. package/data/problems/counting-bits.json +1 -0
  220. package/data/problems/couples-holding-hands.json +1 -0
  221. package/data/problems/course-schedule-ii.json +1 -0
  222. package/data/problems/course-schedule-iii.json +1 -0
  223. package/data/problems/course-schedule-iv.json +1 -0
  224. package/data/problems/course-schedule.json +1 -0
  225. package/data/problems/cousins-in-binary-tree.json +1 -0
  226. package/data/problems/cracking-the-safe.json +1 -0
  227. package/data/problems/create-maximum-number.json +1 -0
  228. package/data/problems/custom-sort-string.json +1 -0
  229. package/data/problems/cut-off-trees-for-golf-event.json +1 -0
  230. package/data/problems/daily-temperatures.json +1 -0
  231. package/data/problems/data-stream-as-disjoint-intervals.json +1 -0
  232. package/data/problems/decode-string.json +1 -0
  233. package/data/problems/decode-ways-ii.json +1 -0
  234. package/data/problems/decode-ways.json +1 -0
  235. package/data/problems/decoded-string-at-index.json +1 -0
  236. package/data/problems/degree-of-an-array.json +1 -0
  237. package/data/problems/delete-and-earn.json +1 -0
  238. package/data/problems/delete-columns-to-make-sorted-ii.json +1 -0
  239. package/data/problems/delete-columns-to-make-sorted-iii.json +1 -0
  240. package/data/problems/delete-columns-to-make-sorted.json +1 -0
  241. package/data/problems/delete-leaves-with-a-given-value.json +1 -0
  242. package/data/problems/delete-node-in-a-bst.json +1 -0
  243. package/data/problems/delete-node-in-a-linked-list.json +1 -0
  244. package/data/problems/delete-operation-for-two-strings.json +1 -0
  245. package/data/problems/design-add-and-search-words-data-structure.json +1 -0
  246. package/data/problems/design-circular-deque.json +1 -0
  247. package/data/problems/design-circular-queue.json +1 -0
  248. package/data/problems/design-compressed-string-iterator.json +1 -0
  249. package/data/problems/design-excel-sum-formula.json +1 -0
  250. package/data/problems/design-hashmap.json +1 -0
  251. package/data/problems/design-hashset.json +1 -0
  252. package/data/problems/design-hit-counter.json +1 -0
  253. package/data/problems/design-in-memory-file-system.json +1 -0
  254. package/data/problems/design-linked-list.json +1 -0
  255. package/data/problems/design-log-storage-system.json +1 -0
  256. package/data/problems/design-phone-directory.json +1 -0
  257. package/data/problems/design-search-autocomplete-system.json +1 -0
  258. package/data/problems/design-snake-game.json +1 -0
  259. package/data/problems/design-tic-tac-toe.json +1 -0
  260. package/data/problems/design-twitter.json +1 -0
  261. package/data/problems/detect-capital.json +1 -0
  262. package/data/problems/detect-squares.json +1 -0
  263. package/data/problems/di-string-match.json +1 -0
  264. package/data/problems/diagonal-traverse.json +1 -0
  265. package/data/problems/diameter-of-binary-tree.json +1 -0
  266. package/data/problems/different-ways-to-add-parentheses.json +1 -0
  267. package/data/problems/distinct-subsequences-ii.json +1 -0
  268. package/data/problems/distinct-subsequences.json +1 -0
  269. package/data/problems/distribute-candies.json +1 -0
  270. package/data/problems/distribute-coins-in-binary-tree.json +1 -0
  271. package/data/problems/divide-two-integers.json +1 -0
  272. package/data/problems/domino-and-tromino-tiling.json +1 -0
  273. package/data/problems/dota2-senate.json +1 -0
  274. package/data/problems/dungeon-game.json +1 -0
  275. package/data/problems/edit-distance.json +1 -0
  276. package/data/problems/elimination-game.json +1 -0
  277. package/data/problems/employee-free-time.json +1 -0
  278. package/data/problems/employee-importance.json +1 -0
  279. package/data/problems/encode-and-decode-strings.json +1 -0
  280. package/data/problems/encode-and-decode-tinyurl.json +1 -0
  281. package/data/problems/encode-n-ary-tree-to-binary-tree.json +1 -0
  282. package/data/problems/encode-string-with-shortest-length.json +1 -0
  283. package/data/problems/equal-rational-numbers.json +1 -0
  284. package/data/problems/equal-tree-partition.json +1 -0
  285. package/data/problems/erect-the-fence.json +1 -0
  286. package/data/problems/escape-the-ghosts.json +1 -0
  287. package/data/problems/evaluate-division.json +1 -0
  288. package/data/problems/evaluate-reverse-polish-notation.json +1 -0
  289. package/data/problems/exam-room.json +1 -0
  290. package/data/problems/excel-sheet-column-number.json +1 -0
  291. package/data/problems/excel-sheet-column-title.json +1 -0
  292. package/data/problems/exclusive-time-of-functions.json +1 -0
  293. package/data/problems/expression-add-operators.json +1 -0
  294. package/data/problems/expressive-words.json +1 -0
  295. package/data/problems/extra-characters-in-a-string.json +1 -0
  296. package/data/problems/factor-combinations.json +1 -0
  297. package/data/problems/factorial-trailing-zeroes.json +1 -0
  298. package/data/problems/fair-candy-swap.json +1 -0
  299. package/data/problems/falling-squares.json +1 -0
  300. package/data/problems/fibonacci-number.json +1 -0
  301. package/data/problems/find-all-anagrams-in-a-string.json +1 -0
  302. package/data/problems/find-all-duplicates-in-an-array.json +1 -0
  303. package/data/problems/find-all-numbers-disappeared-in-an-array.json +1 -0
  304. package/data/problems/find-anagram-mappings.json +1 -0
  305. package/data/problems/find-and-replace-in-string.json +1 -0
  306. package/data/problems/find-and-replace-pattern.json +1 -0
  307. package/data/problems/find-bottom-left-tree-value.json +1 -0
  308. package/data/problems/find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree.json +1 -0
  309. package/data/problems/find-duplicate-file-in-system.json +1 -0
  310. package/data/problems/find-duplicate-subtrees.json +1 -0
  311. package/data/problems/find-eventual-safe-states.json +1 -0
  312. package/data/problems/find-first-and-last-position-of-element-in-sorted-array.json +1 -0
  313. package/data/problems/find-in-mountain-array.json +1 -0
  314. package/data/problems/find-k-closest-elements.json +1 -0
  315. package/data/problems/find-k-pairs-with-smallest-sums.json +1 -0
  316. package/data/problems/find-k-th-smallest-pair-distance.json +1 -0
  317. package/data/problems/find-largest-value-in-each-tree-row.json +1 -0
  318. package/data/problems/find-leaves-of-binary-tree.json +1 -0
  319. package/data/problems/find-median-from-data-stream.json +1 -0
  320. package/data/problems/find-minimum-in-rotated-sorted-array-ii.json +1 -0
  321. package/data/problems/find-minimum-in-rotated-sorted-array.json +1 -0
  322. package/data/problems/find-mode-in-binary-search-tree.json +1 -0
  323. package/data/problems/find-peak-element.json +1 -0
  324. package/data/problems/find-permutation.json +1 -0
  325. package/data/problems/find-pivot-index.json +1 -0
  326. package/data/problems/find-right-interval.json +1 -0
  327. package/data/problems/find-smallest-letter-greater-than-target.json +1 -0
  328. package/data/problems/find-the-celebrity.json +1 -0
  329. package/data/problems/find-the-closest-palindrome.json +1 -0
  330. package/data/problems/find-the-derangement-of-an-array.json +1 -0
  331. package/data/problems/find-the-difference.json +1 -0
  332. package/data/problems/find-the-duplicate-number.json +1 -0
  333. package/data/problems/find-the-index-of-the-first-occurrence-in-a-string.json +1 -0
  334. package/data/problems/find-the-shortest-superstring.json +1 -0
  335. package/data/problems/find-the-town-judge.json +1 -0
  336. package/data/problems/first-bad-version.json +1 -0
  337. package/data/problems/first-missing-positive.json +1 -0
  338. package/data/problems/first-unique-character-in-a-string.json +1 -0
  339. package/data/problems/fizz-buzz.json +1 -0
  340. package/data/problems/flatten-2d-vector.json +1 -0
  341. package/data/problems/flatten-a-multilevel-doubly-linked-list.json +1 -0
  342. package/data/problems/flatten-binary-tree-to-linked-list.json +1 -0
  343. package/data/problems/flatten-nested-list-iterator.json +1 -0
  344. package/data/problems/flip-binary-tree-to-match-preorder-traversal.json +1 -0
  345. package/data/problems/flip-equivalent-binary-trees.json +1 -0
  346. package/data/problems/flip-game-ii.json +1 -0
  347. package/data/problems/flip-game.json +1 -0
  348. package/data/problems/flip-string-to-monotone-increasing.json +1 -0
  349. package/data/problems/flipping-an-image.json +1 -0
  350. package/data/problems/flood-fill.json +1 -0
  351. package/data/problems/fraction-addition-and-subtraction.json +1 -0
  352. package/data/problems/fraction-to-recurring-decimal.json +1 -0
  353. package/data/problems/freedom-trail.json +1 -0
  354. package/data/problems/friends-of-appropriate-ages.json +1 -0
  355. package/data/problems/frog-jump.json +1 -0
  356. package/data/problems/fruit-into-baskets.json +1 -0
  357. package/data/problems/game-of-life.json +1 -0
  358. package/data/problems/gas-station.json +1 -0
  359. package/data/problems/generalized-abbreviation.json +1 -0
  360. package/data/problems/generate-parentheses.json +1 -0
  361. package/data/problems/generate-random-point-in-a-circle.json +1 -0
  362. package/data/problems/global-and-local-inversions.json +1 -0
  363. package/data/problems/goat-latin.json +1 -0
  364. package/data/problems/graph-valid-tree.json +1 -0
  365. package/data/problems/gray-code.json +1 -0
  366. package/data/problems/greatest-common-divisor-of-strings.json +1 -0
  367. package/data/problems/greatest-common-divisor-traversal.json +1 -0
  368. package/data/problems/group-anagrams.json +1 -0
  369. package/data/problems/group-shifted-strings.json +1 -0
  370. package/data/problems/groups-of-special-equivalent-strings.json +1 -0
  371. package/data/problems/guess-number-higher-or-lower-ii.json +1 -0
  372. package/data/problems/guess-number-higher-or-lower.json +1 -0
  373. package/data/problems/guess-the-word.json +1 -0
  374. package/data/problems/h-index-ii.json +1 -0
  375. package/data/problems/h-index.json +1 -0
  376. package/data/problems/hamming-distance.json +1 -0
  377. package/data/problems/hand-of-straights.json +1 -0
  378. package/data/problems/happy-number.json +1 -0
  379. package/data/problems/heaters.json +1 -0
  380. package/data/problems/house-robber-ii.json +1 -0
  381. package/data/problems/house-robber-iii.json +1 -0
  382. package/data/problems/house-robber.json +1 -0
  383. package/data/problems/image-overlap.json +1 -0
  384. package/data/problems/image-smoother.json +1 -0
  385. package/data/problems/implement-magic-dictionary.json +1 -0
  386. package/data/problems/implement-queue-using-stacks.json +1 -0
  387. package/data/problems/implement-rand10-using-rand7.json +1 -0
  388. package/data/problems/implement-stack-using-queues.json +1 -0
  389. package/data/problems/implement-trie-prefix-tree.json +1 -0
  390. package/data/problems/increasing-order-search-tree.json +1 -0
  391. package/data/problems/increasing-triplet-subsequence.json +1 -0
  392. package/data/problems/inorder-successor-in-bst-ii.json +1 -0
  393. package/data/problems/inorder-successor-in-bst.json +1 -0
  394. package/data/problems/insert-delete-getrandom-o1-duplicates-allowed.json +1 -0
  395. package/data/problems/insert-delete-getrandom-o1.json +1 -0
  396. package/data/problems/insert-greatest-common-divisors-in-linked-list.json +1 -0
  397. package/data/problems/insert-interval.json +1 -0
  398. package/data/problems/insert-into-a-binary-search-tree.json +1 -0
  399. package/data/problems/insert-into-a-sorted-circular-linked-list.json +1 -0
  400. package/data/problems/insertion-sort-list.json +1 -0
  401. package/data/problems/integer-break.json +1 -0
  402. package/data/problems/integer-replacement.json +1 -0
  403. package/data/problems/integer-to-english-words.json +1 -0
  404. package/data/problems/integer-to-roman.json +1 -0
  405. package/data/problems/interleaving-string.json +1 -0
  406. package/data/problems/intersection-of-two-arrays-ii.json +1 -0
  407. package/data/problems/intersection-of-two-arrays.json +1 -0
  408. package/data/problems/intersection-of-two-linked-lists.json +1 -0
  409. package/data/problems/interval-list-intersections.json +1 -0
  410. package/data/problems/invert-binary-tree.json +1 -0
  411. package/data/problems/ip-to-cidr.json +1 -0
  412. package/data/problems/ipo.json +1 -0
  413. package/data/problems/is-graph-bipartite.json +1 -0
  414. package/data/problems/is-subsequence.json +1 -0
  415. package/data/problems/island-perimeter.json +1 -0
  416. package/data/problems/isomorphic-strings.json +1 -0
  417. package/data/problems/jewels-and-stones.json +1 -0
  418. package/data/problems/jump-game-ii.json +1 -0
  419. package/data/problems/jump-game-vii.json +1 -0
  420. package/data/problems/jump-game.json +1 -0
  421. package/data/problems/k-closest-points-to-origin.json +1 -0
  422. package/data/problems/k-diff-pairs-in-an-array.json +1 -0
  423. package/data/problems/k-empty-slots.json +1 -0
  424. package/data/problems/k-inverse-pairs-array.json +1 -0
  425. package/data/problems/k-similar-strings.json +1 -0
  426. package/data/problems/k-th-smallest-in-lexicographical-order.json +1 -0
  427. package/data/problems/k-th-smallest-prime-fraction.json +1 -0
  428. package/data/problems/k-th-symbol-in-grammar.json +1 -0
  429. package/data/problems/keyboard-row.json +1 -0
  430. package/data/problems/keys-and-rooms.json +1 -0
  431. package/data/problems/kill-process.json +1 -0
  432. package/data/problems/knight-dialer.json +1 -0
  433. package/data/problems/knight-probability-in-chessboard.json +1 -0
  434. package/data/problems/koko-eating-bananas.json +1 -0
  435. package/data/problems/kth-largest-element-in-a-stream.json +1 -0
  436. package/data/problems/kth-largest-element-in-an-array.json +1 -0
  437. package/data/problems/kth-smallest-element-in-a-bst.json +1 -0
  438. package/data/problems/kth-smallest-element-in-a-sorted-matrix.json +1 -0
  439. package/data/problems/kth-smallest-number-in-multiplication-table.json +1 -0
  440. package/data/problems/largest-bst-subtree.json +1 -0
  441. package/data/problems/largest-component-size-by-common-factor.json +1 -0
  442. package/data/problems/largest-divisible-subset.json +1 -0
  443. package/data/problems/largest-number-at-least-twice-of-others.json +1 -0
  444. package/data/problems/largest-number.json +1 -0
  445. package/data/problems/largest-palindrome-product.json +1 -0
  446. package/data/problems/largest-perimeter-triangle.json +1 -0
  447. package/data/problems/largest-plus-sign.json +1 -0
  448. package/data/problems/largest-rectangle-in-histogram.json +1 -0
  449. package/data/problems/largest-sum-of-averages.json +1 -0
  450. package/data/problems/largest-time-for-given-digits.json +1 -0
  451. package/data/problems/largest-triangle-area.json +1 -0
  452. package/data/problems/last-stone-weight-ii.json +1 -0
  453. package/data/problems/last-stone-weight.json +1 -0
  454. package/data/problems/leaf-similar-trees.json +1 -0
  455. package/data/problems/least-operators-to-express-number.json +1 -0
  456. package/data/problems/lemonade-change.json +1 -0
  457. package/data/problems/length-of-last-word.json +1 -0
  458. package/data/problems/length-of-longest-fibonacci-subsequence.json +1 -0
  459. package/data/problems/letter-case-permutation.json +1 -0
  460. package/data/problems/letter-combinations-of-a-phone-number.json +1 -0
  461. package/data/problems/lexicographical-numbers.json +1 -0
  462. package/data/problems/lfu-cache.json +1 -0
  463. package/data/problems/license-key-formatting.json +1 -0
  464. package/data/problems/line-reflection.json +1 -0
  465. package/data/problems/linked-list-components.json +1 -0
  466. package/data/problems/linked-list-cycle-ii.json +1 -0
  467. package/data/problems/linked-list-cycle.json +1 -0
  468. package/data/problems/linked-list-random-node.json +1 -0
  469. package/data/problems/logger-rate-limiter.json +1 -0
  470. package/data/problems/logical-or-of-two-binary-grids-represented-as-quad-trees.json +1 -0
  471. package/data/problems/lonely-pixel-i.json +1 -0
  472. package/data/problems/lonely-pixel-ii.json +1 -0
  473. package/data/problems/long-pressed-name.json +1 -0
  474. package/data/problems/longest-absolute-file-path.json +1 -0
  475. package/data/problems/longest-common-prefix.json +1 -0
  476. package/data/problems/longest-common-subsequence.json +1 -0
  477. package/data/problems/longest-consecutive-sequence.json +1 -0
  478. package/data/problems/longest-continuous-increasing-subsequence.json +1 -0
  479. package/data/problems/longest-happy-string.json +1 -0
  480. package/data/problems/longest-harmonious-subsequence.json +1 -0
  481. package/data/problems/longest-increasing-path-in-a-matrix.json +1 -0
  482. package/data/problems/longest-increasing-subsequence.json +1 -0
  483. package/data/problems/longest-line-of-consecutive-one-in-matrix.json +1 -0
  484. package/data/problems/longest-mountain-in-array.json +1 -0
  485. package/data/problems/longest-palindrome.json +1 -0
  486. package/data/problems/longest-palindromic-subsequence.json +1 -0
  487. package/data/problems/longest-palindromic-substring.json +1 -0
  488. package/data/problems/longest-repeating-character-replacement.json +1 -0
  489. package/data/problems/longest-substring-with-at-least-k-repeating-characters.json +1 -0
  490. package/data/problems/longest-substring-with-at-most-k-distinct-characters.json +1 -0
  491. package/data/problems/longest-substring-with-at-most-two-distinct-characters.json +1 -0
  492. package/data/problems/longest-substring-without-repeating-characters.json +1 -0
  493. package/data/problems/longest-turbulent-subarray.json +1 -0
  494. package/data/problems/longest-uncommon-subsequence-i.json +1 -0
  495. package/data/problems/longest-uncommon-subsequence-ii.json +1 -0
  496. package/data/problems/longest-univalue-path.json +1 -0
  497. package/data/problems/longest-valid-parentheses.json +1 -0
  498. package/data/problems/longest-word-in-dictionary-through-deleting.json +1 -0
  499. package/data/problems/longest-word-in-dictionary.json +1 -0
  500. package/data/problems/loud-and-rich.json +1 -0
  501. package/data/problems/lowest-common-ancestor-of-a-binary-search-tree.json +1 -0
  502. package/data/problems/lowest-common-ancestor-of-a-binary-tree.json +1 -0
  503. package/data/problems/lru-cache.json +1 -0
  504. package/data/problems/magic-squares-in-grid.json +1 -0
  505. package/data/problems/magical-string.json +1 -0
  506. package/data/problems/majority-element-ii.json +1 -0
  507. package/data/problems/majority-element.json +1 -0
  508. package/data/problems/making-a-large-island.json +1 -0
  509. package/data/problems/map-sum-pairs.json +1 -0
  510. package/data/problems/masking-personal-information.json +1 -0
  511. package/data/problems/matchsticks-to-square.json +1 -0
  512. package/data/problems/max-area-of-island.json +1 -0
  513. package/data/problems/max-chunks-to-make-sorted-ii.json +1 -0
  514. package/data/problems/max-chunks-to-make-sorted.json +1 -0
  515. package/data/problems/max-consecutive-ones-ii.json +1 -0
  516. package/data/problems/max-consecutive-ones.json +1 -0
  517. package/data/problems/max-increase-to-keep-city-skyline.json +1 -0
  518. package/data/problems/max-points-on-a-line.json +1 -0
  519. package/data/problems/max-stack.json +1 -0
  520. package/data/problems/max-sum-of-rectangle-no-larger-than-k.json +1 -0
  521. package/data/problems/maximal-rectangle.json +1 -0
  522. package/data/problems/maximal-square.json +1 -0
  523. package/data/problems/maximize-distance-to-closest-person.json +1 -0
  524. package/data/problems/maximum-average-subarray-i.json +1 -0
  525. package/data/problems/maximum-average-subarray-ii.json +1 -0
  526. package/data/problems/maximum-binary-tree-ii.json +1 -0
  527. package/data/problems/maximum-binary-tree.json +1 -0
  528. package/data/problems/maximum-depth-of-binary-tree.json +1 -0
  529. package/data/problems/maximum-depth-of-n-ary-tree.json +1 -0
  530. package/data/problems/maximum-distance-in-arrays.json +1 -0
  531. package/data/problems/maximum-frequency-stack.json +1 -0
  532. package/data/problems/maximum-gap.json +1 -0
  533. package/data/problems/maximum-length-of-pair-chain.json +1 -0
  534. package/data/problems/maximum-length-of-repeated-subarray.json +1 -0
  535. package/data/problems/maximum-product-of-three-numbers.json +1 -0
  536. package/data/problems/maximum-product-of-word-lengths.json +1 -0
  537. package/data/problems/maximum-product-subarray.json +1 -0
  538. package/data/problems/maximum-size-subarray-sum-equals-k.json +1 -0
  539. package/data/problems/maximum-subarray.json +1 -0
  540. package/data/problems/maximum-sum-circular-subarray.json +1 -0
  541. package/data/problems/maximum-sum-of-3-non-overlapping-subarrays.json +1 -0
  542. package/data/problems/maximum-swap.json +1 -0
  543. package/data/problems/maximum-vacation-days.json +1 -0
  544. package/data/problems/maximum-width-of-binary-tree.json +1 -0
  545. package/data/problems/maximum-width-ramp.json +1 -0
  546. package/data/problems/maximum-xor-of-two-numbers-in-an-array.json +1 -0
  547. package/data/problems/median-of-two-sorted-arrays.json +1 -0
  548. package/data/problems/meeting-rooms-ii.json +1 -0
  549. package/data/problems/meeting-rooms-iii.json +1 -0
  550. package/data/problems/meeting-rooms.json +1 -0
  551. package/data/problems/merge-intervals.json +1 -0
  552. package/data/problems/merge-k-sorted-lists.json +1 -0
  553. package/data/problems/merge-sorted-array.json +1 -0
  554. package/data/problems/merge-strings-alternately.json +1 -0
  555. package/data/problems/merge-triplets-to-form-target-triplet.json +1 -0
  556. package/data/problems/merge-two-binary-trees.json +1 -0
  557. package/data/problems/merge-two-sorted-lists.json +1 -0
  558. package/data/problems/middle-of-the-linked-list.json +1 -0
  559. package/data/problems/min-cost-climbing-stairs.json +1 -0
  560. package/data/problems/min-cost-to-connect-all-points.json +1 -0
  561. package/data/problems/min-stack.json +1 -0
  562. package/data/problems/minesweeper.json +1 -0
  563. package/data/problems/mini-parser.json +1 -0
  564. package/data/problems/minimize-malware-spread-ii.json +1 -0
  565. package/data/problems/minimize-malware-spread.json +1 -0
  566. package/data/problems/minimize-max-distance-to-gas-station.json +1 -0
  567. package/data/problems/minimum-absolute-difference-in-bst.json +1 -0
  568. package/data/problems/minimum-add-to-make-parentheses-valid.json +1 -0
  569. package/data/problems/minimum-area-rectangle-ii.json +1 -0
  570. package/data/problems/minimum-area-rectangle.json +1 -0
  571. package/data/problems/minimum-array-end.json +1 -0
  572. package/data/problems/minimum-ascii-delete-sum-for-two-strings.json +1 -0
  573. package/data/problems/minimum-cost-for-tickets.json +1 -0
  574. package/data/problems/minimum-cost-to-hire-k-workers.json +1 -0
  575. package/data/problems/minimum-cost-to-merge-stones.json +1 -0
  576. package/data/problems/minimum-depth-of-binary-tree.json +1 -0
  577. package/data/problems/minimum-distance-between-bst-nodes.json +1 -0
  578. package/data/problems/minimum-factorization.json +1 -0
  579. package/data/problems/minimum-falling-path-sum.json +1 -0
  580. package/data/problems/minimum-genetic-mutation.json +1 -0
  581. package/data/problems/minimum-height-trees.json +1 -0
  582. package/data/problems/minimum-increment-to-make-array-unique.json +1 -0
  583. package/data/problems/minimum-index-sum-of-two-lists.json +1 -0
  584. package/data/problems/minimum-interval-to-include-each-query.json +1 -0
  585. package/data/problems/minimum-moves-to-equal-array-elements-ii.json +1 -0
  586. package/data/problems/minimum-moves-to-equal-array-elements.json +1 -0
  587. package/data/problems/minimum-number-of-arrows-to-burst-balloons.json +1 -0
  588. package/data/problems/minimum-number-of-k-consecutive-bit-flips.json +1 -0
  589. package/data/problems/minimum-number-of-refueling-stops.json +1 -0
  590. package/data/problems/minimum-path-sum.json +1 -0
  591. package/data/problems/minimum-size-subarray-sum.json +1 -0
  592. package/data/problems/minimum-swaps-to-make-sequences-increasing.json +1 -0
  593. package/data/problems/minimum-time-difference.json +1 -0
  594. package/data/problems/minimum-unique-word-abbreviation.json +1 -0
  595. package/data/problems/minimum-window-subsequence.json +1 -0
  596. package/data/problems/minimum-window-substring.json +1 -0
  597. package/data/problems/mirror-reflection.json +1 -0
  598. package/data/problems/missing-number.json +1 -0
  599. package/data/problems/missing-ranges.json +1 -0
  600. package/data/problems/monotone-increasing-digits.json +1 -0
  601. package/data/problems/monotonic-array.json +1 -0
  602. package/data/problems/most-common-word.json +1 -0
  603. package/data/problems/most-frequent-subtree-sum.json +1 -0
  604. package/data/problems/most-profit-assigning-work.json +1 -0
  605. package/data/problems/most-stones-removed-with-same-row-or-column.json +1 -0
  606. package/data/problems/move-zeroes.json +1 -0
  607. package/data/problems/moving-average-from-data-stream.json +1 -0
  608. package/data/problems/multiply-strings.json +1 -0
  609. package/data/problems/my-calendar-i.json +1 -0
  610. package/data/problems/my-calendar-ii.json +1 -0
  611. package/data/problems/my-calendar-iii.json +1 -0
  612. package/data/problems/n-ary-tree-level-order-traversal.json +1 -0
  613. package/data/problems/n-ary-tree-postorder-traversal.json +1 -0
  614. package/data/problems/n-ary-tree-preorder-traversal.json +1 -0
  615. package/data/problems/n-queens-ii.json +1 -0
  616. package/data/problems/n-queens.json +1 -0
  617. package/data/problems/n-repeated-element-in-size-2n-array.json +1 -0
  618. package/data/problems/n-th-tribonacci-number.json +1 -0
  619. package/data/problems/nested-list-weight-sum-ii.json +1 -0
  620. package/data/problems/nested-list-weight-sum.json +1 -0
  621. package/data/problems/network-delay-time.json +1 -0
  622. package/data/problems/new-21-game.json +1 -0
  623. package/data/problems/next-closest-time.json +1 -0
  624. package/data/problems/next-greater-element-i.json +1 -0
  625. package/data/problems/next-greater-element-ii.json +1 -0
  626. package/data/problems/next-greater-element-iii.json +1 -0
  627. package/data/problems/next-permutation.json +1 -0
  628. package/data/problems/nim-game.json +1 -0
  629. package/data/problems/non-decreasing-array.json +1 -0
  630. package/data/problems/non-decreasing-subsequences.json +1 -0
  631. package/data/problems/non-negative-integers-without-consecutive-ones.json +1 -0
  632. package/data/problems/non-overlapping-intervals.json +1 -0
  633. package/data/problems/nth-digit.json +1 -0
  634. package/data/problems/nth-magical-number.json +1 -0
  635. package/data/problems/number-complement.json +1 -0
  636. package/data/problems/number-of-1-bits.json +1 -0
  637. package/data/problems/number-of-atoms.json +1 -0
  638. package/data/problems/number-of-boomerangs.json +1 -0
  639. package/data/problems/number-of-connected-components-in-an-undirected-graph.json +1 -0
  640. package/data/problems/number-of-corner-rectangles.json +1 -0
  641. package/data/problems/number-of-digit-one.json +1 -0
  642. package/data/problems/number-of-distinct-islands-ii.json +1 -0
  643. package/data/problems/number-of-distinct-islands.json +1 -0
  644. package/data/problems/number-of-islands-ii.json +1 -0
  645. package/data/problems/number-of-islands.json +1 -0
  646. package/data/problems/number-of-lines-to-write-string.json +1 -0
  647. package/data/problems/number-of-longest-increasing-subsequence.json +1 -0
  648. package/data/problems/number-of-matching-subsequences.json +1 -0
  649. package/data/problems/number-of-music-playlists.json +1 -0
  650. package/data/problems/number-of-provinces.json +1 -0
  651. package/data/problems/number-of-recent-calls.json +1 -0
  652. package/data/problems/number-of-segments-in-a-string.json +1 -0
  653. package/data/problems/number-of-squareful-arrays.json +1 -0
  654. package/data/problems/number-of-subarrays-with-bounded-maximum.json +1 -0
  655. package/data/problems/numbers-at-most-n-given-digit-set.json +1 -0
  656. package/data/problems/numbers-with-same-consecutive-differences.json +1 -0
  657. package/data/problems/odd-even-jump.json +1 -0
  658. package/data/problems/odd-even-linked-list.json +1 -0
  659. package/data/problems/one-edit-distance.json +1 -0
  660. package/data/problems/ones-and-zeroes.json +1 -0
  661. package/data/problems/online-election.json +1 -0
  662. package/data/problems/online-stock-span.json +1 -0
  663. package/data/problems/open-the-lock.json +1 -0
  664. package/data/problems/optimal-account-balancing.json +1 -0
  665. package/data/problems/optimal-division.json +1 -0
  666. package/data/problems/orderly-queue.json +1 -0
  667. package/data/problems/out-of-boundary-paths.json +1 -0
  668. package/data/problems/output-contest-matches.json +1 -0
  669. package/data/problems/pacific-atlantic-water-flow.json +1 -0
  670. package/data/problems/paint-fence.json +1 -0
  671. package/data/problems/paint-house-ii.json +1 -0
  672. package/data/problems/paint-house.json +1 -0
  673. package/data/problems/palindrome-linked-list.json +1 -0
  674. package/data/problems/palindrome-number.json +1 -0
  675. package/data/problems/palindrome-pairs.json +1 -0
  676. package/data/problems/palindrome-partitioning-ii.json +1 -0
  677. package/data/problems/palindrome-partitioning.json +1 -0
  678. package/data/problems/palindrome-permutation-ii.json +1 -0
  679. package/data/problems/palindrome-permutation.json +1 -0
  680. package/data/problems/palindromic-substrings.json +1 -0
  681. package/data/problems/pancake-sorting.json +1 -0
  682. package/data/problems/parse-lisp-expression.json +1 -0
  683. package/data/problems/partition-array-into-disjoint-intervals.json +1 -0
  684. package/data/problems/partition-equal-subset-sum.json +1 -0
  685. package/data/problems/partition-labels.json +1 -0
  686. package/data/problems/partition-list.json +1 -0
  687. package/data/problems/partition-to-k-equal-sum-subsets.json +1 -0
  688. package/data/problems/pascals-triangle-ii.json +1 -0
  689. package/data/problems/pascals-triangle.json +1 -0
  690. package/data/problems/patching-array.json +1 -0
  691. package/data/problems/path-sum-ii.json +1 -0
  692. package/data/problems/path-sum-iii.json +1 -0
  693. package/data/problems/path-sum-iv.json +1 -0
  694. package/data/problems/path-sum.json +1 -0
  695. package/data/problems/path-with-minimum-effort.json +1 -0
  696. package/data/problems/peak-index-in-a-mountain-array.json +1 -0
  697. package/data/problems/peeking-iterator.json +1 -0
  698. package/data/problems/perfect-number.json +1 -0
  699. package/data/problems/perfect-rectangle.json +1 -0
  700. package/data/problems/perfect-squares.json +1 -0
  701. package/data/problems/permutation-in-string.json +1 -0
  702. package/data/problems/permutation-sequence.json +1 -0
  703. package/data/problems/permutations-ii.json +1 -0
  704. package/data/problems/permutations.json +1 -0
  705. package/data/problems/plus-one-linked-list.json +1 -0
  706. package/data/problems/plus-one.json +1 -0
  707. package/data/problems/poor-pigs.json +1 -0
  708. package/data/problems/populating-next-right-pointers-in-each-node-ii.json +1 -0
  709. package/data/problems/populating-next-right-pointers-in-each-node.json +1 -0
  710. package/data/problems/positions-of-large-groups.json +1 -0
  711. package/data/problems/possible-bipartition.json +1 -0
  712. package/data/problems/pour-water.json +1 -0
  713. package/data/problems/power-of-four.json +1 -0
  714. package/data/problems/power-of-three.json +1 -0
  715. package/data/problems/power-of-two.json +1 -0
  716. package/data/problems/powerful-integers.json +1 -0
  717. package/data/problems/powx-n.json +1 -0
  718. package/data/problems/predict-the-winner.json +1 -0
  719. package/data/problems/prefix-and-suffix-search.json +1 -0
  720. package/data/problems/preimage-size-of-factorial-zeroes-function.json +1 -0
  721. package/data/problems/prime-number-of-set-bits-in-binary-representation.json +1 -0
  722. package/data/problems/prime-palindrome.json +1 -0
  723. package/data/problems/print-binary-tree.json +1 -0
  724. package/data/problems/prison-cells-after-n-days.json +1 -0
  725. package/data/problems/product-of-array-except-self.json +1 -0
  726. package/data/problems/profitable-schemes.json +1 -0
  727. package/data/problems/projection-area-of-3d-shapes.json +1 -0
  728. package/data/problems/push-dominoes.json +1 -0
  729. package/data/problems/pyramid-transition-matrix.json +1 -0
  730. package/data/problems/queue-reconstruction-by-height.json +1 -0
  731. package/data/problems/rabbits-in-forest.json +1 -0
  732. package/data/problems/race-car.json +1 -0
  733. package/data/problems/random-flip-matrix.json +1 -0
  734. package/data/problems/random-pick-index.json +1 -0
  735. package/data/problems/random-pick-with-blacklist.json +1 -0
  736. package/data/problems/random-pick-with-weight.json +1 -0
  737. package/data/problems/random-point-in-non-overlapping-rectangles.json +1 -0
  738. package/data/problems/range-addition-ii.json +1 -0
  739. package/data/problems/range-addition.json +1 -0
  740. package/data/problems/range-module.json +1 -0
  741. package/data/problems/range-sum-of-bst.json +1 -0
  742. package/data/problems/range-sum-query-2d-immutable.json +1 -0
  743. package/data/problems/range-sum-query-2d-mutable.json +1 -0
  744. package/data/problems/range-sum-query-immutable.json +1 -0
  745. package/data/problems/range-sum-query-mutable.json +1 -0
  746. package/data/problems/ransom-note.json +1 -0
  747. package/data/problems/reach-a-number.json +1 -0
  748. package/data/problems/reachable-nodes-in-subdivided-graph.json +1 -0
  749. package/data/problems/reaching-points.json +1 -0
  750. package/data/problems/read-n-characters-given-read4-ii-call-multiple-times.json +1 -0
  751. package/data/problems/read-n-characters-given-read4.json +1 -0
  752. package/data/problems/rearrange-string-k-distance-apart.json +1 -0
  753. package/data/problems/reconstruct-itinerary.json +1 -0
  754. package/data/problems/reconstruct-original-digits-from-english.json +1 -0
  755. package/data/problems/recover-binary-search-tree.json +1 -0
  756. package/data/problems/rectangle-area-ii.json +1 -0
  757. package/data/problems/rectangle-area.json +1 -0
  758. package/data/problems/rectangle-overlap.json +1 -0
  759. package/data/problems/redundant-connection-ii.json +1 -0
  760. package/data/problems/redundant-connection.json +1 -0
  761. package/data/problems/regions-cut-by-slashes.json +1 -0
  762. package/data/problems/regular-expression-matching.json +1 -0
  763. package/data/problems/relative-ranks.json +1 -0
  764. package/data/problems/remove-9.json +1 -0
  765. package/data/problems/remove-boxes.json +1 -0
  766. package/data/problems/remove-comments.json +1 -0
  767. package/data/problems/remove-duplicate-letters.json +1 -0
  768. package/data/problems/remove-duplicates-from-sorted-array-ii.json +1 -0
  769. package/data/problems/remove-duplicates-from-sorted-array.json +1 -0
  770. package/data/problems/remove-duplicates-from-sorted-list-ii.json +1 -0
  771. package/data/problems/remove-duplicates-from-sorted-list.json +1 -0
  772. package/data/problems/remove-element.json +1 -0
  773. package/data/problems/remove-invalid-parentheses.json +1 -0
  774. package/data/problems/remove-k-digits.json +1 -0
  775. package/data/problems/remove-linked-list-elements.json +1 -0
  776. package/data/problems/remove-nth-node-from-end-of-list.json +1 -0
  777. package/data/problems/reorder-data-in-log-files.json +1 -0
  778. package/data/problems/reorder-list.json +1 -0
  779. package/data/problems/reordered-power-of-2.json +1 -0
  780. package/data/problems/reorganize-string.json +1 -0
  781. package/data/problems/repeated-dna-sequences.json +1 -0
  782. package/data/problems/repeated-string-match.json +1 -0
  783. package/data/problems/repeated-substring-pattern.json +1 -0
  784. package/data/problems/replace-words.json +1 -0
  785. package/data/problems/reshape-the-matrix.json +1 -0
  786. package/data/problems/restore-ip-addresses.json +1 -0
  787. package/data/problems/reveal-cards-in-increasing-order.json +1 -0
  788. package/data/problems/reverse-bits.json +1 -0
  789. package/data/problems/reverse-integer.json +1 -0
  790. package/data/problems/reverse-linked-list-ii.json +1 -0
  791. package/data/problems/reverse-linked-list.json +1 -0
  792. package/data/problems/reverse-nodes-in-k-group.json +1 -0
  793. package/data/problems/reverse-only-letters.json +1 -0
  794. package/data/problems/reverse-pairs.json +1 -0
  795. package/data/problems/reverse-string-ii.json +1 -0
  796. package/data/problems/reverse-string.json +1 -0
  797. package/data/problems/reverse-vowels-of-a-string.json +1 -0
  798. package/data/problems/reverse-words-in-a-string-ii.json +1 -0
  799. package/data/problems/reverse-words-in-a-string-iii.json +1 -0
  800. package/data/problems/reverse-words-in-a-string.json +1 -0
  801. package/data/problems/rle-iterator.json +1 -0
  802. package/data/problems/robot-return-to-origin.json +1 -0
  803. package/data/problems/robot-room-cleaner.json +1 -0
  804. package/data/problems/roman-to-integer.json +1 -0
  805. package/data/problems/rotate-array.json +1 -0
  806. package/data/problems/rotate-function.json +1 -0
  807. package/data/problems/rotate-image.json +1 -0
  808. package/data/problems/rotate-list.json +1 -0
  809. package/data/problems/rotate-string.json +1 -0
  810. package/data/problems/rotated-digits.json +1 -0
  811. package/data/problems/rotting-oranges.json +1 -0
  812. package/data/problems/russian-doll-envelopes.json +1 -0
  813. package/data/problems/same-tree.json +1 -0
  814. package/data/problems/satisfiability-of-equality-equations.json +1 -0
  815. package/data/problems/score-after-flipping-matrix.json +1 -0
  816. package/data/problems/score-of-parentheses.json +1 -0
  817. package/data/problems/scramble-string.json +1 -0
  818. package/data/problems/search-a-2d-matrix-ii.json +1 -0
  819. package/data/problems/search-a-2d-matrix.json +1 -0
  820. package/data/problems/search-in-a-binary-search-tree.json +1 -0
  821. package/data/problems/search-in-a-sorted-array-of-unknown-size.json +1 -0
  822. package/data/problems/search-in-rotated-sorted-array-ii.json +1 -0
  823. package/data/problems/search-in-rotated-sorted-array.json +1 -0
  824. package/data/problems/search-insert-position.json +1 -0
  825. package/data/problems/second-minimum-node-in-a-binary-tree.json +1 -0
  826. package/data/problems/self-crossing.json +1 -0
  827. package/data/problems/self-dividing-numbers.json +1 -0
  828. package/data/problems/sentence-screen-fitting.json +1 -0
  829. package/data/problems/sentence-similarity-ii.json +1 -0
  830. package/data/problems/sentence-similarity.json +1 -0
  831. package/data/problems/sequence-reconstruction.json +1 -0
  832. package/data/problems/serialize-and-deserialize-binary-tree.json +1 -0
  833. package/data/problems/serialize-and-deserialize-bst.json +1 -0
  834. package/data/problems/serialize-and-deserialize-n-ary-tree.json +1 -0
  835. package/data/problems/set-intersection-size-at-least-two.json +1 -0
  836. package/data/problems/set-matrix-zeroes.json +1 -0
  837. package/data/problems/set-mismatch.json +1 -0
  838. package/data/problems/shifting-letters.json +1 -0
  839. package/data/problems/shopping-offers.json +1 -0
  840. package/data/problems/short-encoding-of-words.json +1 -0
  841. package/data/problems/shortest-bridge.json +1 -0
  842. package/data/problems/shortest-completing-word.json +1 -0
  843. package/data/problems/shortest-distance-from-all-buildings.json +1 -0
  844. package/data/problems/shortest-distance-to-a-character.json +1 -0
  845. package/data/problems/shortest-palindrome.json +1 -0
  846. package/data/problems/shortest-path-to-get-all-keys.json +1 -0
  847. package/data/problems/shortest-path-visiting-all-nodes.json +1 -0
  848. package/data/problems/shortest-subarray-with-sum-at-least-k.json +1 -0
  849. package/data/problems/shortest-unsorted-continuous-subarray.json +1 -0
  850. package/data/problems/shortest-word-distance-ii.json +1 -0
  851. package/data/problems/shortest-word-distance-iii.json +1 -0
  852. package/data/problems/shortest-word-distance.json +1 -0
  853. package/data/problems/shuffle-an-array.json +1 -0
  854. package/data/problems/similar-rgb-color.json +1 -0
  855. package/data/problems/similar-string-groups.json +1 -0
  856. package/data/problems/simplify-path.json +1 -0
  857. package/data/problems/single-element-in-a-sorted-array.json +1 -0
  858. package/data/problems/single-number-ii.json +1 -0
  859. package/data/problems/single-number-iii.json +1 -0
  860. package/data/problems/single-number.json +1 -0
  861. package/data/problems/single-threaded-cpu.json +1 -0
  862. package/data/problems/sliding-puzzle.json +1 -0
  863. package/data/problems/sliding-window-maximum.json +1 -0
  864. package/data/problems/sliding-window-median.json +1 -0
  865. package/data/problems/smallest-good-base.json +1 -0
  866. package/data/problems/smallest-range-covering-elements-from-k-lists.json +1 -0
  867. package/data/problems/smallest-range-i.json +1 -0
  868. package/data/problems/smallest-range-ii.json +1 -0
  869. package/data/problems/smallest-rectangle-enclosing-black-pixels.json +1 -0
  870. package/data/problems/smallest-rotation-with-highest-score.json +1 -0
  871. package/data/problems/smallest-string-starting-from-leaf.json +1 -0
  872. package/data/problems/smallest-subtree-with-all-the-deepest-nodes.json +1 -0
  873. package/data/problems/snakes-and-ladders.json +1 -0
  874. package/data/problems/solve-the-equation.json +1 -0
  875. package/data/problems/sort-an-array.json +1 -0
  876. package/data/problems/sort-array-by-parity-ii.json +1 -0
  877. package/data/problems/sort-array-by-parity.json +1 -0
  878. package/data/problems/sort-characters-by-frequency.json +1 -0
  879. package/data/problems/sort-colors.json +1 -0
  880. package/data/problems/sort-list.json +1 -0
  881. package/data/problems/sort-transformed-array.json +1 -0
  882. package/data/problems/soup-servings.json +1 -0
  883. package/data/problems/sparse-matrix-multiplication.json +1 -0
  884. package/data/problems/special-binary-string.json +1 -0
  885. package/data/problems/spiral-matrix-ii.json +1 -0
  886. package/data/problems/spiral-matrix-iii.json +1 -0
  887. package/data/problems/spiral-matrix.json +1 -0
  888. package/data/problems/split-array-into-consecutive-subsequences.json +1 -0
  889. package/data/problems/split-array-into-fibonacci-sequence.json +1 -0
  890. package/data/problems/split-array-largest-sum.json +1 -0
  891. package/data/problems/split-array-with-equal-sum.json +1 -0
  892. package/data/problems/split-array-with-same-average.json +1 -0
  893. package/data/problems/split-bst.json +1 -0
  894. package/data/problems/split-concatenated-strings.json +1 -0
  895. package/data/problems/split-linked-list-in-parts.json +1 -0
  896. package/data/problems/sqrtx.json +1 -0
  897. package/data/problems/squares-of-a-sorted-array.json +1 -0
  898. package/data/problems/squirrel-simulation.json +1 -0
  899. package/data/problems/stamping-the-sequence.json +1 -0
  900. package/data/problems/stickers-to-spell-word.json +1 -0
  901. package/data/problems/stone-game-ii.json +1 -0
  902. package/data/problems/stone-game-iii.json +1 -0
  903. package/data/problems/stone-game.json +1 -0
  904. package/data/problems/strange-printer.json +1 -0
  905. package/data/problems/string-compression.json +1 -0
  906. package/data/problems/string-to-integer-atoi.json +1 -0
  907. package/data/problems/string-without-aaa-or-bbb.json +1 -0
  908. package/data/problems/strobogrammatic-number-ii.json +1 -0
  909. package/data/problems/strobogrammatic-number-iii.json +1 -0
  910. package/data/problems/strobogrammatic-number.json +1 -0
  911. package/data/problems/strong-password-checker.json +1 -0
  912. package/data/problems/student-attendance-record-i.json +1 -0
  913. package/data/problems/student-attendance-record-ii.json +1 -0
  914. package/data/problems/subarray-product-less-than-k.json +1 -0
  915. package/data/problems/subarray-sum-equals-k.json +1 -0
  916. package/data/problems/subarray-sums-divisible-by-k.json +1 -0
  917. package/data/problems/subarrays-with-k-different-integers.json +1 -0
  918. package/data/problems/subdomain-visit-count.json +1 -0
  919. package/data/problems/subsets-ii.json +1 -0
  920. package/data/problems/subsets.json +1 -0
  921. package/data/problems/substring-with-concatenation-of-all-words.json +1 -0
  922. package/data/problems/subtree-of-another-tree.json +1 -0
  923. package/data/problems/sudoku-solver.json +1 -0
  924. package/data/problems/sum-of-all-subset-xor-totals.json +1 -0
  925. package/data/problems/sum-of-distances-in-tree.json +1 -0
  926. package/data/problems/sum-of-even-numbers-after-queries.json +1 -0
  927. package/data/problems/sum-of-left-leaves.json +1 -0
  928. package/data/problems/sum-of-square-numbers.json +1 -0
  929. package/data/problems/sum-of-subarray-minimums.json +1 -0
  930. package/data/problems/sum-of-subsequence-widths.json +1 -0
  931. package/data/problems/sum-of-two-integers.json +1 -0
  932. package/data/problems/sum-root-to-leaf-numbers.json +1 -0
  933. package/data/problems/summary-ranges.json +1 -0
  934. package/data/problems/super-egg-drop.json +1 -0
  935. package/data/problems/super-palindromes.json +1 -0
  936. package/data/problems/super-pow.json +1 -0
  937. package/data/problems/super-ugly-number.json +1 -0
  938. package/data/problems/super-washing-machines.json +1 -0
  939. package/data/problems/surface-area-of-3d-shapes.json +1 -0
  940. package/data/problems/surrounded-regions.json +1 -0
  941. package/data/problems/swap-adjacent-in-lr-string.json +1 -0
  942. package/data/problems/swap-nodes-in-pairs.json +1 -0
  943. package/data/problems/swim-in-rising-water.json +1 -0
  944. package/data/problems/symmetric-tree.json +1 -0
  945. package/data/problems/tag-validator.json +1 -0
  946. package/data/problems/tallest-billboard.json +1 -0
  947. package/data/problems/target-sum.json +1 -0
  948. package/data/problems/task-scheduler.json +1 -0
  949. package/data/problems/teemo-attacking.json +1 -0
  950. package/data/problems/ternary-expression-parser.json +1 -0
  951. package/data/problems/text-justification.json +1 -0
  952. package/data/problems/the-maze-ii.json +1 -0
  953. package/data/problems/the-maze-iii.json +1 -0
  954. package/data/problems/the-maze.json +1 -0
  955. package/data/problems/the-skyline-problem.json +1 -0
  956. package/data/problems/third-maximum-number.json +1 -0
  957. package/data/problems/three-equal-parts.json +1 -0
  958. package/data/problems/time-based-key-value-store.json +1 -0
  959. package/data/problems/to-lower-case.json +1 -0
  960. package/data/problems/toeplitz-matrix.json +1 -0
  961. package/data/problems/top-k-frequent-elements.json +1 -0
  962. package/data/problems/top-k-frequent-words.json +1 -0
  963. package/data/problems/total-hamming-distance.json +1 -0
  964. package/data/problems/transform-to-chessboard.json +1 -0
  965. package/data/problems/transpose-matrix.json +1 -0
  966. package/data/problems/trapping-rain-water-ii.json +1 -0
  967. package/data/problems/trapping-rain-water.json +1 -0
  968. package/data/problems/triangle.json +1 -0
  969. package/data/problems/trim-a-binary-search-tree.json +1 -0
  970. package/data/problems/triples-with-bitwise-and-equal-to-zero.json +1 -0
  971. package/data/problems/two-sum-ii-input-array-is-sorted.json +1 -0
  972. package/data/problems/two-sum-iii-data-structure-design.json +1 -0
  973. package/data/problems/two-sum-iv-input-is-a-bst.json +1 -0
  974. package/data/problems/two-sum.json +1 -0
  975. package/data/problems/ugly-number-ii.json +1 -0
  976. package/data/problems/ugly-number.json +1 -0
  977. package/data/problems/uncommon-words-from-two-sentences.json +1 -0
  978. package/data/problems/unique-binary-search-trees-ii.json +1 -0
  979. package/data/problems/unique-binary-search-trees.json +1 -0
  980. package/data/problems/unique-email-addresses.json +1 -0
  981. package/data/problems/unique-morse-code-words.json +1 -0
  982. package/data/problems/unique-paths-ii.json +1 -0
  983. package/data/problems/unique-paths-iii.json +1 -0
  984. package/data/problems/unique-paths.json +1 -0
  985. package/data/problems/unique-substrings-in-wraparound-string.json +1 -0
  986. package/data/problems/unique-word-abbreviation.json +1 -0
  987. package/data/problems/univalued-binary-tree.json +1 -0
  988. package/data/problems/utf-8-validation.json +1 -0
  989. package/data/problems/valid-anagram.json +1 -0
  990. package/data/problems/valid-mountain-array.json +1 -0
  991. package/data/problems/valid-number.json +1 -0
  992. package/data/problems/valid-palindrome-ii.json +1 -0
  993. package/data/problems/valid-palindrome.json +1 -0
  994. package/data/problems/valid-parentheses.json +1 -0
  995. package/data/problems/valid-parenthesis-string.json +1 -0
  996. package/data/problems/valid-perfect-square.json +1 -0
  997. package/data/problems/valid-permutations-for-di-sequence.json +1 -0
  998. package/data/problems/valid-square.json +1 -0
  999. package/data/problems/valid-sudoku.json +1 -0
  1000. package/data/problems/valid-tic-tac-toe-state.json +1 -0
  1001. package/data/problems/valid-triangle-number.json +1 -0
  1002. package/data/problems/valid-word-abbreviation.json +1 -0
  1003. package/data/problems/valid-word-square.json +1 -0
  1004. package/data/problems/validate-binary-search-tree.json +1 -0
  1005. package/data/problems/validate-ip-address.json +1 -0
  1006. package/data/problems/validate-stack-sequences.json +1 -0
  1007. package/data/problems/verify-preorder-sequence-in-binary-search-tree.json +1 -0
  1008. package/data/problems/verify-preorder-serialization-of-a-binary-tree.json +1 -0
  1009. package/data/problems/verifying-an-alien-dictionary.json +1 -0
  1010. package/data/problems/vertical-order-traversal-of-a-binary-tree.json +1 -0
  1011. package/data/problems/vowel-spellchecker.json +1 -0
  1012. package/data/problems/walking-robot-simulation.json +1 -0
  1013. package/data/problems/walls-and-gates.json +1 -0
  1014. package/data/problems/water-and-jug-problem.json +1 -0
  1015. package/data/problems/wiggle-sort-ii.json +1 -0
  1016. package/data/problems/wiggle-sort.json +1 -0
  1017. package/data/problems/wiggle-subsequence.json +1 -0
  1018. package/data/problems/wildcard-matching.json +1 -0
  1019. package/data/problems/word-abbreviation.json +1 -0
  1020. package/data/problems/word-break-ii.json +1 -0
  1021. package/data/problems/word-break.json +1 -0
  1022. package/data/problems/word-ladder-ii.json +1 -0
  1023. package/data/problems/word-ladder.json +1 -0
  1024. package/data/problems/word-pattern-ii.json +1 -0
  1025. package/data/problems/word-pattern.json +1 -0
  1026. package/data/problems/word-search-ii.json +1 -0
  1027. package/data/problems/word-search.json +1 -0
  1028. package/data/problems/word-squares.json +1 -0
  1029. package/data/problems/word-subsets.json +1 -0
  1030. package/data/problems/x-of-a-kind-in-a-deck-of-cards.json +1 -0
  1031. package/data/problems/zigzag-conversion.json +1 -0
  1032. package/data/problems/zigzag-iterator.json +1 -0
  1033. package/data/problems/zuma-game.json +1 -0
  1034. package/dist/cli.js +793 -0
  1035. package/dist/web/assets/index-7tyR3Zsa.js +147 -0
  1036. package/dist/web/assets/index-oer4U46K.css +1 -0
  1037. package/dist/web/index.html +13 -0
  1038. package/package.json +42 -3
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b35", "slug": "basic-count-pairs", "id": 35, "title": "Count Pairs with Sum", "difficulty": "Easy", "category": "nested-loops", "link": null, "examples": [{"input": "nums = [1,2,3,4], target = 5", "output": "2", "explanation": "Pairs (1,4) and (2,3) work."}, {"input": "nums = [0,0,0], target = 0", "output": "3", "explanation": "All three position pairs work."}], "hints": ["Use two loops: `i` from start, `j` from `i+1`.", "Count 1 every time the pair sums to the target."], "statement": "Return how many index pairs `(i, j)` with `i < j` satisfy `nums[i] + nums[j] == target`. Each pair of positions counts separately, even when values repeat.\n\n**Constraints:**\n- ``0 <= nums.length <= 500``\n- ``-10^9 <= nums[i], target <= 10^9``\n", "solution": "## Approach\n\nNest two loops so every unordered index pair is visited exactly once. Test each pair's sum against the target and count the matches.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def countPairs(self, nums: List[int], target: int) -> int:\n count = 0\n for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n count += 1\n return count\n```\n", "starter": {"go": "package main\n\nfunc CountPairs(nums []int, target int) int {\n return 0\n}", "python": "from typing import List\n\nclass Solution:\n def countPairs(self, nums: List[int], target: int) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int countPairs(vector<int>& nums, int target) {\n return 0;\n }\n};"}, "fn": "countPairs", "params": [{"name": "nums", "type": "int_array"}, {"name": "target", "type": "int"}], "outputType": "int", "tests": [["[1,2,3,4]", "5"], ["[0,0,0]", "0"], ["[5]", "5"], ["[]", "1"], ["[3,3,3,3]", "6"], ["[1,1,2,3,5]", "4"], ["[-1,0,1,2]", "1"], ["[1, 1, 1]", "2"], ["[5, 5, 5, 5]", "10"], ["[1, 2, 3]", "10"], ["[-2, -1, 0, 1, 2]", "0"], ["[10, -10, 5, -5]", "0"], ["[3, 7, 2, 8, 1]", "9"], ["[4, 4]", "8"], ["[4, 4]", "7"], ["[1, 9, 5, 5, 5]", "10"], ["[0, 1, 2, 3, 4, 5]", "5"], ["[100, 200, 300]", "500"], ["[-5, 5, 10]", "5"], ["[2, 4, 6, 8]", "12"], ["[7]", "7"], ["[1, 2]", "3"], ["[9, 9, 9, 9, 9]", "18"], ["[1, 3, 2, 4]", "6"], ["[-1, -1, 2, 2]", "1"], ["[50, 50]", "100"], ["[6, 1, 5, 2, 4, 3]", "7"]], "expected": [2, 3, 0, 0, 6, 2, 2, 3, 6, 0, 2, 2, 2, 1, 0, 4, 3, 1, 1, 1, 0, 1, 10, 1, 4, 1, 3], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b28", "slug": "basic-count-vowels", "id": 28, "title": "Count Vowels", "difficulty": "Easy", "category": "strings", "link": null, "examples": [{"input": "s = \"hello\"", "output": "2", "explanation": "e and o are vowels."}, {"input": "s = \"XYZ\"", "output": "0", "explanation": "No vowels present."}], "hints": ["Check each character against the ten vowel letters.", "Convert the character to lowercase first to halve the checks."], "statement": "Return how many vowels appear in `s`. The vowels are `a, e, i, o, u` in both lowercase and uppercase.\n\n**Constraints:**\n- ``0 <= s.length <= 1000``\n", "solution": "## Approach\n\nExamine each character in lowercase form. Whenever it matches one of the five vowel letters, increment the counter.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def countVowels(self, s: str) -> int:\n count = 0\n for ch in s.lower():\n if ch in 'aeiou':\n count += 1\n return count\n```\n", "starter": {"go": "package main\n\nfunc CountVowels(s string) int {\n return 0\n}", "python": "class Solution:\n def countVowels(self, s: str) -> int:\n return 0\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n int countVowels(string s) {\n return 0;\n }\n};"}, "fn": "countVowels", "params": [{"name": "s", "type": "string"}], "outputType": "int", "tests": [["hello"], ["AEIOU"], ["xyz"], [""], ["Programming"], ["aeiouAEIOU"], ["bcdfg"], ["AeIoU"], ["bcdfg BCDFG"], ["Hello World"], ["rhythm"], ["AEIOUaeiou"], ["a"], ["E"], ["x"], ["The quick brown fox jumps"], ["qqqq"], ["uoiea"], ["MIXED case Vowels"], ["12345"], ["a e i o u"], ["bcD"], ["OOOooo"], ["Programming IS fun"], ["why"], ["AEI"], ["ou"]], "expected": [2, 5, 0, 0, 3, 10, 0, 5, 0, 3, 0, 10, 1, 1, 0, 6, 0, 5, 6, 0, 5, 0, 6, 5, 0, 3, 2], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b34", "slug": "basic-count-words", "id": 34, "title": "Count Words", "difficulty": "Easy", "category": "strings", "link": null, "examples": [{"input": "s = \"hello world\"", "output": "2", "explanation": "Two words."}, {"input": "s = \" hi there \"", "output": "2", "explanation": "Extra spaces do not create words."}], "hints": ["Trim the string first; empty after trimming means 0.", "Split on whitespace and count the pieces."], "statement": "Return how many words the string `s` contains. Words are separated by spaces; ignore any leading, trailing, or extra repeated spaces. An empty or all-space string has 0 words.\n\n**Constraints:**\n- ``0 <= s.length <= 1000``\n- `Only lowercase letters and spaces appear`\n", "solution": "## Approach\n\nTrim surrounding spaces and return zero when nothing remains. Otherwise split on runs of whitespace and count the pieces.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(n).\n\n## Implementation\n\n```python\nclass Solution:\n def countWords(self, s: str) -> int:\n parts = s.split()\n return len(parts)\n```\n", "starter": {"go": "package main\n\nfunc CountWords(s string) int {\n return 0\n}", "python": "class Solution:\n def countWords(self, s: str) -> int:\n return 0\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n int countWords(string s) {\n return 0;\n }\n};"}, "fn": "countWords", "params": [{"name": "s", "type": "string"}], "outputType": "int", "tests": [["hello world"], [" hi there "], [""], ["one"], [" "], ["a b c"], [" a "], ["the quick brown fox"], ["a"], ["a b"], [" a b c "], ["hello"], ["one two three four"], [" leading"], ["trailing "], ["multiple spaces inside"], ["a b"], [" "], ["the quick brown fox jumps over"], ["x y z w"], ["word"], [" word "], ["two words"], ["lorem ipsum dolor sit amet"], ["a b c d e f g"], ["ends with space "], [" starts"], ["one two two two two two two two two two two two two two two two two two two two two"]], "expected": [2, 2, 0, 1, 0, 3, 1, 4, 1, 2, 3, 1, 4, 1, 1, 3, 2, 0, 6, 4, 1, 1, 2, 5, 7, 3, 1, 21], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b15", "slug": "basic-countdown", "id": 15, "title": "Countdown List", "difficulty": "Easy", "category": "loops", "link": null, "examples": [{"input": "n = 4", "output": "[4,3,2,1]", "explanation": "Count down from 4 to 1."}, {"input": "n = 1", "output": "[1]", "explanation": "A countdown from 1 is just [1]."}], "hints": ["Create an array and fill it in a loop.", "Position 0 holds `n`, position 1 holds `n-1`, and so on."], "statement": "Return the countdown from `n` down to 1 as an array. For example, `n = 4` gives `[4,3,2,1]`.\n\n**Constraints:**\n- ``1 <= n <= 1000``\n", "solution": "## Approach\n\nAllocate an array of length n. Fill each position i with n minus i so the values descend from n to one.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(n).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def countdown(self, n: int) -> List[int]:\n return [n - i for i in range(n)]\n```\n", "starter": {"go": "package main\n\nfunc Countdown(n int) []int {\n return []int{}\n}", "python": "from typing import List\n\nclass Solution:\n def countdown(self, n: int) -> List[int]:\n return []\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> countdown(int n) {\n return {};\n }\n};"}, "fn": "countdown", "params": [{"name": "n", "type": "int"}], "outputType": "int_array", "tests": [["4"], ["1"], ["5"], ["2"], ["3"], ["10"], ["100"], ["6"], ["7"], ["8"], ["9"], ["15"], ["20"], ["25"], ["30"], ["40"], ["60"], ["80"], ["150"], ["200"], ["250"], ["400"], ["600"], ["800"], ["900"], ["1000"], ["12"]], "expected": [[4, 3, 2, 1], [1], [5, 4, 3, 2, 1], [2, 1], [3, 2, 1], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [6, 5, 4, 3, 2, 1], [7, 6, 5, 4, 3, 2, 1], [8, 7, 6, 5, 4, 3, 2, 1], [9, 8, 7, 6, 5, 4, 3, 2, 1], [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [800, 799, 798, 797, 796, 795, 794, 793, 792, 791, 790, 789, 788, 787, 786, 785, 784, 783, 782, 781, 780, 779, 778, 777, 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 755, 754, 753, 752, 751, 750, 749, 748, 747, 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [900, 899, 898, 897, 896, 895, 894, 893, 892, 891, 890, 889, 888, 887, 886, 885, 884, 883, 882, 881, 880, 879, 878, 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, 857, 856, 855, 854, 853, 852, 851, 850, 849, 848, 847, 846, 845, 844, 843, 842, 841, 840, 839, 838, 837, 836, 835, 834, 833, 832, 831, 830, 829, 828, 827, 826, 825, 824, 823, 822, 821, 820, 819, 818, 817, 816, 815, 814, 813, 812, 811, 810, 809, 808, 807, 806, 805, 804, 803, 802, 801, 800, 799, 798, 797, 796, 795, 794, 793, 792, 791, 790, 789, 788, 787, 786, 785, 784, 783, 782, 781, 780, 779, 778, 777, 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 755, 754, 753, 752, 751, 750, 749, 748, 747, 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, 962, 961, 960, 959, 958, 957, 956, 955, 954, 953, 952, 951, 950, 949, 948, 947, 946, 945, 944, 943, 942, 941, 940, 939, 938, 937, 936, 935, 934, 933, 932, 931, 930, 929, 928, 927, 926, 925, 924, 923, 922, 921, 920, 919, 918, 917, 916, 915, 914, 913, 912, 911, 910, 909, 908, 907, 906, 905, 904, 903, 902, 901, 900, 899, 898, 897, 896, 895, 894, 893, 892, 891, 890, 889, 888, 887, 886, 885, 884, 883, 882, 881, 880, 879, 878, 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, 857, 856, 855, 854, 853, 852, 851, 850, 849, 848, 847, 846, 845, 844, 843, 842, 841, 840, 839, 838, 837, 836, 835, 834, 833, 832, 831, 830, 829, 828, 827, 826, 825, 824, 823, 822, 821, 820, 819, 818, 817, 816, 815, 814, 813, 812, 811, 810, 809, 808, 807, 806, 805, 804, 803, 802, 801, 800, 799, 798, 797, 796, 795, 794, 793, 792, 791, 790, 789, 788, 787, 786, 785, 784, 783, 782, 781, 780, 779, 778, 777, 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 755, 754, 753, 752, 751, 750, 749, 748, 747, 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b25", "slug": "basic-double-array", "id": 25, "title": "Double Array", "difficulty": "Easy", "category": "arrays", "link": null, "examples": [{"input": "nums = [1,2,3]", "output": "[2,4,6]", "explanation": "Each value doubles."}, {"input": "nums = [-1,0]", "output": "[-2,0]", "explanation": "-1 doubles to -2; 0 stays 0."}], "hints": ["Build an answer array of the same length.", "Set `ans[i] = nums[i] * 2` in a loop."], "statement": "Return a new array where each element of `nums` is multiplied by 2.\n\n**Constraints:**\n- ``0 <= nums.length <= 1000``\n- ``-10^6 <= nums[i] <= 10^6``\n", "solution": "## Approach\n\nCreate an output array of matching length. Fill each slot with twice the corresponding input value.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(n).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def doubleArray(self, nums: List[int]) -> List[int]:\n return [x * 2 for x in nums]\n```\n", "starter": {"go": "package main\n\nfunc DoubleArray(nums []int) []int {\n return []int{}\n}", "python": "from typing import List\n\nclass Solution:\n def doubleArray(self, nums: List[int]) -> List[int]:\n return []\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> doubleArray(vector<int>& nums) {\n return {};\n }\n};"}, "fn": "doubleArray", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int_array", "tests": [["[1,2,3]"], ["[]"], ["[-1,0]"], ["[0]"], ["[1000000]"], ["[-1000000,1000000]"], ["[4, 5]"], ["[0, 0, 1]"], ["[-3, 7, -8]"], ["[1000000, -1000000]"], ["[999999]"], ["[-999999]"], ["[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]"], ["[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"], ["[500000, 500001]"], ["[-500000, -500001]"], ["[790452, 265197, 598872, 346177, -142897, -574650]"], ["[-317925, 758712, -231362, -210231]"], ["[33526, 730180, 564665, 975060, -284717, 648346, -857536, -946924, -981996, -297226, 781972, 311077, -183410, 415594, 82204, 102323, -852247, -111018, 273863, 15057, -565977, 61245, 717651, -543785, 515884, 617091, 80605]"], ["[802491, 843414, 758760, -478830, -775712, 310539, -142169, 622234, 612207, 937562, 564445, 735179, -926674, 577688, 288226, 643582, 502466, -276560]"], ["[917000, -520655, 568782, 142694, -126535, -936420, 88551, 449121, 694275, -654403, 835386]"], ["[204389, 483119, 840635, -561097, 100064, -105120, -953362, -930218, -741095, 524652, -969703, 780612, 460377, -670409, -423667, 333566, -392235, 529138]"], ["[349648, -461957, 686518, 894621, -643372, -106134, 366797, -279059, 745924, 933989, -559197, 122444, -778513, 991601, 827089, -101694, -77799, 477394, 700060, 957877, 555269, 910221, -113774, -768746, -401598, -960073, -305364, 386822, -493829, 197827]"], ["[777641, -570642, 316708, 535552, 422224, -145065, 628257, 254458, -573920, -398698, 344087, 737781, -374811, -113565, 920407, 731114]"], ["[747930, -334428, 258473, -166875, 830479, -17790, -303232, -967322, 455351, -792819, 6849, 116169, 606204]"], ["[207999, 319014, -952577, 322390, -35743, 394030, -742109, 105794, -201833, 773525, 448909, -797605, 581597, -26456, 142832, 166251, -259823, 28986, -354152, 955800, 651464, 367005, -727976, 952434, -853078, -485434, 823245]"], ["[998403]"]], "expected": [[2, 4, 6], [], [-2, 0], [0], [2000000], [-2000000, 2000000], [8, 10], [0, 0, 2], [-6, 14, -16], [2000000, -2000000], [1999998], [-1999998], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [-20, -18, -16, -14, -12, -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [1000000, 1000002], [-1000000, -1000002], [1580904, 530394, 1197744, 692354, -285794, -1149300], [-635850, 1517424, -462724, -420462], [67052, 1460360, 1129330, 1950120, -569434, 1296692, -1715072, -1893848, -1963992, -594452, 1563944, 622154, -366820, 831188, 164408, 204646, -1704494, -222036, 547726, 30114, -1131954, 122490, 1435302, -1087570, 1031768, 1234182, 161210], [1604982, 1686828, 1517520, -957660, -1551424, 621078, -284338, 1244468, 1224414, 1875124, 1128890, 1470358, -1853348, 1155376, 576452, 1287164, 1004932, -553120], [1834000, -1041310, 1137564, 285388, -253070, -1872840, 177102, 898242, 1388550, -1308806, 1670772], [408778, 966238, 1681270, -1122194, 200128, -210240, -1906724, -1860436, -1482190, 1049304, -1939406, 1561224, 920754, -1340818, -847334, 667132, -784470, 1058276], [699296, -923914, 1373036, 1789242, -1286744, -212268, 733594, -558118, 1491848, 1867978, -1118394, 244888, -1557026, 1983202, 1654178, -203388, -155598, 954788, 1400120, 1915754, 1110538, 1820442, -227548, -1537492, -803196, -1920146, -610728, 773644, -987658, 395654], [1555282, -1141284, 633416, 1071104, 844448, -290130, 1256514, 508916, -1147840, -797396, 688174, 1475562, -749622, -227130, 1840814, 1462228], [1495860, -668856, 516946, -333750, 1660958, -35580, -606464, -1934644, 910702, -1585638, 13698, 232338, 1212408], [415998, 638028, -1905154, 644780, -71486, 788060, -1484218, 211588, -403666, 1547050, 897818, -1595210, 1163194, -52912, 285664, 332502, -519646, 57972, -708304, 1911600, 1302928, 734010, -1455952, 1904868, -1706156, -970868, 1646490], [1996806]], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b43", "slug": "basic-factorial-rec", "id": 43, "title": "Factorial (Recursive)", "difficulty": "Easy", "category": "recursion", "link": null, "examples": [{"input": "n = 5", "output": "120", "explanation": "5*4*3*2*1 = 120."}, {"input": "n = 0", "output": "1", "explanation": "Base case."}], "hints": ["The base case is `n <= 1`, returning 1.", "Otherwise return `n * factorialRec(n - 1)`."], "statement": "Return `n!` computed recursively: `0! = 1` and otherwise `n! = n * (n-1)!`. A loop also passes, but practice the recursive shape.\n\n**Constraints:**\n- ``0 <= n <= 12``\n", "solution": "## Approach\n\nStop the recursion at zero or one by returning one. For larger inputs multiply n by the result of the same function on n minus one.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(n).\n\n## Implementation\n\n```python\nclass Solution:\n def factorialRec(self, n: int) -> int:\n if n <= 1:\n return 1\n return n * self.factorialRec(n - 1)\n```\n", "starter": {"go": "package main\n\nfunc FactorialRec(n int) int {\n return 0\n}", "python": "class Solution:\n def factorialRec(self, n: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int factorialRec(int n) {\n return 0;\n }\n};"}, "fn": "factorialRec", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["5"], ["0"], ["4"], ["1"], ["2"], ["3"], ["6"], ["10"], ["12"], ["7"], ["8"], ["9"], ["11"]], "expected": [120, 1, 24, 1, 2, 6, 720, 3628800, 479001600, 5040, 40320, 362880, 39916800], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b10", "slug": "basic-factorial", "id": 10, "title": "Factorial", "difficulty": "Easy", "category": "loops", "link": null, "examples": [{"input": "n = 5", "output": "120", "explanation": "1*2*3*4*5 = 120."}, {"input": "n = 0", "output": "1", "explanation": "0! is defined as 1."}], "hints": ["Like the sum problem, but multiply instead of add.", "Start the running product at 1, not 0."], "statement": "Return `n!` (n factorial): the product `1 * 2 * ... * n`. By definition `0! = 1`.\n\n**Constraints:**\n- ``0 <= n <= 12``\n", "solution": "## Approach\n\nStart a running product at one. Multiply it by every integer from 2 up to n, which builds the factorial step by step.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def factorial(self, n: int) -> int:\n result = 1\n for i in range(2, n + 1):\n result *= i\n return result\n```\n", "starter": {"go": "package main\n\nfunc Factorial(n int) int {\n return 0\n}", "python": "class Solution:\n def factorial(self, n: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int factorial(int n) {\n return 0;\n }\n};"}, "fn": "factorial", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["5"], ["0"], ["3"], ["1"], ["2"], ["4"], ["6"], ["10"], ["12"], ["7"], ["8"], ["9"], ["11"]], "expected": [120, 1, 6, 1, 2, 24, 720, 3628800, 479001600, 5040, 40320, 362880, 39916800], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b44", "slug": "basic-fibonacci", "id": 44, "title": "Fibonacci", "difficulty": "Easy", "category": "recursion", "link": null, "examples": [{"input": "n = 6", "output": "8", "explanation": "The sequence 0,1,1,2,3,5,8."}, {"input": "n = 0", "output": "0", "explanation": "Base case."}], "hints": ["Handle the two base cases first.", "Otherwise add the two recursive calls."], "statement": "Return the `n`-th Fibonacci number: `fib(0) = 0`, `fib(1) = 1`, and `fib(n) = fib(n-1) + fib(n-2)` for larger `n`.\n\n**Constraints:**\n- ``0 <= n <= 25``\n", "solution": "## Approach\n\nReturn the base values directly for inputs zero and one. For larger inputs return the sum of the two preceding Fibonacci calls.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(2^n).\n- **Space Complexity:** O(n).\n\n## Implementation\n\n```python\nclass Solution:\n def fibonacci(self, n: int) -> int:\n if n == 0:\n return 0\n if n == 1:\n return 1\n return self.fibonacci(n - 1) + self.fibonacci(n - 2)\n```\n", "starter": {"go": "package main\n\nfunc Fibonacci(n int) int {\n return 0\n}", "python": "class Solution:\n def fibonacci(self, n: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int fibonacci(int n) {\n return 0;\n }\n};"}, "fn": "fibonacci", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["6"], ["0"], ["10"], ["1"], ["2"], ["3"], ["7"], ["20"], ["25"], ["11"], ["12"], ["13"], ["14"], ["15"], ["16"], ["17"], ["18"], ["19"], ["21"], ["22"], ["23"], ["24"], ["4"], ["5"], ["8"], ["9"]], "expected": [8, 0, 55, 1, 1, 2, 13, 6765, 75025, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 10946, 17711, 28657, 46368, 3, 5, 21, 34], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b21", "slug": "basic-find-index", "id": 21, "title": "Find Index", "difficulty": "Easy", "category": "arrays", "link": null, "examples": [{"input": "nums = [5,3,7], target = 3", "output": "1", "explanation": "3 sits at index 1."}, {"input": "nums = [5,3,7], target = 9", "output": "-1", "explanation": "9 never appears."}], "hints": ["Loop with an index variable.", "Return immediately when you find a match; return -1 after the loop."], "statement": "Return the index of the first occurrence of `target` in `nums`, or `-1` if `target` never appears. The first position is index 0.\n\n**Constraints:**\n- ``0 <= nums.length <= 1000``\n- ``-10^9 <= nums[i], target <= 10^9``\n", "solution": "## Approach\n\nWalk the array from left to right checking each element. Return the current index at the first match, or -1 when the loop finishes without one.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def findIndex(self, nums: List[int], target: int) -> int:\n for i in range(len(nums)):\n if nums[i] == target:\n return i\n return -1\n```\n", "starter": {"go": "package main\n\nfunc FindIndex(nums []int, target int) int {\n return 0\n}", "python": "from typing import List\n\nclass Solution:\n def findIndex(self, nums: List[int], target: int) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int findIndex(vector<int>& nums, int target) {\n return 0;\n }\n};"}, "fn": "findIndex", "params": [{"name": "nums", "type": "int_array"}, {"name": "target", "type": "int"}], "outputType": "int", "tests": [["[5,3,7]", "3"], ["[5,3,7]", "9"], ["[1,2,2,3]", "2"], ["[]", "5"], ["[7]", "7"], ["[7]", "1"], ["[4,4,4]", "4"], ["[9, 8, 7]", "8"], ["[1, 1, 1, 2]", "2"], ["[2, 2, 2]", "2"], ["[5, 4, 3, 2, 1]", "1"], ["[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", "0"], ["[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]", "99"], ["[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]", "0"], ["[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]", "-1"], ["[-5, -4, -3]", "-4"], ["[1000000000, -1000000000]", "-1000000000"], ["[3, 1, 4, 1, 5, 9, 2, 6]", "9"], ["[3, 1, 4, 1, 5]", "1"], ["[7, 7, 7, 7]", "8"], ["[1, 2]", "2"], ["[2, 1]", "1"], ["[0]", "1"], ["[1, 3, 5, 7]", "4"], ["[9]", "9"], ["[-1, 0, 1]", "0"], ["[-543, -22, -439, 81, -576, -501, 434, 525, 445, -817, 465, -63, 321]", "-501"], ["[694, -71, -246, 982, 307, 593, 97, -729, 57, 571, -524, 706, 249, 136, -424]", "136"], ["[958]", "958"], ["[-46, -814, 13, 248, -369, 853, -417, -295, 881, 715, 442, 670, 129]", "13"], ["[-313, 203, -128, -261, 103, -781, 554, -770, -917, -139, 698, 934, -44, 630, 988, 700, 56, 688, -469, 848, -879, -750]", "-128"], ["[221, 727, -685, -789, 186, 100, 399, -899, -801, -277, -48, 92, -995, 569, -713, -535, -234, -549, 347, -655]", "347"]], "expected": [1, -1, 1, -1, 0, -1, 0, 1, 3, 0, 4, 0, 99, 0, -1, 1, 1, 5, 1, -1, 1, 1, -1, -1, 0, 1, 5, 13, 0, 2, 2, 18], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b47", "slug": "basic-gcd", "id": 47, "title": "GCD", "difficulty": "Easy", "category": "recursion", "link": null, "examples": [{"input": "a = 48, b = 18", "output": "6", "explanation": "6 is the largest number dividing both."}, {"input": "a = 7, b = 5", "output": "1", "explanation": "7 and 5 share no larger divisor."}], "hints": ["The base case is `b == 0`.", "Otherwise recurse with `(b, a % b)`."], "statement": "Return the greatest common divisor of `a` and `b` using Euclid's idea: `gcd(a, 0) = a`, otherwise `gcd(a, b) = gcd(b, a % b)`. Inputs are not both zero.\n\n**Constraints:**\n- ``0 <= a, b <= 10^9``\n- ``a` and `b` are not both 0`\n", "solution": "## Approach\n\nApply Euclid's reduction: when the second value hits zero the first is the answer, otherwise recurse on the pair shifted by the remainder.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log min(a, b)).\n- **Space Complexity:** O(log min(a, b)).\n\n## Implementation\n\n```python\nclass Solution:\n def gcd(self, a: int, b: int) -> int:\n if b == 0:\n return a\n return self.gcd(b, a % b)\n```\n", "starter": {"go": "package main\n\nfunc Gcd(a int, b int) int {\n return 0\n}", "python": "class Solution:\n def gcd(self, a: int, b: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int gcd(int a, int b) {\n return 0;\n }\n};"}, "fn": "gcd", "params": [{"name": "a", "type": "int"}, {"name": "b", "type": "int"}], "outputType": "int", "tests": [["48", "18"], ["7", "5"], ["0", "5"], ["5", "0"], ["100", "10"], ["17", "13"], ["12", "8"], ["0", "1"], ["36", "24"], ["100", "75"], ["13", "17"], ["1", "1"], ["1", "100"], ["100", "1"], ["0", "7"], ["9", "0"], ["48", "48"], ["270", "192"], ["1000000000", "500000000"], ["999999937", "2"], ["123456", "789012"], ["17", "51"], ["51", "17"], ["64", "48"], ["81", "27"], ["1000", "3"], ["999", "111"], ["2", "4"]], "expected": [6, 1, 5, 5, 10, 1, 4, 1, 12, 25, 1, 1, 1, 1, 7, 9, 48, 6, 500000000, 1, 12, 17, 17, 16, 27, 1, 111, 2], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b4", "slug": "basic-grade-letter", "id": 4, "title": "Grade Letter", "difficulty": "Easy", "category": "if-else", "link": null, "examples": [{"input": "score = 95", "output": "\"A\"", "explanation": "95 is at least 90."}, {"input": "score = 72", "output": "\"C\"", "explanation": "72 is at least 70 but below 80."}], "hints": ["Check the thresholds from highest to lowest.", "An `if / else if / else` chain fits this problem well."], "statement": "Convert a numeric `score` (0 to 100) into a letter grade: `A` for 90 and above, `B` for 80 and above, `C` for 70 and above, `D` for 60 and above, and `F` otherwise.\n\n**Constraints:**\n- ``0 <= score <= 100``\n", "solution": "## Approach\n\nWalk down the grade thresholds from A to D with an if / else-if chain. The first threshold the score meets gives the grade, and anything below 60 is an F.\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 gradeLetter(self, score: int) -> str:\n if score >= 90:\n return \"A\"\n if score >= 80:\n return \"B\"\n if score >= 70:\n return \"C\"\n if score >= 60:\n return \"D\"\n return \"F\"\n```\n", "starter": {"go": "package main\n\nfunc GradeLetter(score int) string {\n return \"\"\n}", "python": "class Solution:\n def gradeLetter(self, score: int) -> str:\n return \"\"\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n string gradeLetter(int score) {\n return \"\";\n }\n};"}, "fn": "gradeLetter", "params": [{"name": "score", "type": "int"}], "outputType": "string", "tests": [["95"], ["72"], ["55"], ["90"], ["89"], ["80"], ["79"], ["70"], ["69"], ["60"], ["59"], ["100"], ["0"], ["91"], ["81"], ["71"], ["61"], ["58"], ["92"], ["88"], ["78"], ["82"], ["68"], ["99"], ["50"], ["30"], ["10"], ["1"]], "expected": ["A", "C", "F", "A", "B", "B", "C", "C", "D", "D", "F", "A", "F", "A", "B", "C", "D", "F", "A", "B", "C", "B", "D", "A", "F", "F", "F", "F"], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b36", "slug": "basic-has-duplicate", "id": 36, "title": "Has Duplicate?", "difficulty": "Easy", "category": "nested-loops", "link": null, "examples": [{"input": "nums = [1,2,3,1]", "output": "true", "explanation": "1 appears twice."}, {"input": "nums = [1,2,3]", "output": "false", "explanation": "All values are unique."}], "hints": ["Compare every pair of positions with nested loops.", "Return `true` at the first equal pair."], "statement": "Return `true` if any value appears at least twice in `nums`, otherwise return `false`. Try solving it with nested loops before learning faster methods.\n\n**Constraints:**\n- ``0 <= nums.length <= 500``\n- ``-10^9 <= nums[i] <= 10^9``\n", "solution": "## Approach\n\nCheck every unordered index pair with nested loops. The first equal pair proves a duplicate exists; exhausting all pairs proves none exists.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def hasDuplicate(self, nums: List[int]) -> bool:\n for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] == nums[j]:\n return True\n return False\n```\n", "starter": {"go": "package main\n\nfunc HasDuplicate(nums []int) bool {\n return false\n}", "python": "from typing import List\n\nclass Solution:\n def hasDuplicate(self, nums: List[int]) -> bool:\n return False\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n bool hasDuplicate(vector<int>& nums) {\n return false;\n }\n};"}, "fn": "hasDuplicate", "params": [{"name": "nums", "type": "int_array"}], "outputType": "boolean", "tests": [["[1,2,3,1]"], ["[1,2,3]"], ["[]"], ["[5]"], ["[1,1]"], ["[1,2,1,2]"], ["[-5,-5,0]"], ["[1, 2, 3, 4]"], ["[4, 3, 2, 1]"], ["[1, 2, 3, 4, 5, 1]"], ["[9, 9]"], ["[1, 2, 1]"], ["[5, 1, 2, 3, 4, 5]"], ["[0, 0, 0, 0]"], ["[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]"], ["[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 25]"], ["[-1, -2, -3, -1]"], ["[1000000000, -1000000000, 0]"], ["[7, 8, 9, 10, 11]"], ["[3, 1, 4, 1, 5, 9, 2, 6, 5]"], ["[42, 42]"], ["[1]"], ["[2, 3]"], ["[6, 5, 4, 3, 2, 1, 0, 6]"], ["[5, 6, 6, 1, 2, 7, 2, 1, 3]"], ["[6, 7, 9, 6, 6, 4, 9, 10, 8]"], ["[6, 10, 1, 6, 8, 1, 5, 5, 5, 6, 5, 0, 9, 2, 1, 10, 1, 9, 0, 1, 1, 1, 5, 5, 7, 6, 1]"]], "expected": [true, false, false, false, true, true, true, false, false, true, true, true, true, true, false, true, true, false, false, true, true, false, false, true, true, true, true], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b1", "slug": "basic-is-even", "id": 1, "title": "Is It Even?", "difficulty": "Easy", "category": "if-else", "link": null, "examples": [{"input": "n = 4", "output": "true", "explanation": "4 is divisible by 2."}, {"input": "n = 7", "output": "false", "explanation": "7 leaves a remainder of 1."}], "hints": ["An even number has remainder 0 when divided by 2.", "In most languages the remainder operator is `%`."], "statement": "Return `true` if the integer `n` is even and `false` otherwise. Zero counts as even, and negative numbers work the same way as positive ones.\n\n**Constraints:**\n- ``-10^9 <= n <= 10^9``\n", "solution": "## Approach\n\nCheck the remainder of dividing by two. A remainder of zero means the number is even, which directly gives the boolean answer.\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 isEven(self, n: int) -> bool:\n return n % 2 == 0\n```\n", "starter": {"go": "package main\n\nfunc IsEven(n int) bool {\n return false\n}", "python": "class Solution:\n def isEven(self, n: int) -> bool:\n return False\n", "cpp": "\nclass Solution {\npublic:\n bool isEven(int n) {\n return false;\n }\n};"}, "fn": "isEven", "params": [{"name": "n", "type": "int"}], "outputType": "boolean", "tests": [["4"], ["7"], ["0"], ["-3"], ["-1000000000"], ["1000000001"], ["2"], ["-2"], ["999999999"], ["-999999998"], ["1"], ["-1"], ["-999999999"], ["1000000000"], ["500"], ["-501"], ["123456789"], ["-123456788"], ["42"], ["-42"], ["8"], ["100"], ["-100"], ["1000"], ["-1000"], ["123456780"], ["-123456781"], ["999999998"], ["13"], ["-14"], ["27"]], "expected": [true, false, true, false, true, false, true, true, false, true, false, false, false, true, true, false, false, true, true, true, true, true, true, true, true, true, false, true, false, true, false], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b5", "slug": "basic-is-leap-year", "id": 5, "title": "Leap Year", "difficulty": "Easy", "category": "if-else", "link": null, "examples": [{"input": "year = 2000", "output": "true", "explanation": "2000 is divisible by 400."}, {"input": "year = 1900", "output": "false", "explanation": "1900 is divisible by 100 but not by 400."}, {"input": "year = 2024", "output": "true", "explanation": "2024 is divisible by 4 but not by 100."}], "hints": ["Combine the divisibility checks with `&&`, `||`, and `!`.", "Check the 400 rule first."], "statement": "Return `true` if `year` is a leap year: divisible by 400, or divisible by 4 but not by 100. Otherwise return `false`.\n\n**Constraints:**\n- ``1 <= year <= 9999``\n", "solution": "## Approach\n\nHandle the century exception first: multiples of 400 are leap years while other multiples of 100 are not. Any remaining year is a leap year exactly when divisible by 4.\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 isLeapYear(self, year: int) -> bool:\n if year % 400 == 0:\n return True\n if year % 100 == 0:\n return False\n return year % 4 == 0\n```\n", "starter": {"go": "package main\n\nfunc IsLeapYear(year int) bool {\n return false\n}", "python": "class Solution:\n def isLeapYear(self, year: int) -> bool:\n return False\n", "cpp": "\nclass Solution {\npublic:\n bool isLeapYear(int year) {\n return false;\n }\n};"}, "fn": "isLeapYear", "params": [{"name": "year", "type": "int"}], "outputType": "boolean", "tests": [["2000"], ["1900"], ["2024"], ["2023"], ["2400"], ["1800"], ["1"], ["4"], ["100"], ["400"], ["2004"], ["2100"], ["1600"], ["1700"], ["1996"], ["2008"], ["2012"], ["2016"], ["2020"], ["2"], ["3"], ["8"], ["12"], ["96"], ["104"], ["300"], ["500"], ["800"], ["1200"], ["1500"], ["2025"], ["1999"], ["2001"], ["2404"], ["2800"], ["9999"]], "expected": [true, false, true, false, true, false, false, true, false, true, true, false, true, false, true, true, true, true, true, false, false, true, true, true, true, false, false, true, true, false, false, false, false, true, true, false], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b39", "slug": "basic-is-sorted", "id": 39, "title": "Is Sorted?", "difficulty": "Easy", "category": "nested-loops", "link": null, "examples": [{"input": "nums = [1,2,2,3]", "output": "true", "explanation": "Never decreases."}, {"input": "nums = [1,3,2]", "output": "false", "explanation": "3 is followed by 2."}], "hints": ["Compare each element with its neighbor.", "Return `false` at the first decrease."], "statement": "Return `true` if `nums` is sorted in non-decreasing order (each element is greater than or equal to the previous one). Empty and single-element arrays count as sorted.\n\n**Constraints:**\n- ``0 <= nums.length <= 1000``\n- ``-10^9 <= nums[i] <= 10^9``\n", "solution": "## Approach\n\nScan adjacent pairs from left to right. Any drop proves the array is unsorted; surviving the whole scan proves it is sorted.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def isSorted(self, nums: List[int]) -> bool:\n for i in range(1, len(nums)):\n if nums[i] < nums[i - 1]:\n return False\n return True\n```\n", "starter": {"go": "package main\n\nfunc IsSorted(nums []int) bool {\n return false\n}", "python": "from typing import List\n\nclass Solution:\n def isSorted(self, nums: List[int]) -> bool:\n return False\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n bool isSorted(vector<int>& nums) {\n return false;\n }\n};"}, "fn": "isSorted", "params": [{"name": "nums", "type": "int_array"}], "outputType": "boolean", "tests": [["[1,2,2,3]"], ["[1,3,2]"], ["[]"], ["[7]"], ["[1,1,1]"], ["[5,4,3]"], ["[-2,-1,0,1]"], ["[2, 1]"], ["[3, 2, 1]"], ["[1, 3, 2, 4]"], ["[5, 5, 5, 4]"], ["[1, 2, 3, 2]"], ["[-1, -2, 0]"], ["[10, 9]"], ["[1, 1, 2, 2, 3, 3]"], ["[3, 3, 3, 2, 2]"], ["[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]"], ["[30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]"], ["[0, 0, 1]"], ["[5, 4, 4, 4, 5]"], ["[-5, -3, -3, 0, 2]"], ["[100, 101]"], ["[101, 100]"], ["[2, 2, 2, 2, 3]"], ["[4, 1, 2, 3]"], ["[-853, -642, -332, -257, -91, 441, 525, 545, 793, 834]"], ["[-855, -836, -831, -814, -761, -506, -476, -462, -417, 5, 62, 151, 162, 225, 296, 298, 336, 566, 747]"]], "expected": [true, false, true, true, true, false, true, false, false, false, false, false, false, false, true, false, true, false, true, false, true, true, false, true, false, true, true], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b40", "slug": "basic-max-frequency", "id": 40, "title": "Max Frequency", "difficulty": "Easy", "category": "nested-loops", "link": null, "examples": [{"input": "nums = [1,2,2,3]", "output": "2", "explanation": "2 appears twice."}, {"input": "nums = [5]", "output": "1", "explanation": "A single element appears once."}], "hints": ["For each position, count how many times its value appears.", "Keep the biggest count seen."], "statement": "Return the highest frequency of any value in `nums`. For example, in `[1,2,2,3]` the value 2 appears twice, which beats every other value, so the answer is 2.\n\n**Constraints:**\n- ``1 <= nums.length <= 500``\n- ``-10^9 <= nums[i] <= 10^9``\n", "solution": "## Approach\n\nFor every position count how many array entries equal its value with an inner loop. Track the largest such count across all positions.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def maxFrequency(self, nums: List[int]) -> int:\n return max(nums.count(x) for x in nums)\n```\n", "starter": {"go": "package main\n\nfunc MaxFrequency(nums []int) int {\n return 0\n}", "python": "from typing import List\n\nclass Solution:\n def maxFrequency(self, nums: List[int]) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int maxFrequency(vector<int>& nums) {\n return 0;\n }\n};"}, "fn": "maxFrequency", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int", "tests": [["[1,2,2,3]"], ["[5]"], ["[1,1,1]"], ["[1,2,3,4]"], ["[4,4,2,2,2]"], ["[-1,-1,0,0,0,0]"], ["[2, 2, 3, 3, 3]"], ["[9, 9, 9, 9]"], ["[1, 2, 3]"], ["[5, 5, 6, 6]"], ["[0, 0, 0, 1, 1, 1, 1]"], ["[7, 7, 7, 7, 7, 8]"], ["[-1, -1, -2]"], ["[4, 2, 4, 2, 4, 2, 4]"], ["[10]"], ["[1, 1, 2, 2, 3, 3, 3]"], ["[100, 100, 200]"], ["[3, 3, 3, 2, 2, 1]"], ["[8, 8, 7, 7, 7, 8, 8]"], ["[6, 6, 6, 6, 6, 6]"], ["[3, 3, 1, 3, 2, 2, 3, 1, 1, 3, 3, 3, 2, 1, 1]"], ["[2, 3, 2, 2, 2, 1, 3, 3, 2, 2, 3, 2, 2, 1, 2, 1, 2, 2, 1, 1, 1, 3, 2, 2]"], ["[3, 2, 2, 1, 3, 1, 2, 3, 2]"], ["[1, 2, 3, 1, 1, 1, 3, 2, 1, 2, 3, 2, 1, 2, 1, 3, 3, 2, 1, 2, 2, 1, 3, 1, 3]"], ["[2, 2]"], ["[1, 2, 2, 2, 1, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1, 3, 2]"]], "expected": [2, 1, 3, 1, 3, 4, 3, 4, 1, 2, 4, 5, 2, 4, 1, 3, 2, 3, 4, 6, 7, 13, 4, 10, 2, 8], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b3", "slug": "basic-max-of-three", "id": 3, "title": "Max of Three", "difficulty": "Easy", "category": "if-else", "link": null, "examples": [{"input": "a = 1, b = 9, c = 4", "output": "9", "explanation": "9 is the largest."}, {"input": "a = -1, b = -7, c = -3", "output": "-1", "explanation": "-1 is the largest."}], "hints": ["Track the biggest value seen so far in a variable.", "Update it with two `if` statements, one per remaining value."], "statement": "Return the largest of the three integers `a`, `b`, and `c`.\n\n**Constraints:**\n- ``-10^9 <= a, b, c <= 10^9``\n", "solution": "## Approach\n\nStart with the first value as the current best. Compare it against each of the other two values in turn, keeping the larger one.\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 maxOfThree(self, a: int, b: int, c: int) -> int:\n best = a\n if b > best:\n best = b\n if c > best:\n best = c\n return best\n```\n", "starter": {"go": "package main\n\nfunc MaxOfThree(a int, b int, c int) int {\n return 0\n}", "python": "class Solution:\n def maxOfThree(self, a: int, b: int, c: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int maxOfThree(int a, int b, int c) {\n return 0;\n }\n};"}, "fn": "maxOfThree", "params": [{"name": "a", "type": "int"}, {"name": "b", "type": "int"}, {"name": "c", "type": "int"}], "outputType": "int", "tests": [["1", "9", "4"], ["-1", "-7", "-3"], ["5", "5", "5"], ["10", "1", "2"], ["1", "10", "2"], ["1", "2", "10"], ["0", "-1", "1"], ["1000000000", "-1000000000", "0"], ["2", "3", "1"], ["3", "1", "2"], ["1", "1", "2"], ["2", "1", "1"], ["1", "2", "1"], ["-5", "-1", "-3"], ["0", "0", "1"], ["1000000000", "999999999", "999999998"], ["-1000000000", "0", "1000000000"], ["4", "4", "4"], ["9", "8", "7"], ["7", "9", "8"], ["8", "7", "9"], ["-2", "-2", "-5"], ["6", "6", "7"], ["6", "7", "6"], ["7", "6", "6"], ["0", "-100", "100"]], "expected": [9, -1, 5, 10, 10, 10, 1, 1000000000, 3, 3, 2, 2, 2, -1, 1, 1000000000, 1000000000, 4, 9, 9, 9, -2, 7, 7, 7, 100], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b2", "slug": "basic-max-of-two", "id": 2, "title": "Max of Two", "difficulty": "Easy", "category": "if-else", "link": null, "examples": [{"input": "a = 3, b = 7", "output": "7", "explanation": "7 is larger than 3."}, {"input": "a = -5, b = -2", "output": "-2", "explanation": "-2 is larger than -5."}], "hints": ["Use an `if` statement to compare `a` and `b`.", "Remember to handle the equal case."], "statement": "Return the larger of the two integers `a` and `b`. If they are equal, return either one.\n\n**Constraints:**\n- ``-10^9 <= a, b <= 10^9``\n", "solution": "## Approach\n\nCompare the two values with an if statement. Return the first when it is greater than or equal to the second, otherwise return the second.\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 maxOfTwo(self, a: int, b: int) -> int:\n if a >= b:\n return a\n return b\n```\n", "starter": {"go": "package main\n\nfunc MaxOfTwo(a int, b int) int {\n return 0\n}", "python": "class Solution:\n def maxOfTwo(self, a: int, b: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int maxOfTwo(int a, int b) {\n return 0;\n }\n};"}, "fn": "maxOfTwo", "params": [{"name": "a", "type": "int"}, {"name": "b", "type": "int"}], "outputType": "int", "tests": [["3", "7"], ["-5", "-2"], ["4", "4"], ["0", "0"], ["-1000000000", "1000000000"], ["1000000000", "-1000000000"], ["42", "42"], ["-1", "1"], ["1", "2"], ["2", "1"], ["-3", "-3"], ["0", "-1"], ["-1", "0"], ["999", "1000"], ["1000", "999"], ["-1000000000", "-999999999"], ["123456", "123455"], ["7", "7"], ["-8", "-9"], ["-9", "-8"], ["0", "1000000000"], ["1000000000", "0"], ["500000000", "500000001"], ["42", "-42"], ["-42", "42"], ["11", "22"]], "expected": [7, -2, 4, 0, 1000000000, 1000000000, 42, 1, 2, 2, -3, 0, 0, 1000, 1000, -999999999, 123456, 7, -8, -8, 1000000000, 1000000000, 500000001, 42, 42, 22], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b30", "slug": "basic-palindrome-text", "id": 30, "title": "Palindrome Check", "difficulty": "Easy", "category": "strings", "link": null, "examples": [{"input": "s = \"racecar\"", "output": "true", "explanation": "racecar is symmetric."}, {"input": "s = \"hello\"", "output": "false", "explanation": "hello reversed is olleh."}, {"input": "s = \"Abba\"", "output": "false", "explanation": "Capital A does not match lowercase a."}], "hints": ["Compare the first character with the last, the second with the second-last, and so on.", "Only the first half needs checking."], "statement": "Return `true` if `s` reads the same forwards and backwards (case-sensitive), otherwise `false`. The empty string counts as a palindrome.\n\n**Constraints:**\n- ``0 <= s.length <= 1000``\n", "solution": "## Approach\n\nMirror-compare characters from both ends moving inward. The first mismatch proves it is not a palindrome; surviving all pairs proves it is.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def isPalindromeText(self, s: str) -> bool:\n return s == s[::-1]\n```\n", "starter": {"go": "package main\n\nfunc IsPalindromeText(s string) bool {\n return false\n}", "python": "class Solution:\n def isPalindromeText(self, s: str) -> bool:\n return False\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n bool isPalindromeText(string s) {\n return false;\n }\n};"}, "fn": "isPalindromeText", "params": [{"name": "s", "type": "string"}], "outputType": "boolean", "tests": [["racecar"], ["hello"], ["abba"], [""], ["a"], ["Abba"], ["abcba"], ["abca"], ["aa"], ["aba"], ["abccba"], ["abcd"], ["aab"], ["baa"], ["Aa"], ["aA"], ["abBA"], ["1234321"], ["12345"], [" "], [" "], ["xyx"], ["xyyx"], ["xyxy"], ["aabaa"], ["aabb"], ["abcddcba"], ["abcdecba"]], "expected": [true, false, true, true, true, false, true, false, true, true, true, false, false, false, false, false, false, true, false, true, true, true, true, false, true, false, true, false], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b46", "slug": "basic-power-rec", "id": 46, "title": "Power (Recursive)", "difficulty": "Easy", "category": "recursion", "link": null, "examples": [{"input": "base = 2, exp = 5", "output": "32", "explanation": "2^5 = 32."}, {"input": "base = 3, exp = 0", "output": "1", "explanation": "Base case."}], "hints": ["Base case: `exp == 0` returns 1.", "Otherwise return `base * powerRec(base, exp - 1)`."], "statement": "Return `base^exp` computed recursively: anything to the power 0 is 1 (including `0^0 = 1` here), otherwise multiply `base` by the result for `exp - 1`.\n\n**Constraints:**\n- ``-10 <= base <= 10``\n- ``0 <= exp <= 9``\n- `The result fits in a 32-bit signed integer for all test inputs`\n", "solution": "## Approach\n\nReturn one when the exponent reaches zero. Otherwise peel off one multiplication and recurse on the smaller exponent.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(exp).\n- **Space Complexity:** O(exp).\n\n## Implementation\n\n```python\nclass Solution:\n def powerRec(self, base: int, exp: int) -> int:\n if exp == 0:\n return 1\n return base * self.powerRec(base, exp - 1)\n```\n", "starter": {"go": "package main\n\nfunc PowerRec(base int, exp int) int {\n return 0\n}", "python": "class Solution:\n def powerRec(self, base: int, exp: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int powerRec(int base, int exp) {\n return 0;\n }\n};"}, "fn": "powerRec", "params": [{"name": "base", "type": "int"}, {"name": "exp", "type": "int"}], "outputType": "int", "tests": [["2", "5"], ["3", "0"], ["0", "0"], ["2", "10"], ["0", "4"], ["-2", "4"], ["5", "3"], ["2", "1"], ["2", "3"], ["3", "2"], ["4", "3"], ["5", "2"], ["-2", "5"], ["6", "2"], ["7", "3"], ["9", "2"], ["10", "3"], ["0", "1"], ["1", "5"], ["-3", "2"], ["8", "2"], ["2", "9"], ["3", "6"], ["-5", "3"], ["4", "5"], ["10", "6"], ["2", "0"]], "expected": [32, 1, 1, 1024, 0, 16, 125, 2, 8, 9, 64, 25, -32, 36, 343, 81, 1000, 0, 1, 9, 64, 512, 729, -125, 1024, 1000000, 1], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b14", "slug": "basic-power", "id": 14, "title": "Integer Power", "difficulty": "Easy", "category": "loops", "link": null, "examples": [{"input": "base = 2, exp = 10", "output": "1024", "explanation": "2 multiplied by itself 10 times is 1024."}, {"input": "base = 5, exp = 0", "output": "1", "explanation": "Anything to the power 0 is 1."}], "hints": ["Multiply a running result by `base` exactly `exp` times.", "Start the result at 1 so the `exp = 0` case works."], "statement": "Return `base` raised to the power `exp` (`base^exp`) using repeated multiplication. Any number to the power 0 is 1, including `0^0 = 1` for this problem.\n\n**Constraints:**\n- ``-10 <= base <= 10``\n- ``0 <= exp <= 9``\n- `The result fits in a 32-bit signed integer for all test inputs`\n", "solution": "## Approach\n\nStart from one and multiply by the base once per loop iteration. After exp iterations the product equals base to the power exp.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(exp).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def power(self, base: int, exp: int) -> int:\n result = 1\n for _ in range(exp):\n result *= base\n return result\n```\n", "starter": {"go": "package main\n\nfunc Power(base int, exp int) int {\n return 0\n}", "python": "class Solution:\n def power(self, base: int, exp: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int power(int base, int exp) {\n return 0;\n }\n};"}, "fn": "power", "params": [{"name": "base", "type": "int"}, {"name": "exp", "type": "int"}], "outputType": "int", "tests": [["2", "10"], ["5", "0"], ["-2", "3"], ["0", "0"], ["0", "5"], ["3", "5"], ["10", "9"], ["-3", "3"], ["7", "4"], ["1", "9"], ["2", "1"], ["2", "2"], ["2", "8"], ["3", "3"], ["3", "4"], ["4", "4"], ["5", "5"], ["6", "3"], ["-5", "2"], ["-4", "3"], ["9", "4"], ["1", "0"], ["-1", "9"], ["-1", "8"], ["10", "5"], ["10", "8"], ["7", "5"], ["-3", "8"], ["-8", "2"], ["1", "1"], ["1", "5"], ["-8", "5"], ["9", "9"], ["3", "1"]], "expected": [1024, 1, -8, 1, 0, 243, 1000000000, -27, 2401, 1, 2, 4, 256, 27, 81, 256, 3125, 216, 25, -64, 6561, 1, -1, 1, 100000, 100000000, 16807, 6561, 64, 1, 1, -32768, 387420489, 3], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b33", "slug": "basic-repeat-string", "id": 33, "title": "Repeat String", "difficulty": "Easy", "category": "strings", "link": null, "examples": [{"input": "s = \"ab\", k = 3", "output": "\"ababab\"", "explanation": "ab written three times."}, {"input": "s = \"x\", k = 0", "output": "\"\"", "explanation": "Zero repetitions give nothing."}], "hints": ["Loop `k` times, appending `s` each round.", "Start from the empty string."], "statement": "Return the string `s` repeated `k` times, joined together. Repeating zero times gives the empty string.\n\n**Constraints:**\n- ``0 <= s.length <= 100``\n- ``0 <= k <= 100``\n- `The result has at most 500 characters`\n", "solution": "## Approach\n\nStart from an empty builder and append a copy of the string once per iteration for k iterations.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n*k).\n- **Space Complexity:** O(n*k).\n\n## Implementation\n\n```python\nclass Solution:\n def repeatString(self, s: str, k: int) -> str:\n return s * k\n```\n", "starter": {"go": "package main\n\nfunc RepeatString(s string, k int) string {\n return \"\"\n}", "python": "class Solution:\n def repeatString(self, s: str, k: int) -> str:\n return \"\"\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n string repeatString(string s, int k) {\n return \"\";\n }\n};"}, "fn": "repeatString", "params": [{"name": "s", "type": "string"}, {"name": "k", "type": "int"}], "outputType": "string", "tests": [["ab", "3"], ["x", "0"], ["hi", "1"], ["", "5"], ["a", "10"], ["abc", "2"], ["zz", "5"], ["x", "5"], ["hello", "2"], ["", "0"], ["ab", "10"], ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "10"], ["xy", "100"], ["test", "4"], [" ", "7"], ["0123456789", "3"], ["q", "100"], ["ab", "0"], ["wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww", "5"], ["hi!", "6"], ["z", "1"], ["*", "20"], ["abcde", "5"], ["p", "500"], ["longstring", "1"], ["-=", "25"]], "expected": ["ababab", "", "hi", "", "aaaaaaaaaa", "abcabc", "zzzzzzzzzz", "xxxxx", "hellohello", "", "abababababababababab", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy", "testtesttesttest", " ", "012345678901234567890123456789", "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", "", "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww", "hi!hi!hi!hi!hi!hi!", "z", "********************", "abcdeabcdeabcdeabcdeabcde", "pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp", "longstring", "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b24", "slug": "basic-reverse-array", "id": 24, "title": "Reverse Array", "difficulty": "Easy", "category": "arrays", "link": null, "examples": [{"input": "nums = [1,2,3]", "output": "[3,2,1]", "explanation": "The order is flipped."}, {"input": "nums = []", "output": "[]", "explanation": "Reversing nothing gives nothing."}], "hints": ["Read the input from the last index down to 0.", "Append each visited element to the answer."], "statement": "Return a new array with the elements of `nums` in reverse order. Do not modify the input.\n\n**Constraints:**\n- ``0 <= nums.length <= 1000``\n- ``-10^9 <= nums[i] <= 10^9``\n", "solution": "## Approach\n\nAllocate an answer array of the same length. Copy elements from the back of the input to the front of the answer.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(n).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def reverseArray(self, nums: List[int]) -> List[int]:\n return nums[::-1]\n```\n", "starter": {"go": "package main\n\nfunc ReverseArray(nums []int) []int {\n return []int{}\n}", "python": "from typing import List\n\nclass Solution:\n def reverseArray(self, nums: List[int]) -> List[int]:\n return []\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> reverseArray(vector<int>& nums) {\n return {};\n }\n};"}, "fn": "reverseArray", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int_array", "tests": [["[1,2,3]"], ["[]"], ["[7]"], ["[1,2]"], ["[5,5,5]"], ["[-1,2,-3]"], ["[1,2,3,4,5]"], ["[4, 3, 2, 1]"], ["[1, 3, 2]"], ["[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"], ["[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]"], ["[5, 5, 6, 5, 5]"], ["[-3, -2, -1, 0, 1, 2, 3]"], ["[1000000000, -1000000000, 0]"], ["[9, 9]"], ["[1, 2, 1]"], ["[2, 1, 2]"], ["[-657065, 177902, -13045, 47491, -154339, 436757, 28109, -957347, 472551]"], ["[724601, 89106, 729540, 268018, 94869, -271960, -350650, -773878, -670312, 335048, 516822, -168716, -902059, 484989, -411481, -682151, -508341, -819002]"], ["[-598031, 171522, 228006, -821486, -851385, 828489, 191661]"], ["[544521, -602107, -179894, 225214, -782243, 55050, -691754, 76828, -636912, 756429, 686144, 322009, 148491, -252604, 808564, -882677, -173725, 430197, -883297, 364848, 218022, 466516, -538904]"], ["[-536157, 38712, 103185, 886840, 335089, -326023, 969810, -592984, -695453, 667230, 254536, -137287, -413781, -98118, -899574, -725935, 586457, 647337, 31020, -292061, 155352, 5719, -379410, -122092, 206923, -423891, 446297, -921322, 726691, -690891, -432599, -89878, -549918, -281027, -964548, -387813, -372957]"], ["[-118575, -97470, 842286, 616771, 748393, 80785, 34088, 209510, 956414]"], ["[404031, 217533, -192905, 599483]"], ["[334466, 884465, -921611, 386040, 132661, -13820, 968248, 819987, 474069, 640005, 613780, -1193, -601358, -881263, -207801, -650936, -604242, 929320, -761706, -29202, -894669, 555360, -576706, 848259, 683063, 548010, -795302]"]], "expected": [[3, 2, 1], [], [7], [2, 1], [5, 5, 5], [-3, 2, -1], [5, 4, 3, 2, 1], [1, 2, 3, 4], [2, 3, 1], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [5, 5, 6, 5, 5], [3, 2, 1, 0, -1, -2, -3], [0, -1000000000, 1000000000], [9, 9], [1, 2, 1], [2, 1, 2], [472551, -957347, 28109, 436757, -154339, 47491, -13045, 177902, -657065], [-819002, -508341, -682151, -411481, 484989, -902059, -168716, 516822, 335048, -670312, -773878, -350650, -271960, 94869, 268018, 729540, 89106, 724601], [191661, 828489, -851385, -821486, 228006, 171522, -598031], [-538904, 466516, 218022, 364848, -883297, 430197, -173725, -882677, 808564, -252604, 148491, 322009, 686144, 756429, -636912, 76828, -691754, 55050, -782243, 225214, -179894, -602107, 544521], [-372957, -387813, -964548, -281027, -549918, -89878, -432599, -690891, 726691, -921322, 446297, -423891, 206923, -122092, -379410, 5719, 155352, -292061, 31020, 647337, 586457, -725935, -899574, -98118, -413781, -137287, 254536, 667230, -695453, -592984, 969810, -326023, 335089, 886840, 103185, 38712, -536157], [956414, 209510, 34088, 80785, 748393, 616771, 842286, -97470, -118575], [599483, -192905, 217533, 404031], [-795302, 548010, 683063, 848259, -576706, 555360, -894669, -29202, -761706, 929320, -604242, -650936, -207801, -881263, -601358, -1193, 613780, 640005, 474069, 819987, 968248, -13820, 132661, 386040, -921611, 884465, 334466]], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b13", "slug": "basic-reverse-number", "id": 13, "title": "Reverse Number", "difficulty": "Easy", "category": "loops", "link": null, "examples": [{"input": "n = 123", "output": "321", "explanation": "Reading 123 backwards gives 321."}, {"input": "n = 120", "output": "21", "explanation": "The leading zero of 021 is dropped."}], "hints": ["Build the answer digit by digit: multiply it by 10, then add the next digit.", "Take the next digit from `n % 10`."], "statement": "Return the integer formed by reversing the decimal digits of `n`. For example, `123` becomes `321`. Leading zeros disappear (`120` becomes `21`).\n\n**Constraints:**\n- ``0 <= n <= 10^9``\n- `The reversed value fits in a 32-bit signed integer for all test inputs`\n", "solution": "## Approach\n\nRepeatedly take the last digit of the input and append it to the answer. Appending means multiplying the answer by ten and adding the digit.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def reverseNumber(self, n: int) -> int:\n rev = 0\n while n > 0:\n rev = rev * 10 + n % 10\n n //= 10\n return rev\n```\n", "starter": {"go": "package main\n\nfunc ReverseNumber(n int) int {\n return 0\n}", "python": "class Solution:\n def reverseNumber(self, n: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int reverseNumber(int n) {\n return 0;\n }\n};"}, "fn": "reverseNumber", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["123"], ["120"], ["5"], ["0"], ["10"], ["1000"], ["123456789"], ["987654321"], ["1000000000"], ["101"], ["12"], ["21"], ["100"], ["1010"], ["909"], ["12321"], ["45654"], ["1000001"], ["214748364"], ["1234554321"], ["100200300"], ["99999999"], ["123123123"], ["1020304"], ["55555"], ["10000000"], ["200000002"], ["534225816"], ["918795920"], ["285801859"], ["390946815"], ["684415020"], ["956503602"], ["260360651"], ["743612525"], ["508060890"], ["823455307"], ["354387164"], ["91469987"]], "expected": [321, 21, 5, 0, 1, 1, 987654321, 123456789, 1, 101, 21, 12, 1, 101, 909, 12321, 45654, 1000001, 463847412, 1234554321, 3002001, 99999999, 321321321, 4030201, 55555, 1, 200000002, 618522435, 29597819, 958108582, 518649093, 20514486, 206305659, 156063062, 525216347, 98060805, 703554328, 461783453, 78996419], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b49", "slug": "basic-reverse-text-rec", "id": 49, "title": "Reverse Text (Recursive)", "difficulty": "Easy", "category": "recursion", "link": null, "examples": [{"input": "s = \"hello\"", "output": "\"olleh\"", "explanation": "Reversed text."}, {"input": "s = \"\"", "output": "\"\"", "explanation": "Base case."}], "hints": ["Base case: strings of length 0 or 1 return themselves.", "Otherwise return `reverse(rest) + first`."], "statement": "Return `s` reversed, computed recursively: an empty (or single-character) string returns itself, otherwise move the first character to the end of the reversed remainder.\n\n**Constraints:**\n- ``0 <= s.length <= 200``\n", "solution": "## Approach\n\nReturn tiny strings directly. For longer strings recurse on everything after the first character, then append that first character at the end.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2).\n- **Space Complexity:** O(n^2).\n\n## Implementation\n\n```python\nclass Solution:\n def reverseTextRec(self, s: str) -> str:\n if len(s) <= 1:\n return s\n return self.reverseTextRec(s[1:]) + s[0]\n```\n", "starter": {"go": "package main\n\nfunc ReverseTextRec(s string) string {\n return \"\"\n}", "python": "class Solution:\n def reverseTextRec(self, s: str) -> str:\n return \"\"\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n string reverseTextRec(string s) {\n return \"\";\n }\n};"}, "fn": "reverseTextRec", "params": [{"name": "s", "type": "string"}], "outputType": "string", "tests": [["hello"], [""], ["ab"], ["a"], ["racecar"], ["abc"], ["abcd"], ["hello!"], ["abccbx"], ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], ["abababababababababababababababababababababababababababababababababababababababab"], ["The quick brown fox"], ["1234567890"], ["Was it a car"], ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"], ["palindromeemordnilap"], ["aBcDeF"], ["!@#$%^"], ["trailing space "], [" leading"], ["middle spaces"], ["qwerty"], ["asdfgh"], ["zxcvbn"], ["a1b2c3d4"]], "expected": ["olleh", "", "ba", "a", "racecar", "cba", "dcba", "!olleh", "xbccba", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "babababababababababababababababababababababababababababababababababababababababa", "xof nworb kciuq ehT", "0987654321", "rac a ti saW", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "palindromeemordnilap", "FeDcBa", "^%$#@!", " ecaps gniliart", "gnidael ", "secaps elddim", "ytrewq", "hgfdsa", "nbvcxz", "4d3c2b1a"], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b29", "slug": "basic-reverse-text", "id": 29, "title": "Reverse Text", "difficulty": "Easy", "category": "strings", "link": null, "examples": [{"input": "s = \"hello\"", "output": "\"olleh\"", "explanation": "Reading hello backwards gives olleh."}, {"input": "s = \"ab\"", "output": "\"ba\"", "explanation": "Two characters swap places."}], "hints": ["Build the answer from the last character to the first.", "Append `s.charAt(i)` while looping `i` downward."], "statement": "Return the string `s` written backwards. For example, `\"hello\"` becomes `\"olleh\"`.\n\n**Constraints:**\n- ``0 <= s.length <= 1000``\n", "solution": "## Approach\n\nLoop from the final index down to zero, appending each visited character to a builder. The builder then holds the reversed text.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(n).\n\n## Implementation\n\n```python\nclass Solution:\n def reverseText(self, s: str) -> str:\n return s[::-1]\n```\n", "starter": {"go": "package main\n\nfunc ReverseText(s string) string {\n return \"\"\n}", "python": "class Solution:\n def reverseText(self, s: str) -> str:\n return \"\"\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n string reverseText(string s) {\n return \"\";\n }\n};"}, "fn": "reverseText", "params": [{"name": "s", "type": "string"}], "outputType": "string", "tests": [["hello"], ["ab"], [""], ["a"], ["racecar"], ["hello world"], ["12345"], ["abc"], ["aab"], ["ab ba"], ["12321"], ["hello world!"], ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"], ["AaBb"], [" spaces "], ["!dlrow"], ["racecarx"], ["ababababababababababababababababababababababababab"], ["z"], ["11"], ["a1b2c3"], [".,!?;"], ["rotor"], ["noon!"], ["step on no pets"], ["abca"], ["xyzzy"]], "expected": ["olleh", "ba", "", "a", "racecar", "dlrow olleh", "54321", "cba", "baa", "ab ba", "12321", "!dlrow olleh", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "bBaA", " secaps ", "world!", "xracecar", "bababababababababababababababababababababababababa", "z", "11", "3c2b1a", ";?!,.", "rotor", "!noon", "step on no pets", "acba", "yzzyx"], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b37", "slug": "basic-second-largest", "id": 37, "title": "Second Largest", "difficulty": "Easy", "category": "nested-loops", "link": null, "examples": [{"input": "nums = [1,2,3]", "output": "2", "explanation": "The largest is 3, the next distinct value is 2."}, {"input": "nums = [5,5,4]", "output": "4", "explanation": "Duplicates of the maximum do not count."}], "hints": ["First find the maximum value.", "Then find the maximum among values smaller than it."], "statement": "Return the second-largest distinct value in `nums`. The array always contains at least two different values.\n\n**Constraints:**\n- ``2 <= nums.length <= 1000``\n- ``-10^9 <= nums[i] <= 10^9``\n- `At least two distinct values exist`\n", "solution": "## Approach\n\nFind the overall maximum in one pass. In a second pass track the largest value that is still smaller than that maximum.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def secondLargest(self, nums: List[int]) -> int:\n mx = max(nums)\n return max(x for x in nums if x < mx)\n```\n", "starter": {"go": "package main\n\nfunc SecondLargest(nums []int) int {\n return 0\n}", "python": "from typing import List\n\nclass Solution:\n def secondLargest(self, nums: List[int]) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int secondLargest(vector<int>& nums) {\n return 0;\n }\n};"}, "fn": "secondLargest", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int", "tests": [["[1,2,3]"], ["[5,5,4]"], ["[-1,-5,-3]"], ["[10,10,9,8]"], ["[2,1]"], ["[1,2]"], ["[7,7,7,3]"], ["[3, 1, 2]"], ["[2, 3, 1]"], ["[9, 9, 8, 7]"], ["[1, 2, 2, 2]"], ["[-10, -20, -30]"], ["[0, -1, -2]"], ["[1000000000, 999999999]"], ["[-1000000000, 1000000000, 0]"], ["[5, 1, 5, 3]"], ["[4, 4, 4, 1]"], ["[10, 9]"], ["[9, 10]"], ["[7, 7, 6, 6, 5]"], ["[100, 50, 100, 25]"], ["[-5, -5, -10]"], ["[3, 3, 2, 2, 1]"], ["[8, 6, 7, 5, 4]"], ["[15, 22, 13, 22, 8]"], ["[1, 100, 2, 99, 3]"]], "expected": [2, 4, -3, 9, 1, 1, 3, 2, 2, 8, 1, -20, -1, 999999999, 0, 3, 1, 9, 9, 6, 50, -10, 2, 7, 15, 99], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b7", "slug": "basic-sort-two", "id": 7, "title": "Sort Two Numbers", "difficulty": "Easy", "category": "if-else", "link": null, "examples": [{"input": "a = 5, b = 2", "output": "[2,5]", "explanation": "2 comes before 5."}, {"input": "a = 3, b = 3", "output": "[3,3]", "explanation": "Equal values stay as they are."}], "hints": ["Use an `if` to decide which value goes first.", "The result always has exactly two elements."], "statement": "Return the two integers `a` and `b` in ascending order as a two-element array. For example, inputs `5, 2` produce `[2,5]`.\n\n**Constraints:**\n- ``-10^9 <= a, b <= 10^9``\n", "solution": "## Approach\n\nCompare the two inputs once. Place the smaller one first and the larger one second to build the sorted pair.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(1).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def sortTwo(self, a: int, b: int) -> List[int]:\n if a <= b:\n return [a, b]\n return [b, a]\n```\n", "starter": {"go": "package main\n\nfunc SortTwo(a int, b int) []int {\n return []int{}\n}", "python": "from typing import List\n\nclass Solution:\n def sortTwo(self, a: int, b: int) -> List[int]:\n return []\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> sortTwo(int a, int b) {\n return {};\n }\n};"}, "fn": "sortTwo", "params": [{"name": "a", "type": "int"}, {"name": "b", "type": "int"}], "outputType": "int_array", "tests": [["5", "2"], ["1", "9"], ["3", "3"], ["-5", "-9"], ["0", "0"], ["1000000000", "-1000000000"], ["2", "1"], ["0", "-1"], ["-1", "0"], ["9", "9"], ["-1000000000", "1000000000"], ["7", "3"], ["-4", "-4"], ["15", "-15"], ["-15", "15"], ["100", "200"], ["200", "100"], ["0", "1"], ["1", "0"], ["999999999", "1000000000"], ["-999999999", "-1000000000"], ["123", "456"], ["456", "123"], ["5", "5"], ["-7", "2"]], "expected": [[2, 5], [1, 9], [3, 3], [-9, -5], [0, 0], [-1000000000, 1000000000], [1, 2], [-1, 0], [-1, 0], [9, 9], [-1000000000, 1000000000], [3, 7], [-4, -4], [-15, 15], [-15, 15], [100, 200], [100, 200], [0, 1], [0, 1], [999999999, 1000000000], [-1000000000, -999999999], [123, 456], [123, 456], [5, 5], [-7, 2]], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b42", "slug": "basic-staircase", "id": 42, "title": "Staircase Stars", "difficulty": "Easy", "category": "nested-loops", "link": null, "examples": [{"input": "n = 3", "output": "[\"*\",\"**\",\"***\"]", "explanation": "Three rows of growing stars."}, {"input": "n = 1", "output": "[\"*\"]", "explanation": "A single star."}], "hints": ["Row `i` holds `i` copies of `*`.", "Use an inner loop (or string repetition) to build each row."], "statement": "Return a staircase of stars with `n` rows: row 1 is `\"*\"`, row 2 is `\"**\"`, and so on up to row `n` with `n` stars. Return the rows as a list of strings.\n\n**Constraints:**\n- ``1 <= n <= 25``\n", "solution": "## Approach\n\nBuild each row with an inner loop appending one star at a time. Collect the n rows in order into a list.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2).\n- **Space Complexity:** O(n^2).\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def staircase(self, n: int) -> List[str]:\n return ['*' * i for i in range(1, n + 1)]\n```\n", "starter": {"go": "package main\n\nfunc Staircase(n int) []string {\n return []string{}\n}", "python": "from typing import List\n\nclass Solution:\n def staircase(self, n: int) -> List[str]:\n return []\n", "cpp": "#include <vector>\n#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<string> staircase(int n) {\n return {};\n }\n};"}, "fn": "staircase", "params": [{"name": "n", "type": "int"}], "outputType": "string_list", "tests": [["3"], ["1"], ["5"], ["2"], ["4"], ["10"], ["6"], ["7"], ["8"], ["9"], ["11"], ["12"], ["13"], ["14"], ["15"], ["16"], ["17"], ["18"], ["19"], ["20"], ["21"], ["22"], ["23"], ["24"], ["25"]], "expected": [["*", "**", "***"], ["*"], ["*", "**", "***", "****", "*****"], ["*", "**"], ["*", "**", "***", "****"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********"], ["*", "**", "***", "****", "*****", "******"], ["*", "**", "***", "****", "*****", "******", "*******"], ["*", "**", "***", "****", "*****", "******", "*******", "********"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************", "******************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************", "******************", "*******************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************", "******************", "*******************", "********************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************", "******************", "*******************", "********************", "*********************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************", "******************", "*******************", "********************", "*********************", "**********************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************", "******************", "*******************", "********************", "*********************", "**********************", "***********************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************", "******************", "*******************", "********************", "*********************", "**********************", "***********************", "************************"], ["*", "**", "***", "****", "*****", "******", "*******", "********", "*********", "**********", "***********", "************", "*************", "**************", "***************", "****************", "*****************", "******************", "*******************", "********************", "*********************", "**********************", "***********************", "************************", "*************************"]], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b27", "slug": "basic-string-length", "id": 27, "title": "String Length", "difficulty": "Easy", "category": "strings", "link": null, "examples": [{"input": "s = \"hello\"", "output": "5", "explanation": "hello has five letters."}, {"input": "s = \"\"", "output": "0", "explanation": "An empty string has no characters."}], "hints": ["Loop over the characters and count them.", "Every language also has a built-in length property you can compare with."], "statement": "Return the number of characters in the string `s`. An empty string has length 0. Only basic ASCII letters, digits, spaces, and punctuation appear.\n\n**Constraints:**\n- ``0 <= s.length <= 1000``\n", "solution": "## Approach\n\nWalk through the string one character at a time with a counter. The final count equals the number of characters.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def strLength(self, s: str) -> int:\n count = 0\n for _ in s:\n count += 1\n return count\n```\n", "starter": {"go": "package main\n\nfunc StrLength(s string) int {\n return 0\n}", "python": "class Solution:\n def strLength(self, s: str) -> int:\n return 0\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n int strLength(string s) {\n return 0;\n }\n};"}, "fn": "strLength", "params": [{"name": "s", "type": "string"}], "outputType": "int", "tests": [["hello"], [""], ["hi there"], ["a"], ["12345"], [" "], ["Hello, World!"], ["ab"], ["abc"], ["a b c"], ["Hello World"], ["1234567890"], ["!@#$%"], ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"], ["hellohellohellohellohellohellohellohellohellohello"], [" "], [" "], ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], ["The quick brown fox"], ["line1"], ["0"], ["Aa"], ["zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"], ["abcdefghij"], [" padded "], ["with space here"]], "expected": [5, 0, 8, 1, 5, 3, 13, 2, 3, 5, 11, 10, 5, 50, 50, 1, 2, 100, 19, 5, 1, 2, 1000, 10, 10, 15], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b9", "slug": "basic-sum-1-to-n", "id": 9, "title": "Sum 1 to N", "difficulty": "Easy", "category": "loops", "link": null, "examples": [{"input": "n = 5", "output": "15", "explanation": "1+2+3+4+5 = 15."}, {"input": "n = 1", "output": "1", "explanation": "The sum of just 1 is 1."}], "hints": ["Loop from 1 to `n`, adding each value to a running total.", "Start the total at 0."], "statement": "Return the sum `1 + 2 + ... + n`. When `n` is 0 the sum is 0.\n\n**Constraints:**\n- ``0 <= n <= 10000``\n", "solution": "## Approach\n\nKeep a running total starting at zero. Loop through every integer from 1 to n and add it to the total.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def sumUpTo(self, n: int) -> int:\n total = 0\n for i in range(1, n + 1):\n total += i\n return total\n```\n", "starter": {"go": "package main\n\nfunc SumUpTo(n int) int {\n return 0\n}", "python": "class Solution:\n def sumUpTo(self, n: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int sumUpTo(int n) {\n return 0;\n }\n};"}, "fn": "sumUpTo", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["5"], ["10"], ["0"], ["1"], ["2"], ["100"], ["1000"], ["10000"], ["3"], ["4"], ["6"], ["7"], ["8"], ["9"], ["20"], ["50"], ["200"], ["500"], ["2000"], ["5000"], ["7500"], ["9999"], ["11"], ["12"], ["15"], ["25"], ["33"]], "expected": [15, 55, 0, 1, 3, 5050, 500500, 50005000, 6, 10, 21, 28, 36, 45, 210, 1275, 20100, 125250, 2001000, 12502500, 28128750, 49995000, 66, 78, 120, 325, 561], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b45", "slug": "basic-sum-digits-rec", "id": 45, "title": "Sum of Digits (Recursive)", "difficulty": "Easy", "category": "recursion", "link": null, "examples": [{"input": "n = 123", "output": "6", "explanation": "1+2+3 = 6."}, {"input": "n = 7", "output": "7", "explanation": "A single digit returns itself."}], "hints": ["The last digit is `n % 10` and the rest is `n / 10`.", "Base case: numbers below 10 return themselves."], "statement": "Return the sum of the decimal digits of `n`, computed recursively: a single digit is its own sum, otherwise add the last digit to the sum of the rest.\n\n**Constraints:**\n- ``0 <= n <= 10^9``\n", "solution": "## Approach\n\nReturn single digits directly. Otherwise split off the last digit and add it to the recursive sum of the remaining prefix.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log n).\n- **Space Complexity:** O(log n).\n\n## Implementation\n\n```python\nclass Solution:\n def sumDigitsRec(self, n: int) -> int:\n if n < 10:\n return n\n return n % 10 + self.sumDigitsRec(n // 10)\n```\n", "starter": {"go": "package main\n\nfunc SumDigitsRec(n int) int {\n return 0\n}", "python": "class Solution:\n def sumDigitsRec(self, n: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int sumDigitsRec(int n) {\n return 0;\n }\n};"}, "fn": "sumDigitsRec", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["123"], ["7"], ["1000"], ["0"], ["5"], ["19"], ["99"], ["999999999"], ["8"], ["10"], ["29"], ["55"], ["100"], ["505"], ["1234"], ["9999"], ["100000"], ["777777"], ["123456789"], ["900000009"], ["42"], ["314159"], ["271828"], ["111111"], ["222222"], ["101010"]], "expected": [6, 7, 1, 0, 5, 10, 18, 81, 8, 1, 11, 10, 1, 10, 10, 36, 1, 42, 45, 18, 6, 23, 28, 6, 12, 3], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b16", "slug": "basic-sum-multiples", "id": 16, "title": "Sum of Multiples", "difficulty": "Easy", "category": "loops", "link": null, "examples": [{"input": "n = 10, k = 3", "output": "18", "explanation": "3+6+9 = 18."}, {"input": "n = 10, k = 1", "output": "55", "explanation": "Every number 1..10 counts."}], "hints": ["Loop from 1 to `n` and add the value when `i % k == 0`.", "Alternatively step the loop by `k`: `k, 2k, 3k, ...`."], "statement": "Return the sum of all multiples of `k` from 1 up to `n` (inclusive). For example with `n = 10, k = 3` the multiples are 3, 6, 9 and the answer is 18. If there are none, return 0.\n\n**Constraints:**\n- ``1 <= n <= 10000``\n- ``1 <= k <= 10000``\n", "solution": "## Approach\n\nScan every number from 1 to n. Whenever the number is divisible by k, add it to a running total.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def sumMultiples(self, n: int, k: int) -> int:\n total = 0\n for i in range(1, n + 1):\n if i % k == 0:\n total += i\n return total\n```\n", "starter": {"go": "package main\n\nfunc SumMultiples(n int, k int) int {\n return 0\n}", "python": "class Solution:\n def sumMultiples(self, n: int, k: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int sumMultiples(int n, int k) {\n return 0;\n }\n};"}, "fn": "sumMultiples", "params": [{"name": "n", "type": "int"}, {"name": "k", "type": "int"}], "outputType": "int", "tests": [["10", "3"], ["10", "1"], ["1", "5"], ["100", "10"], ["7", "7"], ["20", "6"], ["10000", "1"], ["10000", "9999"], ["15", "4"], ["15", "5"], ["30", "7"], ["50", "6"], ["100", "3"], ["100", "25"], ["1000", "7"], ["1000", "1000"], ["9999", "9999"], ["5000", "2"], ["100", "1"], ["2", "2"], ["3", "2"], ["9", "9"], ["50", "50"], ["10000", "3"], ["7777", "11"], ["1234", "13"], ["100", "99"], ["64", "8"]], "expected": [18, 55, 0, 550, 7, 36, 50005000, 9999, 24, 30, 70, 216, 1683, 250, 71071, 1000, 9999, 6252500, 5050, 2, 2, 9, 50, 16668333, 2753058, 58045, 99, 288], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b12", "slug": "basic-sum-of-digits", "id": 12, "title": "Sum of Digits", "difficulty": "Easy", "category": "loops", "link": null, "examples": [{"input": "n = 123", "output": "6", "explanation": "1+2+3 = 6."}, {"input": "n = 1000", "output": "1", "explanation": "1+0+0+0 = 1."}], "hints": ["The last digit is `n % 10`.", "Drop the last digit with integer division by 10 and repeat."], "statement": "Return the sum of the decimal digits of `n`. For example, `123` gives `1+2+3 = 6`.\n\n**Constraints:**\n- ``0 <= n <= 10^9``\n", "solution": "## Approach\n\nPeel off the last digit with modulo ten, add it to a running total, then drop it with integer division. Repeat until no digits remain.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log n).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def sumOfDigits(self, n: int) -> int:\n total = 0\n while n > 0:\n total += n % 10\n n //= 10\n return total\n```\n", "starter": {"go": "package main\n\nfunc SumOfDigits(n int) int {\n return 0\n}", "python": "class Solution:\n def sumOfDigits(self, n: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int sumOfDigits(int n) {\n return 0;\n }\n};"}, "fn": "sumOfDigits", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["123"], ["1000"], ["0"], ["5"], ["19"], ["99"], ["101"], ["999999999"], ["1000000000"], ["9"], ["10"], ["11"], ["29"], ["55"], ["1234"], ["5678"], ["10001"], ["909090"], ["123456789"], ["500000005"], ["777"], ["10010"], ["2468"], ["13579"], ["99999"]], "expected": [6, 1, 0, 5, 10, 18, 2, 81, 1, 9, 1, 2, 11, 10, 10, 26, 2, 27, 45, 10, 21, 2, 20, 25, 45], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b6", "slug": "basic-temperature-advice", "id": 6, "title": "Temperature Advice", "difficulty": "Easy", "category": "if-else", "link": null, "examples": [{"input": "t = -5", "output": "\"Freezing\"", "explanation": "-5 is below 0."}, {"input": "t = 20", "output": "\"Warm\"", "explanation": "20 is between 15 and 25."}], "hints": ["Order the checks from coldest to hottest.", "Use `<` comparisons against 0, 15, and 25."], "statement": "Describe temperature `t` in degrees Celsius: `\"Freezing\"` below 0, `\"Cold\"` from 0 up to (but not including) 15, `\"Warm\"` from 15 up to (but not including) 25, and `\"Hot\"` at 25 and above.\n\n**Constraints:**\n- ``-100 <= t <= 100``\n", "solution": "## Approach\n\nCompare the temperature against each boundary starting from the coldest. The first boundary it falls below selects the label, and anything reaching 25 is Hot.\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 tempAdvice(self, t: int) -> str:\n if t < 0:\n return \"Freezing\"\n if t < 15:\n return \"Cold\"\n if t < 25:\n return \"Warm\"\n return \"Hot\"\n```\n", "starter": {"go": "package main\n\nfunc TempAdvice(t int) string {\n return \"\"\n}", "python": "class Solution:\n def tempAdvice(self, t: int) -> str:\n return \"\"\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n string tempAdvice(int t) {\n return \"\";\n }\n};"}, "fn": "tempAdvice", "params": [{"name": "t", "type": "int"}], "outputType": "string", "tests": [["-5"], ["10"], ["30"], ["-1"], ["0"], ["14"], ["15"], ["24"], ["25"], ["100"], ["-100"], ["-50"], ["-2"], ["1"], ["5"], ["13"], ["16"], ["20"], ["23"], ["26"], ["50"], ["99"], ["-20"], ["7"], ["40"], ["60"]], "expected": ["Freezing", "Cold", "Hot", "Freezing", "Cold", "Cold", "Warm", "Warm", "Hot", "Hot", "Freezing", "Freezing", "Freezing", "Cold", "Cold", "Cold", "Warm", "Warm", "Warm", "Hot", "Hot", "Hot", "Freezing", "Cold", "Hot", "Hot"], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b32", "slug": "basic-to-upper", "id": 32, "title": "To Uppercase", "difficulty": "Easy", "category": "strings", "link": null, "examples": [{"input": "s = \"hello\"", "output": "\"HELLO\"", "explanation": "All letters become capitals."}, {"input": "s = \"AbC123!\"", "output": "\"ABC123!\"", "explanation": "Digits and punctuation are untouched."}], "hints": ["Lowercase and uppercase letters differ by 32 in ASCII.", "Only shift characters between 'a' and 'z'."], "statement": "Return `s` with every lowercase letter (`a` to `z`) converted to uppercase. All other characters stay unchanged.\n\n**Constraints:**\n- ``0 <= s.length <= 1000``\n", "solution": "## Approach\n\nVisit each character and shift it by 32 positions when it falls in the lowercase range. Append every character, shifted or not, to the answer.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n).\n- **Space Complexity:** O(n).\n\n## Implementation\n\n```python\nclass Solution:\n def toUpper(self, s: str) -> str:\n out = []\n for c in s:\n if 'a' <= c <= 'z':\n out.append(chr(ord(c) - 32))\n else:\n out.append(c)\n return ''.join(out)\n```\n", "starter": {"go": "package main\n\nfunc ToUpper(s string) string {\n return \"\"\n}", "python": "class Solution:\n def toUpper(self, s: str) -> str:\n return \"\"\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n string toUpper(string s) {\n return \"\";\n }\n};"}, "fn": "toUpper", "params": [{"name": "s", "type": "string"}], "outputType": "string", "tests": [["hello"], ["AbC123!"], [""], ["ABC"], ["abc xyz"], ["123!?"], ["a"], ["z"], ["abc"], ["aBcDeF"], ["hello world"], ["123 abc!"], ["abcdefghijklmnopqrstuvwxyz"], ["MiXeD 123"], [" "], ["already UPPER"], ["with-dash_under"], ["trailing9"], ["9leading"], ["CAPS lock"], ["m"], ["n"], ["xyz"], ["XYZ"], ["a1"], ["Z9"], ["hello WORLD"], ["Good Morning"], ["s"], ["T"], ["end."], ["TESTing"]], "expected": ["HELLO", "ABC123!", "", "ABC", "ABC XYZ", "123!?", "A", "Z", "ABC", "ABCDEF", "HELLO WORLD", "123 ABC!", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "MIXED 123", " ", "ALREADY UPPER", "WITH-DASH_UNDER", "TRAILING9", "9LEADING", "CAPS LOCK", "M", "N", "XYZ", "XYZ", "A1", "Z9", "HELLO WORLD", "GOOD MORNING", "S", "T", "END.", "TESTING"], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": true, "label": "b41", "slug": "basic-triangle-sum", "id": 41, "title": "Triangle Sum", "difficulty": "Easy", "category": "nested-loops", "link": null, "examples": [{"input": "n = 3", "output": "10", "explanation": "1 + 3 + 6 = 10."}, {"input": "n = 1", "output": "1", "explanation": "Just the first row."}], "hints": ["The outer loop picks the row `i`; the inner loop adds `1..i`.", "Accumulate everything into one total."], "statement": "Compute the nested sum `1 + (1+2) + (1+2+3) + ... + (1+...+n)`. For `n = 3` this is `1 + 3 + 6 = 10`. For `n = 0` the answer is 0.\n\n**Constraints:**\n- ``0 <= n <= 100``\n", "solution": "## Approach\n\nUse an outer loop for the row number and an inner loop adding that row's values. Accumulate all rows into a single total.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2).\n- **Space Complexity:** O(1).\n\n## Implementation\n\n```python\nclass Solution:\n def triangleSum(self, n: int) -> int:\n total = 0\n for i in range(1, n + 1):\n for j in range(1, i + 1):\n total += j\n return total\n```\n", "starter": {"go": "package main\n\nfunc TriangleSum(n int) int {\n return 0\n}", "python": "class Solution:\n def triangleSum(self, n: int) -> int:\n return 0\n", "cpp": "\nclass Solution {\npublic:\n int triangleSum(int n) {\n return 0;\n }\n};"}, "fn": "triangleSum", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["3"], ["1"], ["5"], ["0"], ["2"], ["4"], ["10"], ["100"], ["6"], ["7"], ["8"], ["9"], ["11"], ["12"], ["15"], ["20"], ["25"], ["30"], ["40"], ["60"], ["80"], ["90"], ["99"], ["13"], ["14"], ["16"], ["18"]], "expected": [10, 1, 35, 0, 4, 20, 220, 171700, 56, 84, 120, 165, 286, 364, 680, 1540, 2925, 4960, 11480, 37820, 88560, 125580, 166650, 455, 560, 816, 1140], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": false, "label": "490", "slug": "battleships-in-a-board", "id": 490, "title": "Battleships in a Board", "difficulty": "Medium", "category": "matrix", "link": "https://leetcode.com/problems/battleships-in-a-board/", "examples": [{"input": "board = [[\"X\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"]]", "output": "2", "explanation": "One lone X plus one vertical ship of length 3 make two battleships."}, {"input": "board = [[\".\"]]", "output": "0", "explanation": "No X cells means no ships."}, {"input": "board = [[\"X\"]]", "output": "1", "explanation": "A single X is one ship."}], "hints": ["Ships are straight lines with at least one empty cell gap, never touching side by side.", "Count only the top-left cell of each ship: an X with no X above and no X to the left.", "This single pass needs O(1) extra memory."], "statement": "A board holds battleships marked `X` and empty water marked `.`. Each ship occupies a straight line of one or more cells, either fully horizontal or fully vertical. Different ships never touch side by side \u2014 at least one water cell separates them horizontally and vertically (diagonal touching is allowed).\n\nCount how many distinct ships appear. Scan once using only constant extra memory.\n\n**Constraints:**\n- `1 <= board.length, board[i].length <= 200`\n- Each cell is either `X` or `.`.\n\n**Type note:** the board arrives as a 2D char array; in Rust it is passed as one string holding the JSON-encoded board.\n", "solution": "## Approach\n\nBecause ships never touch orthogonally, the first cell of each ship (in row-major order) is exactly an X whose upper and left neighbours are not X. Counting such heads in one scan yields the ship total without extra visited memory.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(mn) for the single scan.\n- **Space Complexity:** O(1) extra.\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def countBattleships(self, board: List[List[str]]) -> int:\n if not board or not board[0]:\n return 0\n m, n = len(board), len(board[0])\n count = 0\n for i in range(m):\n for j in range(n):\n if board[i][j] != \"X\":\n continue\n if i > 0 and board[i - 1][j] == \"X\":\n continue\n if j > 0 and board[i][j - 1] == \"X\":\n continue\n count += 1\n return count\n```\n", "starter": {"go": "package main\n\nfunc CountBattleships(board [][]byte) int {\n return 0\n}", "python": "from typing import List\nclass Solution:\n def countBattleships(self, board: List[List[str]]) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int countBattleships(vector<vector<char>>& board) {\n return 0;\n }\n};"}, "fn": "countBattleships", "params": [{"name": "board", "type": "char_array_2d"}], "outputType": "int", "tests": [["[[\"X\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"]]"], ["[[\".\"]]"], ["[[\"X\"]]"], ["[[\"X\",\".\"],[\".\",\"X\"]]"], ["[[\"X\",\"X\",\"X\"]]"], ["[[\"X\"],[\"X\"],[\"X\"]]"], ["[[\"X\",\".\",\"X\"]]"], ["[[\"X\",\".\",\"X\",\".\",\"X\"]]"], ["[[\"X\",\"X\"],[\".\",\".\"]]"], ["[[\"X\",\".\"],[\"X\",\".\"]]"], ["[[\"X\",\".\",\".\"],[\".\",\".\",\".\"],[\".\",\".\",\"X\"]]"], ["[[\"X\",\"X\",\".\",\"X\"]]"], ["[[\"X\",\".\"],[\"X\",\".\"],[\"X\",\".\"]]"], ["[[\"X\",\"X\",\"X\"],[\".\",\".\",\".\"],[\"X\",\"X\",\"X\"]]"], ["[[\"X\",\".\",\"X\"],[\".\",\".\",\".\"],[\"X\",\".\",\"X\"]]"], ["[[\"X\",\"X\",\".\"],[\".\",\".\",\".\"]]"], ["[[\"X\"]]"], ["[[\"X\",\".\",\".\"],[\".\",\"X\",\".\"],[\".\",\".\",\"X\"]]"], ["[[\"X\",\"X\",\"X\",\"X\"]]"], ["[[\"X\"],[\"X\"],[\".\"],[\"X\"],[\"X\"]]"], ["[[\"X\",\".\",\"X\",\".\",\"X\"]]"], ["[[\"X\",\".\"],[\"X\",\".\"],[\".\",\".\"],[\"X\",\"X\"]]"], ["[[\"X\",\".\"],[\".\",\".\"]]"], ["[[\"X\",\".\",\"X\"],[\".\",\"X\",\".\"]]"], ["[[\"X\",\"X\",\".\",\"X\",\"X\"]]"], ["[[\"X\",\".\",\"X\",\"X\"]]"], ["[[\".\",\"X\",\".\"],[\".\",\"X\",\".\"],[\".\",\"X\",\".\"]]"], ["[[\"X\",\".\",\"X\",\"X\",\".\",\"X\"]]"], ["[[\"X\",\".\"],[\".\",\"X\"],[\"X\",\".\"]]"], ["[[\"X\",\".\",\".\",\"X\",\"X\"]]"]], "expected": [2, 0, 1, 2, 1, 1, 2, 3, 1, 1, 2, 2, 1, 2, 4, 1, 1, 3, 1, 2, 3, 2, 1, 3, 2, 2, 1, 3, 3, 2], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": false, "label": "686", "slug": "beautiful-arrangement-ii", "id": 686, "title": "Beautiful Arrangement II", "difficulty": "Medium", "category": "array", "link": "https://leetcode.com/problems/beautiful-arrangement-ii/", "examples": [{"input": "n = 3, k = 1", "output": "[1,2,3]", "explanation": "Adjacent gaps are both 1, so one distinct gap."}, {"input": "n = 3, k = 2", "output": "[1,3,2]", "explanation": "Gaps 2 and 1 give two distinct values."}, {"input": "n = 5, k = 4", "output": "[1,5,2,4,3]", "explanation": "Gaps 4,3,2,1 are all different."}], "hints": ["The tail n-k-1 entries can simply count upward with gap 1.", "Use the first k+1 slots to zigzag between a low and a high pointer to create k fresh gap sizes.", "Check answers by permutation plus distinct-gap count, since many layouts pass."], "statement": "You are given integers `n` and `k` with `1 <= k < n`.\n\nBuild a list holding each number from 1 to `n` exactly once such that the absolute gaps between neighbours take exactly `k` distinct values.\n\nReturn any such list.\n\n**Constraints:**\n- `1 <= k < n <= 10^4`\n", "solution": "## Approach\n\nReserve the first `k + 1` slots for zigzagging between a rising low pointer and a falling high pointer starting at 1 and `k + 1`. Consecutive gaps then sweep through `k, k-1, ..., 1`. Fill the remaining slots with `k+2 .. n` in order, which only reuses gap 1. The result permutes `1..n` with exactly `k` distinct gaps.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n) to emit the list.\n- **Space Complexity:** O(n) for the answer.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def constructArray(self, n: int, k: int) -> List[int]:\n ans = []\n lo, hi = 1, k + 1\n while lo <= hi:\n ans.append(lo)\n lo += 1\n if lo <= hi:\n ans.append(hi)\n hi -= 1\n for v in range(k + 2, n + 1):\n ans.append(v)\n return ans\n```\n", "starter": {"go": "package main\n\nfunc ConstructArray(n int, k int) []int {\n \n}", "python": "from typing import List\nclass Solution:\n def constructArray(self, n: int, k: int) -> List[int]:\n pass", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n vector<int> constructArray(int n, int k) {\n return {};\n }\n};"}, "fn": "constructArray", "params": [{"name": "n", "type": "int"}, {"name": "k", "type": "int"}], "outputType": "int_array", "tests": [["3", "1"], ["3", "2"], ["5", "4"], ["2", "1"], ["4", "1"], ["4", "2"], ["4", "3"], ["5", "1"], ["5", "2"], ["5", "3"], ["6", "5"], ["6", "1"], ["7", "3"], ["8", "7"], ["9", "4"], ["10", "9"], ["10", "1"], ["10", "5"], ["15", "7"], ["20", "19"], ["20", "1"], ["25", "12"], ["30", "29"], ["50", "25"], ["50", "49"], ["100", "50"], ["100", "99"], ["12", "6"]], "expected": [[1, 2, 3], [1, 3, 2], [1, 5, 2, 4, 3], [1, 2], [1, 2, 3, 4], [1, 3, 2, 4], [1, 4, 2, 3], [1, 2, 3, 4, 5], [1, 3, 2, 4, 5], [1, 4, 2, 3, 5], [1, 6, 2, 5, 3, 4], [1, 2, 3, 4, 5, 6], [1, 4, 2, 3, 5, 6, 7], [1, 8, 2, 7, 3, 6, 4, 5], [1, 5, 2, 4, 3, 6, 7, 8, 9], [1, 10, 2, 9, 3, 8, 4, 7, 5, 6], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 6, 2, 5, 3, 4, 7, 8, 9, 10], [1, 8, 2, 7, 3, 6, 4, 5, 9, 10, 11, 12, 13, 14, 15], [1, 20, 2, 19, 3, 18, 4, 17, 5, 16, 6, 15, 7, 14, 8, 13, 9, 12, 10, 11], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [1, 13, 2, 12, 3, 11, 4, 10, 5, 9, 6, 8, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], [1, 30, 2, 29, 3, 28, 4, 27, 5, 26, 6, 25, 7, 24, 8, 23, 9, 22, 10, 21, 11, 20, 12, 19, 13, 18, 14, 17, 15, 16], [1, 26, 2, 25, 3, 24, 4, 23, 5, 22, 6, 21, 7, 20, 8, 19, 9, 18, 10, 17, 11, 16, 12, 15, 13, 14, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], [1, 50, 2, 49, 3, 48, 4, 47, 5, 46, 6, 45, 7, 44, 8, 43, 9, 42, 10, 41, 11, 40, 12, 39, 13, 38, 14, 37, 15, 36, 16, 35, 17, 34, 18, 33, 19, 32, 20, 31, 21, 30, 22, 29, 23, 28, 24, 27, 25, 26], [1, 51, 2, 50, 3, 49, 4, 48, 5, 47, 6, 46, 7, 45, 8, 44, 9, 43, 10, 42, 11, 41, 12, 40, 13, 39, 14, 38, 15, 37, 16, 36, 17, 35, 18, 34, 19, 33, 20, 32, 21, 31, 22, 30, 23, 29, 24, 28, 25, 27, 26, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93, 9, 92, 10, 91, 11, 90, 12, 89, 13, 88, 14, 87, 15, 86, 16, 85, 17, 84, 18, 83, 19, 82, 20, 81, 21, 80, 22, 79, 23, 78, 24, 77, 25, 76, 26, 75, 27, 74, 28, 73, 29, 72, 30, 71, 31, 70, 32, 69, 33, 68, 34, 67, 35, 66, 36, 65, 37, 64, 38, 63, 39, 62, 40, 61, 41, 60, 42, 59, 43, 58, 44, 57, 45, 56, 46, 55, 47, 54, 48, 53, 49, 52, 50, 51], [1, 7, 2, 6, 3, 5, 4, 8, 9, 10, 11, 12]], "loose": true}
@@ -0,0 +1 @@
1
+ {"basic": false, "label": "585", "slug": "beautiful-arrangement", "id": 585, "title": "Beautiful Arrangement", "difficulty": "Medium", "category": "backtracking", "link": "https://leetcode.com/problems/beautiful-arrangement/", "examples": [{"input": "n = 2", "output": "2", "explanation": "Both [1,2] and [2,1] satisfy the rule at each position."}, {"input": "n = 1", "output": "1", "explanation": "Only [1] is possible."}, {"input": "n = 3", "output": "3", "explanation": "The valid orders are [1,2,3], [3,2,1], and [2,1,3]."}], "hints": ["Build the ordering position by position and abandon a branch as soon as the current slot breaks the divisibility rule.", "A used-marker array (or bitmask) tracks which numbers are already placed.", "With n capped at 15, pruned backtracking finishes quickly."], "statement": "You are given the integer `n`, which stands for the numbers `1` through `n`. A *beautiful arrangement* is a reordering `p` of these numbers (using each exactly once) where every position `i` (counted from 1) satisfies at least one of:\n- `p[i]` is divisible by `i`, or\n- `i` is divisible by `p[i]`.\n\nReturn how many distinct beautiful arrangements exist for the given `n`.\n\n**Constraints:**\n- `1 <= n <= 15`\n", "solution": "## Approach\n\nFill the positions from 1 to `n` one at a time. At each slot, try every still-unused number that satisfies the divisibility condition with the slot index, then recurse to the next slot and undo the choice afterwards. Reaching past the last slot means a complete valid ordering was built, so a counter is increased. Checking the rule eagerly prunes hopeless branches early.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n!) in the worst case, heavily pruned by the divisibility test; fine for n up to 15.\n- **Space Complexity:** O(n) for the recursion stack and the used-marker array.\n\n## Implementation\n\n```python\nclass Solution:\n def countArrangement(self, n: int) -> int:\n self.total = 0\n used = [False] * (n + 1)\n def backtrack(pos):\n if pos > n:\n self.total += 1\n return\n for v in range(1, n + 1):\n if not used[v] and (v % pos == 0 or pos % v == 0):\n used[v] = True\n backtrack(pos + 1)\n used[v] = False\n backtrack(1)\n return self.total\n```\n", "starter": {"go": "package main\n\nfunc CountArrangement(n int) int {\n \n}", "python": "class Solution:\n def countArrangement(self, n: int) -> int:\n pass", "cpp": "class Solution {\npublic:\n int countArrangement(int n) {\n return 0;\n }\n};"}, "fn": "countArrangement", "params": [{"name": "n", "type": "int"}], "outputType": "int", "tests": [["1"], ["2"], ["3"], ["4"], ["5"], ["6"], ["7"], ["8"], ["9"], ["10"], ["11"], ["12"], ["13"], ["14"], ["15"], ["1"], ["2"], ["3"], ["4"], ["5"], ["6"], ["7"], ["8"], ["9"], ["10"], ["11"], ["12"], ["13"]], "expected": [1, 2, 3, 8, 10, 36, 41, 132, 250, 700, 750, 4010, 4237, 10680, 24679, 1, 2, 3, 8, 10, 36, 41, 132, 250, 700, 750, 4010, 4237], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": false, "label": "919", "slug": "beautiful-array", "id": 919, "title": "Beautiful Array", "difficulty": "Medium", "category": "array", "link": "https://leetcode.com/problems/beautiful-array/", "examples": [{"input": "n = 4", "output": "[2,1,4,3]", "explanation": "No triple is evenly spaced."}, {"input": "n = 5", "output": "[1,5,3,2,4]", "explanation": "Another valid ordering."}, {"input": "n = 1", "output": "[1]"}], "hints": ["Putting all odds before all evens keeps any middle term from averaging across the split.", "Apply the odd/even expansion repeatedly starting from [1], discarding values above n.", "The checker accepts any permutation with no 3-term progression, so focus on the property, not one order."], "statement": "A permutation of `1..n` is called beautiful when no three indices `i < j < k` form an arithmetic progression in values, meaning `2 * arr[j] != arr[i] + arr[k]` for every triple.\n\nGiven `n`, return any beautiful permutation. The checker verifies the permutation property and the progression rule rather than matching one exact order.\n\n**Constraints:**\n- `1 <= n <= 1000`\n\nAdaptation: the output uses `int_array`; any valid beautiful array is accepted.\n", "solution": "## Approach\n\nOdds and evens separate beautifully: an arithmetic progression cannot straddle the parity split in the middle position. Start from `[1]` and repeatedly replace each value by its odd and even children (`2*x-1` then `2*x`), keeping only values up to `n`. Odds come first, evens after, preserving beauty inductively.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n log n) to build the permutation by repeated doubling and filtering.\n- **Space Complexity:** O(n) for the current list.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def beautifulArray(self, n: int) -> List[int]:\n cur = [1]\n while len(cur) < n:\n nxt = []\n for x in cur:\n v = 2 * x - 1\n if v <= n:\n nxt.append(v)\n for x in cur:\n v = 2 * x\n if v <= n:\n nxt.append(v)\n cur = nxt\n return cur[:n]\n```\n", "starter": {"go": "package main\n\nfunc BeautifulArray(n int) []int {\n return nil\n}", "python": "from typing import List\nclass Solution:\n def beautifulArray(self, n: int) -> List[int]:\n pass", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> beautifulArray(int n) {\n return {};\n }\n};"}, "fn": "beautifulArray", "params": [{"name": "n", "type": "int"}], "outputType": "int_array", "tests": [["4"], ["5"], ["1"], ["2"], ["3"], ["6"], ["7"], ["8"], ["9"], ["10"], ["11"], ["12"], ["13"], ["14"], ["15"], ["16"], ["17"], ["18"], ["19"], ["20"], ["25"], ["30"], ["40"], ["50"], ["75"], ["100"], ["200"], ["500"]], "expected": [[1, 3, 2, 4], [1, 5, 3, 2, 4], [1], [1, 2], [1, 3, 2], [1, 5, 3, 2, 6, 4], [1, 5, 3, 7, 2, 6, 4], [1, 5, 3, 7, 2, 6, 4, 8], [1, 9, 5, 3, 7, 2, 6, 4, 8], [1, 9, 5, 3, 7, 2, 10, 6, 4, 8], [1, 9, 5, 3, 11, 7, 2, 10, 6, 4, 8], [1, 9, 5, 3, 11, 7, 2, 10, 6, 4, 12, 8], [1, 9, 5, 13, 3, 11, 7, 2, 10, 6, 4, 12, 8], [1, 9, 5, 13, 3, 11, 7, 2, 10, 6, 14, 4, 12, 8], [1, 9, 5, 13, 3, 11, 7, 15, 2, 10, 6, 14, 4, 12, 8], [1, 9, 5, 13, 3, 11, 7, 15, 2, 10, 6, 14, 4, 12, 8, 16], [1, 17, 9, 5, 13, 3, 11, 7, 15, 2, 10, 6, 14, 4, 12, 8, 16], [1, 17, 9, 5, 13, 3, 11, 7, 15, 2, 18, 10, 6, 14, 4, 12, 8, 16], [1, 17, 9, 5, 13, 3, 19, 11, 7, 15, 2, 18, 10, 6, 14, 4, 12, 8, 16], [1, 17, 9, 5, 13, 3, 19, 11, 7, 15, 2, 18, 10, 6, 14, 4, 20, 12, 8, 16], [1, 17, 9, 25, 5, 21, 13, 3, 19, 11, 7, 23, 15, 2, 18, 10, 6, 22, 14, 4, 20, 12, 8, 24, 16], [1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 2, 18, 10, 26, 6, 22, 14, 30, 4, 20, 12, 28, 8, 24, 16], [1, 33, 17, 9, 25, 5, 37, 21, 13, 29, 3, 35, 19, 11, 27, 7, 39, 23, 15, 31, 2, 34, 18, 10, 26, 6, 38, 22, 14, 30, 4, 36, 20, 12, 28, 8, 40, 24, 16, 32], [1, 33, 17, 49, 9, 41, 25, 5, 37, 21, 13, 45, 29, 3, 35, 19, 11, 43, 27, 7, 39, 23, 15, 47, 31, 2, 34, 18, 50, 10, 42, 26, 6, 38, 22, 14, 46, 30, 4, 36, 20, 12, 44, 28, 8, 40, 24, 16, 48, 32], [1, 65, 33, 17, 49, 9, 73, 41, 25, 57, 5, 69, 37, 21, 53, 13, 45, 29, 61, 3, 67, 35, 19, 51, 11, 75, 43, 27, 59, 7, 71, 39, 23, 55, 15, 47, 31, 63, 2, 66, 34, 18, 50, 10, 74, 42, 26, 58, 6, 70, 38, 22, 54, 14, 46, 30, 62, 4, 68, 36, 20, 52, 12, 44, 28, 60, 8, 72, 40, 24, 56, 16, 48, 32, 64], [1, 65, 33, 97, 17, 81, 49, 9, 73, 41, 25, 89, 57, 5, 69, 37, 21, 85, 53, 13, 77, 45, 29, 93, 61, 3, 67, 35, 99, 19, 83, 51, 11, 75, 43, 27, 91, 59, 7, 71, 39, 23, 87, 55, 15, 79, 47, 31, 95, 63, 2, 66, 34, 98, 18, 82, 50, 10, 74, 42, 26, 90, 58, 6, 70, 38, 22, 86, 54, 14, 78, 46, 30, 94, 62, 4, 68, 36, 100, 20, 84, 52, 12, 76, 44, 28, 92, 60, 8, 72, 40, 24, 88, 56, 16, 80, 48, 32, 96, 64], [1, 129, 65, 193, 33, 161, 97, 17, 145, 81, 49, 177, 113, 9, 137, 73, 41, 169, 105, 25, 153, 89, 57, 185, 121, 5, 133, 69, 197, 37, 165, 101, 21, 149, 85, 53, 181, 117, 13, 141, 77, 45, 173, 109, 29, 157, 93, 61, 189, 125, 3, 131, 67, 195, 35, 163, 99, 19, 147, 83, 51, 179, 115, 11, 139, 75, 43, 171, 107, 27, 155, 91, 59, 187, 123, 7, 135, 71, 199, 39, 167, 103, 23, 151, 87, 55, 183, 119, 15, 143, 79, 47, 175, 111, 31, 159, 95, 63, 191, 127, 2, 130, 66, 194, 34, 162, 98, 18, 146, 82, 50, 178, 114, 10, 138, 74, 42, 170, 106, 26, 154, 90, 58, 186, 122, 6, 134, 70, 198, 38, 166, 102, 22, 150, 86, 54, 182, 118, 14, 142, 78, 46, 174, 110, 30, 158, 94, 62, 190, 126, 4, 132, 68, 196, 36, 164, 100, 20, 148, 84, 52, 180, 116, 12, 140, 76, 44, 172, 108, 28, 156, 92, 60, 188, 124, 8, 136, 72, 200, 40, 168, 104, 24, 152, 88, 56, 184, 120, 16, 144, 80, 48, 176, 112, 32, 160, 96, 64, 192, 128], [1, 257, 129, 385, 65, 321, 193, 449, 33, 289, 161, 417, 97, 353, 225, 481, 17, 273, 145, 401, 81, 337, 209, 465, 49, 305, 177, 433, 113, 369, 241, 497, 9, 265, 137, 393, 73, 329, 201, 457, 41, 297, 169, 425, 105, 361, 233, 489, 25, 281, 153, 409, 89, 345, 217, 473, 57, 313, 185, 441, 121, 377, 249, 5, 261, 133, 389, 69, 325, 197, 453, 37, 293, 165, 421, 101, 357, 229, 485, 21, 277, 149, 405, 85, 341, 213, 469, 53, 309, 181, 437, 117, 373, 245, 13, 269, 141, 397, 77, 333, 205, 461, 45, 301, 173, 429, 109, 365, 237, 493, 29, 285, 157, 413, 93, 349, 221, 477, 61, 317, 189, 445, 125, 381, 253, 3, 259, 131, 387, 67, 323, 195, 451, 35, 291, 163, 419, 99, 355, 227, 483, 19, 275, 147, 403, 83, 339, 211, 467, 51, 307, 179, 435, 115, 371, 243, 499, 11, 267, 139, 395, 75, 331, 203, 459, 43, 299, 171, 427, 107, 363, 235, 491, 27, 283, 155, 411, 91, 347, 219, 475, 59, 315, 187, 443, 123, 379, 251, 7, 263, 135, 391, 71, 327, 199, 455, 39, 295, 167, 423, 103, 359, 231, 487, 23, 279, 151, 407, 87, 343, 215, 471, 55, 311, 183, 439, 119, 375, 247, 15, 271, 143, 399, 79, 335, 207, 463, 47, 303, 175, 431, 111, 367, 239, 495, 31, 287, 159, 415, 95, 351, 223, 479, 63, 319, 191, 447, 127, 383, 255, 2, 258, 130, 386, 66, 322, 194, 450, 34, 290, 162, 418, 98, 354, 226, 482, 18, 274, 146, 402, 82, 338, 210, 466, 50, 306, 178, 434, 114, 370, 242, 498, 10, 266, 138, 394, 74, 330, 202, 458, 42, 298, 170, 426, 106, 362, 234, 490, 26, 282, 154, 410, 90, 346, 218, 474, 58, 314, 186, 442, 122, 378, 250, 6, 262, 134, 390, 70, 326, 198, 454, 38, 294, 166, 422, 102, 358, 230, 486, 22, 278, 150, 406, 86, 342, 214, 470, 54, 310, 182, 438, 118, 374, 246, 14, 270, 142, 398, 78, 334, 206, 462, 46, 302, 174, 430, 110, 366, 238, 494, 30, 286, 158, 414, 94, 350, 222, 478, 62, 318, 190, 446, 126, 382, 254, 4, 260, 132, 388, 68, 324, 196, 452, 36, 292, 164, 420, 100, 356, 228, 484, 20, 276, 148, 404, 84, 340, 212, 468, 52, 308, 180, 436, 116, 372, 244, 500, 12, 268, 140, 396, 76, 332, 204, 460, 44, 300, 172, 428, 108, 364, 236, 492, 28, 284, 156, 412, 92, 348, 220, 476, 60, 316, 188, 444, 124, 380, 252, 8, 264, 136, 392, 72, 328, 200, 456, 40, 296, 168, 424, 104, 360, 232, 488, 24, 280, 152, 408, 88, 344, 216, 472, 56, 312, 184, 440, 120, 376, 248, 16, 272, 144, 400, 80, 336, 208, 464, 48, 304, 176, 432, 112, 368, 240, 496, 32, 288, 160, 416, 96, 352, 224, 480, 64, 320, 192, 448, 128, 384, 256]], "loose": true}
@@ -0,0 +1 @@
1
+ {"basic": false, "label": "391", "slug": "best-meeting-point", "id": 391, "title": "Best Meeting Point", "difficulty": "Hard", "category": "matrix", "link": "https://leetcode.com/problems/best-meeting-point/", "examples": [{"input": "grid = [[1,0,0,0,1],[0,0,0,0,0],[0,0,1,0,0]]", "output": "6", "explanation": "Meeting at row 0, column 2 costs 2 + 2 + 2."}, {"input": "grid = [[1,1]]", "output": "1", "explanation": "One friend walks a single step."}, {"input": "grid = [[1]]", "output": "0", "explanation": "Nobody needs to travel."}], "hints": ["Manhattan distance splits into an independent row part plus a column part.", "On a line, the point minimising the sum of absolute deviations is the median.", "Collect friend rows in sorted order by scanning row by row, and friend columns by scanning column by column."], "statement": "An `m x n` grid marks each friend's home with a `1` (all other cells are `0`). Friends may\nmeet at any cell, and everyone travels with Manhattan distance `|x1-x2| + |y1-y2|`. Return\nthe smallest possible total travel distance over all meeting cells. There is at least one\nfriend on the grid.\n\n**Constraints:**\n- `1 <= m, n <= 200`\n- `grid[i][j]` is `0` or `1`.\n- The grid holds at least one `1`.\n", "solution": "## Approach\n\nHandle rows and columns separately: gather the coordinates of all homes (already sorted by scan order), take each median, and add the absolute deviations.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(m x n)\n- **Space Complexity:** O(m x n)\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def minTotalDistance(self, grid: List[List[int]]) -> int:\n rows = [i for i, row in enumerate(grid) for v in row if v == 1]\n cols = [j for j in range(len(grid[0])) for i in range(len(grid)) if grid[i][j] == 1]\n def spread(v):\n med = v[len(v) // 2]\n return sum(abs(x - med) for x in v)\n return spread(rows) + spread(cols)\n```\n", "starter": {"go": "package main\n\nfunc MinTotalDistance(grid [][]int) int {\n return 0\n}", "python": "from typing import List\nclass Solution:\n def minTotalDistance(self, grid: List[List[int]]) -> int:\n ", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int minTotalDistance(vector<vector<int>>& grid) {\n return 0;\n }\n};"}, "fn": "minTotalDistance", "params": [{"name": "grid", "type": "int_array_2d"}], "outputType": "int", "tests": [["[[1,0,0,0,1],[0,0,0,0,0],[0,0,1,0,0]]"], ["[[1,1]]"], ["[[1]]"], ["[[0]]"], ["[[1,0,1]]"], ["[[1],[0],[1]]"], ["[[1,1],[1,1]]"], ["[[1,0],[0,1]]"], ["[[0,1,0],[1,0,1],[0,1,0]]"], ["[[1,0,0]]"], ["[[1]]"], ["[[0,1],[0,0]]"], ["[[0,0],[0,1],[0,0]]"], ["[[0,0,0],[1,1,1],[0,0,0],[0,0,0]]"], ["[[0,1,1,1],[1,0,1,1],[1,0,1,0]]"], ["[[0],[1]]"], ["[[1,1,0,1,0],[1,1,0,0,1],[1,0,0,0,1],[0,0,1,0,1],[0,0,0,0,0]]"], ["[[0,0,0,1,0],[0,0,0,0,0]]"], ["[[0,1,0,0],[1,0,0,0],[0,0,0,0],[0,1,0,1],[0,0,1,0]]"], ["[[1],[1],[1],[0],[1]]"], ["[[0,0,1]]"], ["[[1],[0],[0],[0]]"], ["[[0,1,0,1],[0,0,0,1]]"], ["[[0,0,0,0,0],[0,0,1,1,0]]"], ["[[0],[1],[0],[1],[0]]"], ["[[0,0,0,0,0],[0,0,1,0,0],[1,0,0,0,0],[0,0,0,0,1],[0,0,1,0,1]]"], ["[[0,0,0,0],[1,0,0,1],[0,0,0,1],[0,0,0,0],[0,0,0,1]]"], ["[[0,0,0],[0,0,0],[1,0,0],[0,1,1],[1,0,1]]"], ["[[1,1,0,0],[1,0,1,0],[0,0,0,1],[1,0,0,0],[0,0,0,0]]"], ["[[1,0],[0,1],[0,1],[0,1]]"]], "expected": [6, 1, 0, 0, 2, 2, 4, 2, 4, 0, 0, 0, 0, 2, 12, 0, 24, 0, 10, 5, 0, 0, 3, 1, 2, 11, 7, 7, 11, 5], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": false, "label": "161", "slug": "best-time-to-buy-and-sell-stock-ii", "id": 161, "title": "Best Time to Buy and Sell Stock II", "difficulty": "Medium", "category": "array", "link": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/", "examples": [{"input": "prices = [7,1,5,3,6,4]", "output": "7", "explanation": "Buy on day 2 (price 1) sell on day 3 (price 5) profit 4; buy on day 4 (price 3) sell on day 5 (price 6) profit 3; total 7."}, {"input": "prices = [1,2,3,4,5]", "output": "4", "explanation": "Buy on day 1 (price 1) and sell on day 5 (price 5), profit 4."}, {"input": "prices = [7,6,4,3,1]", "output": "0", "explanation": "No profitable transaction exists, so profit is 0."}], "hints": ["Sum every positive day-to-day difference: profit += max(0, prices[i]-prices[i-1]).", "This greedy equals unlimited transactions since each uphill step can be captured."], "statement": "The integer array `prices` quotes one stock day by day, so `prices[i]` is its quote on day `i`.\n\nEach day you may buy and/or sell, with the restriction that your hand never holds more than one share. Selling and immediately rebuying \u2014 even within the same day \u2014 is permitted, so any number of round trips is fair game.\n\nTally up the greatest combined profit these trips can produce.\n\n**Constraints:**\n\n- 1 \u2264 prices.length \u2264 3 * 10^4\n- 0 \u2264 prices[i] \u2264 10^4\n", "solution": "## Approach\n\nSum every positive adjacent difference. Since unlimited transactions are allowed, each uphill step `prices[i] - prices[i-1] > 0` can be captured as its own buy-sell pair, and the sum of those steps equals the optimal profit.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n), single pass over `prices`.\n- **Space Complexity:** O(1) extra.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def maxProfit(self, prices: List[int]) -> int:\n profit = 0\n for i in range(1, len(prices)):\n if prices[i] > prices[i - 1]:\n profit += prices[i] - prices[i - 1]\n return profit\n```\n", "starter": {"go": "package main\n\nfunc MaxProfit(prices []int) int {\n \n}", "python": "from typing import List\nclass Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int maxProfit(vector<int>& prices) {\n return 0;\n }\n};"}, "fn": "maxProfit", "params": [{"name": "prices", "type": "int_array"}], "outputType": "int", "tests": [["[7,1,5,3,6,4]"], ["[1,2,3,4,5]"], ["[7,6,4,3,1]"], ["[1]"], ["[1,2]"], ["[2,1]"], ["[3,3,3,3]"], ["[1,7,4,11]"], ["[6,1,3,2,4,7]"], ["[0,10000]"], ["[2,4,1,7,5,3,6]"], ["@javascript:JSON.stringify(Array.from({length:30000},(_,i)=>i%2?10000:0))"], ["[5]"], ["[5,5]"], ["[1,3,2,4,3,5]"], ["[5,4,3,2,1,2]"], ["[1,2,1,2,1,2]"], ["[3,2,6,5,0,3]"], ["[1,10,2,9,3,8]"], ["[2,2,3,3,1,1]"], ["[4,1,2,7,0,5]"], ["[10,9,8,7,6,7]"], ["[1,5,2,6,3,7,4,8]"], ["[8,7,6,5,4,3,2,3]"], ["[0,0,0,1]"], ["[10000,0,10000]"], ["[1,2,3,2,1,2,3,4]"], ["[5,1,5,1,5,1,5]"], ["[2,1,2,0,1]"], ["[3,8,1,9,2,7]"], ["[1,4,2,5,3,6]"], ["[9,1,8,2,7,3,6,4,5]"]], "expected": [7, 4, 0, 0, 1, 0, 0, 13, 7, 10000, 11, 150000000, 0, 0, 6, 1, 3, 7, 21, 1, 11, 1, 16, 1, 1, 10000, 5, 12, 2, 18, 9, 16], "loose": false}
@@ -0,0 +1 @@
1
+ {"basic": false, "label": "298", "slug": "best-time-to-buy-and-sell-stock-iii", "id": 298, "title": "Best Time to Buy and Sell Stock III", "difficulty": "Hard", "category": "dp", "link": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/", "examples": [{"input": "prices = [3,3,5,0,0,3,1,4]", "output": "6", "explanation": "Buy at 0, sell at 3, then buy at 1 and sell at 4 for 3 + 3 = 6."}, {"input": "prices = [1,2,3,4,5]", "output": "4", "explanation": "One trade from 1 to 5 already gives 4; a second trade adds nothing."}, {"input": "prices = [7,6,4,3,1]", "output": "0", "explanation": "Prices only fall, so skipping all trades is best."}], "hints": ["Track four states in one pass: first buy, first sell, second buy, second sell.", "Update them in order so the second buy can reuse profit from the first sell.", "Splitting at each day into best-left plus best-right profit also works."], "statement": "You are given daily prices `prices[i]` for a stock. You may complete at most two separate trades, where each trade is one purchase followed by one later sale.\n\nYou must sell before buying again, so the two trades never overlap. You may also choose to trade once or not at all.\n\nReturn the greatest total profit achievable.\n\n**Constraints:**\n- `1 <= prices.length <= 10^5`\n- `0 <= prices[i] <= 10^5`\n", "solution": "## Approach\n\nKeep the best balance after each of the four actions: first purchase, first sale, second purchase, and second sale. Scanning prices once and updating these states in order lets the second purchase spend profit banked from the first sale. The final second-sale value is the answer.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n), where n is the number of days.\n- **Space Complexity:** O(1), using four scalar states.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def maxProfit(self, prices: List[int]) -> int:\n buy1 = float(\"-inf\")\n sell1 = 0\n buy2 = float(\"-inf\")\n sell2 = 0\n for p in prices:\n buy1 = max(buy1, -p)\n sell1 = max(sell1, buy1 + p)\n buy2 = max(buy2, sell1 - p)\n sell2 = max(sell2, buy2 + p)\n return sell2\n```\n", "starter": {"go": "package main\n\nfunc MaxProfit(prices []int) int {\n \n}", "python": "from typing import List\nclass Solution:\n def maxProfit(self, prices: List[int]) -> int:\n pass", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int maxProfit(vector<int>& prices) {\n return 0;\n }\n};"}, "fn": "maxProfit", "params": [{"name": "prices", "type": "int_array"}], "outputType": "int", "tests": [["[3,3,5,0,0,3,1,4]"], ["[1,2,3,4,5]"], ["[7,6,4,3,1]"], ["[1]"], ["[1,2]"], ["[2,1]"], ["[1,2,4,2,5,7,2,4,9,0]"], ["[5,5,5,5,5]"], ["[0,0,0,0]"], ["[1,10,1,10,1,10]"], ["[3,2,6,5,0,3]"], ["[6,1,3,2,4,7]"], ["[1,2,3,4,3,2,1,2,3,4,5]"], ["[2,4,1,5,3,6]"], ["[100000,0,100000]"], ["[0,100000]"], ["[100000,0]"], ["[1,3,2,8,4,9]"], ["[8,3,6,2,8,8,8,4,2,0,7,9]"], ["[4,4,4,1,4,4,4]"], ["[2,1,2,0,1]"], ["[1,5,3,8,2,10]"], ["[7,1,5,3,6,4]"], ["[1,2,3,2,1,4,5,1,6]"], ["[5,4,3,2,1,2,3,4,5]"], ["[0,1,0,1,0,1,0,1]"], ["[3,3,3,4,4,4,1,1,5,5]"], ["[2,2,3,2,4,2,5]"]], "expected": [6, 4, 0, 0, 1, 0, 13, 0, 0, 18, 7, 7, 7, 7, 100000, 100000, 0, 12, 15, 3, 2, 15, 7, 9, 4, 2, 5, 5], "loose": false}