Skip to content

Commit

Permalink
build based on b60c754
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Jul 20, 2024
1 parent ae566d0 commit 98a4989
Show file tree
Hide file tree
Showing 589 changed files with 1,832 additions and 1,152 deletions.
4 changes: 2 additions & 2 deletions dev/democards/problems/problems/1.two-sum/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/100.same-tree/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/101.symmetric-tree/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions dev/democards/problems/problems/1023.camelcase-matching.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@
" end\n",
" i += 1\n",
" end\n",
" return j > length(pattern) && all(!isuppercase, query[i:end])\n",
" return j > length(pattern) && all(islowercase, @view(query[i:end]))\n",
"end\n",
"\n",
"function camelMatch(queries, pattern)\n",
" return [matches(query, pattern) for query in queries]\n",
"end\n",
"camelMatch(queries, pattern) = matches.(queries, Ref(pattern))\n",
"\n",
"# @lc code=end"
],
Expand Down
6 changes: 2 additions & 4 deletions dev/democards/problems/problems/1023.camelcase-matching.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ function matches(query, pattern)
end
i += 1
end
return j > length(pattern) && all(!isuppercase, query[i:end])
return j > length(pattern) && all(islowercase, @view(query[i:end]))
end

function camelMatch(queries, pattern)
return [matches(query, pattern) for query in queries]
end
camelMatch(queries, pattern) = matches.(queries, Ref(pattern))

# @lc code=end

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/1025.divisor-game/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/1094.car-pooling/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/112.path-sum/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/113.path-sum-ii/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/120.triangle/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/1245.tree-diameter/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/127.word-ladder/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/134.gas-station/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/1345.jump-game-iv/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/135.candy/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/136.single-number/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/139.word-break/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/146.lru-cache/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/15.3sum/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/155.min-stack/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/16.3sum-closest/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/164.maximum-gap/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/174.dungeon-game/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/18.4sum/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/189.rotate-array/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/190.reverse-bits/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/198.house-robber/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/2.add-two-numbers/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/202.happy-number/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/204.count-primes/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/221.maximal-square/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/223.rectangle-area/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/228.summary-ranges/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/231.power-of-two/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/242.valid-anagram/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/258.add-digits/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/264.ugly-number-ii/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/27.remove-element/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/274.h-index/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/275.h-index-ii/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions dev/democards/problems/problems/28.implement-strstr.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# @lc code=start
using LeetCode

function strStr(haystack::String, needle::String)
needle == "" && return 0
for i in 1:(length(haystack) - length(needle) + 1)
if @view(haystack[i:(i + length(needle) - 1)]) == needle
return i - 1 # Notice that Julia is 1-indexed, and here we need 0-indexed so minus 1
end
end
return -1
end

function strStr2(haystack::AbstractString, needle::AbstractString)

isempty(needle) && return 0
length(needle) > length(haystack) && return -1

needle == @view(haystack[1:length(needle)]) && return 0

ind = @views strStr2(haystack[2:end], needle)
return ind == -1 ? -1 : ind + 1
end
# @lc code=end

# This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl

