Skip to content

Commit b4ed835

Browse files
committed
fix: address second round of code review findings for Sherlock and Divisors
- Fix set notation: {k|k|(n/2)} → { k | k∣(n/2) } (and left-hand side) - Replace nav.innerHTML template literals with DOM createElement/textContent - Add setErr('') to preset button onClick handlers to clear validation state - Fix public file: Prism theme CSS CDN → /vendor/prismjs/themes/prism-tomorrow.min.css
1 parent 003473a commit b4ed835

3 files changed

Lines changed: 29 additions & 17 deletions

File tree

Mathematics/Fundamentals/HackerRank/Claude/Easy/Sherlock and Divisors/Sherlock_and_Divisors.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ <h2 className="text-3xl font-black text-cyan-700 mb-2 pb-3 border-b-4 border-eme
13211321
key={v}
13221322
type="button"
13231323
onClick={() => {
1324+
setErr('');
13241325
setEdit(String(v));
13251326
setSteps(makeSteps(v));
13261327
setN(v);
@@ -1482,7 +1483,7 @@ <h3 className="font-bold text-emerald-800 mb-2 text-base">
14821483
<p className="text-slate-600 text-sm leading-relaxed">
14831484
写像 <code className="dm">φ: d → d/2</code>{' '}
14841485
<code className="dm text-xs">
1485-
{'{d|n,2|d}'}{'{k|k|(n/2)}'}
1486+
{'{ d | d∣n, 2∣d }'}{'{ k | k∣(n/2) }'}
14861487
</code>{' '}
14871488
<strong>全単射</strong>。問題を{' '}
14881489
<code className="dm">m=n/2</code> の約数カウントに帰着できる。
@@ -2093,13 +2094,18 @@ <h2 className="text-3xl font-black text-cyan-700 mb-4 pb-3 border-b-4 border-eme
20932094
'faq',
20942095
];
20952096
const nav = document.getElementById('main-nav');
2096-
if (nav)
2097-
nav.innerHTML = labels
2098-
.map(
2099-
(l, i) =>
2100-
`<a href="#${ids[i]}" style="font-family:'Noto Sans JP',sans-serif" class="inline-block px-4 py-2 font-semibold text-slate-700 no-underline rounded-xl border-2 border-white/60 bg-white/70 text-sm transition hover:shadow-md hover:-translate-y-px hover:bg-white hover:border-teal-500">${l}</a>`,
2101-
)
2102-
.join('');
2097+
if (nav) {
2098+
nav.textContent = '';
2099+
labels.forEach((l, i) => {
2100+
const a = document.createElement('a');
2101+
a.href = '#' + ids[i];
2102+
a.className =
2103+
'inline-block px-4 py-2 font-semibold text-slate-700 no-underline rounded-xl border-2 border-white/60 bg-white/70 text-sm transition hover:shadow-md hover:-translate-y-px hover:bg-white hover:border-teal-500';
2104+
a.style.fontFamily = "'Noto Sans JP',sans-serif";
2105+
a.textContent = l;
2106+
nav.appendChild(a);
2107+
});
2108+
}
21032109
});
21042110
</script>
21052111
</body>

public/Mathematics/Fundamentals/HackerRank/Claude/Easy/Sherlock and Divisors/Sherlock_and_Divisors.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ <h2 className="text-3xl font-black text-cyan-700 mb-2 pb-3 border-b-4 border-eme
13211321
key={v}
13221322
type="button"
13231323
onClick={() => {
1324+
setErr('');
13241325
setEdit(String(v));
13251326
setSteps(makeSteps(v));
13261327
setN(v);
@@ -1482,7 +1483,7 @@ <h3 className="font-bold text-emerald-800 mb-2 text-base">
14821483
<p className="text-slate-600 text-sm leading-relaxed">
14831484
写像 <code className="dm">φ: d → d/2</code>{' '}
14841485
<code className="dm text-xs">
1485-
{'{d|n,2|d}'}{'{k|k|(n/2)}'}
1486+
{'{ d | d∣n, 2∣d }'}{'{ k | k∣(n/2) }'}
14861487
</code>{' '}
14871488
<strong>全単射</strong>。問題を{' '}
14881489
<code className="dm">m=n/2</code> の約数カウントに帰着できる。
@@ -2093,13 +2094,18 @@ <h2 className="text-3xl font-black text-cyan-700 mb-4 pb-3 border-b-4 border-eme
20932094
'faq',
20942095
];
20952096
const nav = document.getElementById('main-nav');
2096-
if (nav)
2097-
nav.innerHTML = labels
2098-
.map(
2099-
(l, i) =>
2100-
`<a href="#${ids[i]}" style="font-family:'Noto Sans JP',sans-serif" class="inline-block px-4 py-2 font-semibold text-slate-700 no-underline rounded-xl border-2 border-white/60 bg-white/70 text-sm transition hover:shadow-md hover:-translate-y-px hover:bg-white hover:border-teal-500">${l}</a>`,
2101-
)
2102-
.join('');
2097+
if (nav) {
2098+
nav.textContent = '';
2099+
labels.forEach((l, i) => {
2100+
const a = document.createElement('a');
2101+
a.href = '#' + ids[i];
2102+
a.className =
2103+
'inline-block px-4 py-2 font-semibold text-slate-700 no-underline rounded-xl border-2 border-white/60 bg-white/70 text-sm transition hover:shadow-md hover:-translate-y-px hover:bg-white hover:border-teal-500';
2104+
a.style.fontFamily = "'Noto Sans JP',sans-serif";
2105+
a.textContent = l;
2106+
nav.appendChild(a);
2107+
});
2108+
}
21032109
});
21042110
</script>
21052111
</body>

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ <h1 class="site-title">
791791

792792
<footer>
793793
<span class="footer-icon">🧪</span>
794-
Generated on 2026-02-25 10:02:16 UTC
794+
Generated on 2026-02-25 10:23:15 UTC
795795
</footer>
796796

797797
<script>

0 commit comments

Comments
 (0)