22 changes: 22 additions & 0 deletions dev/democards/problems/problems/28.implement-strstr/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/283.move-zeroes/index.html

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions dev/democards/problems/problems/29.divide-two-integers.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"cells": [
{
"cell_type": "markdown",
"source": [
"Given two integers `dividend` and `divisor`, divide two integers without using\n",
"multiplication, division, and mod operator.\n",
"\n",
"Return the quotient after dividing `dividend` by `divisor`.\n",
"\n",
"The integer division should truncate toward zero, which means losing its\n",
"fractional part. For example, `truncate(8.345) = 8` and `truncate(-2.7335) =\n",
"-2`.\n",
"\n",
"**Note:**\n",
"\n",
" * Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For this problem, assume that your function **returns 2 31 − 1 when the division result overflows**.\n",
"\n",
"\n",
"\n",
"**Example 1:**\n",
"\n",
"\n",
"\n",
" Input: dividend = 10, divisor = 3\n",
" Output: 3\n",
" Explanation: 10/3 = truncate(3.33333..) = 3.\n",
"\n",
"\n",
"**Example 2:**\n",
"\n",
"\n",
"\n",
" Input: dividend = 7, divisor = -3\n",
" Output: -2\n",
" Explanation: 7/-3 = truncate(-2.33333..) = -2.\n",
"\n",
"\n",
"**Example 3:**\n",
"\n",
"\n",
"\n",
" Input: dividend = 0, divisor = 1\n",
" Output: 0\n",
"\n",
"\n",
"**Example 4:**\n",
"\n",
"\n",
"\n",
" Input: dividend = 1, divisor = 1\n",
" Output: 1\n",
"\n",
"\n",
"\n",
"\n",
"**Constraints:**\n",
"\n",
" * `-231 <= dividend, divisor <= 231 - 1`\n",
" * `divisor != 0`"
],
"metadata": {}
},
{
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": "divide (generic function with 1 method)"
},
"metadata": {},
"execution_count": 1
}
],
"cell_type": "code",
"source": [
"# @lc code=start\n",
"using LeetCode\n",
"\n",
"function divide(dividend::Int, divisor::Int)::Int\n",
" sign = (dividend < 0) ⊻ (divisor < 0)\n",
" dividend, divisor = abs(dividend), abs(divisor)\n",
" result = 0\n",
" while dividend >= divisor\n",
" shift = 0\n",
" while dividend >= (divisor << shift)\n",
" shift += 1\n",
" end\n",
" dividend -= divisor << (shift - 1)\n",
" result += 1 << (shift - 1)\n",
" end\n",
" return sign ? -result : result\n",
"end\n",
"# @lc code=end"
],
"metadata": {},
"execution_count": 1
},
{
"cell_type": "markdown",
"source": [
"---\n",
"\n",
"*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*"
],
"metadata": {}
}
],
"nbformat_minor": 3,
"metadata": {
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.10.4"
},
"kernelspec": {
"name": "julia-1.10",
"display_name": "Julia 1.10.4",
"language": "julia"
}
},
"nbformat": 4
}
21 changes: 21 additions & 0 deletions dev/democards/problems/problems/29.divide-two-integers.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @lc code=start
using LeetCode

function divide(dividend::Int, divisor::Int)::Int
sign = (dividend < 0) (divisor < 0)
dividend, divisor = abs(dividend), abs(divisor)
result = 0
while dividend >= divisor
shift = 0
while dividend >= (divisor << shift)
shift += 1
end
dividend -= divisor << (shift - 1)
result += 1 << (shift - 1)
end
return sign ? -result : result
end
# @lc code=end

# This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl

25 changes: 25 additions & 0 deletions dev/democards/problems/problems/29.divide-two-integers/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/319.bulb-switcher/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/322.coin-change/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/324.wiggle-sort-ii/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/338.counting-bits/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/343.integer-break/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/344.reverse-string/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/36.valid-sudoku/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/372.super-pow/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions dev/democards/problems/problems/38.count-and-say.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# @lc code=start
using LeetCode

function countandsay(n::Int)

n == 1 && return "1"

previous_term = countandsay(n - 1)

current_term = ""
count = 0
current_char = previous_term[1]

for char in previous_term
if char == current_char
count += 1
else
current_term *= string(count) * current_char
current_char = char
count = 1
end
end

current_term * string(count) * current_char
end
# @lc code=end

# This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl

27 changes: 27 additions & 0 deletions dev/democards/problems/problems/38.count-and-say/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/383.ransom-note/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/39.combination-sum/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/democards/problems/problems/392.is-subsequence/index.html

Large diffs are not rendered by default.

Loading

0 comments on commit 98a4989

Please sign in to comment.