Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/skills/restate-problem/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Work in your own worktree, per CLAUDE.md. One Restatement is one commit.
## 1. Read the problem as it stands

1. From your worktree, print the problem as it stands, English and Korean text and every Test Case, hidden ones too: `scripts/problem-text.sh <slug> --all`. It reads the local database (`docker compose -f infra/docker-compose.yml up -d`) and warns when the database hasn't run this checkout's migrations; the main checkout can trail `origin/master` along with its database, and then nothing warns. On that warning, run `scripts/dev-branch-servers.sh start --detach` and rerun with `CODEBITE_DB=<the database it prints>`; or, when no migration newer than the database's version names the slug (`grep -l '<slug>' common/src/main/resources/db/migration/V<version+1 and up>__*.sql` finds nothing), the database's text is current and the output stands. Without a database, the newest migration that sets each column wins: `grep -ln '<slug>' common/src/main/resources/db/migration/ common/src/main/java/db/migration/` (Java migrations redraw some Diagrams) and read from the highest version down, minding Former Slugs in older migrations.
2. Read all 4 Drivers and all 4 Starter Code files. Grep the method name in all 4: a Python Starter Code sometimes names it differently (`count_decodings` beside `countDecodings`), and the tests pass anyway.
2. Read all 4 Drivers and all 4 Starter Code files. Grep the method name in all 4: a Python Starter Code sometimes named it differently (`count_decodings` beside `countDecodings`); `StarterMethodNamesTest` (common) now fails when the four Starter Codes name different methods, so a rename goes into all four together.
3. Compare with production, since a Restatement overwrites any edit made through the admin page: `scripts/prod-text.sh <slug>` prints each language's title, description and constraints. A difference from step 1 is such an edit: carry it into the new statement.
4. Check every constraint against every case and against the return type: each maximum a case reaches (or none does), and whether the answer at the stated bound fits an `int`. The audit found false bounds and 8 problems that overflow at their own maximum.
5. Write all 4 reference solutions (their conventions are in step 5.3) against the unchanged problem and run `scripts/judge-local.sh <slug>` before renaming anything: an earlier bulk rename had left 4 Java Drivers broken, and a failure found now is the Driver's, not your rename's.
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/drivers/add-score-lists/cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ int main() {
getline(cin, line2);
ListNode* l1 = listFromArray(line1);
ListNode* l2 = listFromArray(line2);
ListNode* result = Solution().tallyPickRoutes(l1, l2);
ListNode* result = Solution().addScoreLists(l1, l2);
cout << listToJsonArray(result) << endl;
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static void main(String[] args) {
String line2 = sc.nextLine().trim();
ListNode l1 = ListNode.fromArray(line1);
ListNode l2 = ListNode.fromArray(line2);
ListNode result = new Solution().tallyPickRoutes(l1, l2);
ListNode result = new Solution().addScoreLists(l1, l2);
System.out.println(ListNode.toJsonArray(result));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ const arr1 = JSON.parse(lines[0]);
const arr2 = JSON.parse(lines[1]);
const l1 = _buildList(arr1);
const l2 = _buildList(arr2);
const result = new Solution().tallyPickRoutes(l1, l2);
const result = new Solution().addScoreLists(l1, l2);
console.log(JSON.stringify(_listToArray(result)));
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ def _list_to_array(head):
arr2 = json.loads(input())
l1 = _build_list(arr1)
l2 = _build_list(arr2)
result = Solution().add_two_numbers(l1, l2)
result = Solution().addScoreLists(l1, l2)
print(json.dumps(_list_to_array(result), separators=(',', ':')))
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ int main() {
i++;
}
}
cout << Solution().biggestClearBay(matrix) << endl;
cout << Solution().biggestClearFloor(matrix) << endl;
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public static void main(String[] args) {
}
}
char[][] matrix = rows.toArray(new char[0][]);
System.out.println(new Solution().biggestClearBay(matrix));
System.out.println(new Solution().biggestClearFloor(matrix));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

const input = require('fs').readFileSync('/dev/stdin', 'utf8').trim();
const matrix = JSON.parse(input);
const result = new Solution().biggestClearBay(matrix);
const result = new Solution().biggestClearFloor(matrix);
console.log(result);
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import json
matrix = json.loads(input())
result = Solution().largest_square(matrix)
result = Solution().biggestClearFloor(matrix)
print(result)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int main() {
stringstream ss(inner);
string token;
while (getline(ss, token, ',')) stones.push_back(stoi(token));
int result = Solution().crushHeaviestBales(stones);
int result = Solution().crushHeaviestBlocks(stones);
cout << result << endl;
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static void main(String[] args) {
String[] parts = inner.split(",");
int[] stones = new int[parts.length];
for (int i = 0; i < parts.length; i++) stones[i] = Integer.parseInt(parts[i].trim());
int result = new Solution().crushHeaviestBales(stones);
int result = new Solution().crushHeaviestBlocks(stones);
System.out.println(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

const input = require('fs').readFileSync('/dev/stdin', 'utf8').trim();
const stones = JSON.parse(input);
const result = new Solution().crushHeaviestBales(stones);
const result = new Solution().crushHeaviestBlocks(stones);
console.log(result);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{USER_CODE}

stones = eval(input())
result = Solution().last_stone_weight(stones)
result = Solution().crushHeaviestBlocks(stones)
print(result)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import json

intervals = json.loads(input())
result = Solution().erase_overlap_intervals(intervals)
result = Solution().dropClassConflicts(intervals)
print(result)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{USER_CODE}

nums = eval(input())
result = Solution().find_peak_element(nums)
result = Solution().pinpointPeak(nums)
print(result)
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main() {
lists.push_back(listFromArray(inner.substr(start)));
}

ListNode* result = Solution().mergeFlightRosters(lists);
ListNode* result = Solution().mergeCafeQueues(lists);
cout << listToJsonArray(result) << endl;
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ else if (inner.charAt(i) == ',' && depth == 0) {
}

ListNode[] arr = lists.toArray(new ListNode[0]);
ListNode result = new Solution().mergeFlightRosters(arr);
ListNode result = new Solution().mergeCafeQueues(arr);
System.out.println(ListNode.toJsonArray(result));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ function _listToArray(head) {
const input = require('fs').readFileSync('/dev/stdin', 'utf8').trim();
const data = JSON.parse(input);
const lists = data.map(arr => _buildList(arr));
const result = new Solution().mergeFlightRosters(lists);
const result = new Solution().mergeCafeQueues(lists);
console.log(JSON.stringify(_listToArray(result)));
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ def _list_to_array(head):

data = json.loads(input())
lists = [_build_list(arr) for arr in data]
result = Solution().merge_k_lists(lists)
result = Solution().mergeCafeQueues(lists)
print(json.dumps(_list_to_array(result), separators=(',', ':')))
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main() {
string word1, word2;
getline(cin, word1);
getline(cin, word2);
int result = Solution().minZoneEdits(word1, word2);
int result = Solution().minCheatCodeEdits(word1, word2);
cout << result << endl;
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String word1 = sc.nextLine();
String word2 = sc.nextLine();
int result = new Solution().minZoneEdits(word1, word2);
int result = new Solution().minCheatCodeEdits(word1, word2);
System.out.println(result);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{USER_CODE}

const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const result = new Solution().minZoneEdits(lines[0], lines[1]);
const result = new Solution().minCheatCodeEdits(lines[0], lines[1]);
console.log(result);
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

word1 = input()
word2 = input()
result = Solution().min_distance(word1, word2)
result = Solution().minCheatCodeEdits(word1, word2)
print(result)
2 changes: 1 addition & 1 deletion common/src/main/resources/drivers/min-wait-drive/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import json
grid = json.loads(input())
result = Solution().cheapest_path(grid)
result = Solution().minWaitRoute(grid)
print(result)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

points = json.loads(input())
k = int(input())
result = Solution().k_closest(points, k)
result = Solution().selectNearestStops(points, k)
result.sort()
print(json.dumps(result, separators=(',', ':')))
2 changes: 1 addition & 1 deletion common/src/main/resources/drivers/username-trie/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
elif cmd == "search":
result.append(trie.search(arg[0]))
elif cmd == "startsWith":
result.append(trie.starts_with(arg[0]))
result.append(trie.startsWith(arg[0]))

print(json.dumps(result, separators=(',', ':')).replace('True', 'true').replace('False', 'false').replace('None', 'null'))
2 changes: 1 addition & 1 deletion common/src/main/resources/starters/add-score-lists/cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class Solution {
public:
ListNode* tallyPickRoutes(ListNode* score1, ListNode* score2) {
ListNode* addScoreLists(ListNode* score1, ListNode* score2) {
// Write your solution here
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* }
*/
class Solution {
public ListNode tallyPickRoutes(ListNode score1, ListNode score2) {
public ListNode addScoreLists(ListNode score1, ListNode score2) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Solution {
* @param {ListNode} score2
* @return {ListNode}
*/
tallyPickRoutes(score1, score2) {
addScoreLists(score1, score2) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def __init__(self, val=0, next=None):
self.next = next

class Solution:
def add_two_numbers(self, score1: Optional[ListNode], score2: Optional[ListNode]) -> Optional[ListNode]:
def addScoreLists(self, score1: Optional[ListNode], score2: Optional[ListNode]) -> Optional[ListNode]:
# Write your solution here
pass
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using namespace std;

class Solution {
public:
int biggestClearBay(vector<vector<char>>& floor) {
int biggestClearFloor(vector<vector<char>>& floor) {
// Write your solution here
}
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Solution {
public int biggestClearBay(char[][] floor) {
public int biggestClearFloor(char[][] floor) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Solution {
* @param {character[][]} floor
* @return {number}
*/
biggestClearBay(floor) {
biggestClearFloor(floor) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Solution:
def largest_square(self, floor: list[list[str]]) -> int:
def biggestClearFloor(self, floor: list[list[str]]) -> int:
# Write your solution here
pass
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using namespace std;

class Solution {
public:
int crushHeaviestBales(vector<int>& blocks) {
int crushHeaviestBlocks(vector<int>& blocks) {
// Write your solution here
}
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Solution {
public int crushHeaviestBales(int[] blocks) {
public int crushHeaviestBlocks(int[] blocks) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Solution {
* @param {number[]} blocks
* @return {number}
*/
crushHeaviestBales(blocks) {
crushHeaviestBlocks(blocks) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Solution:
def last_stone_weight(self, blocks: list[int]) -> int:
def crushHeaviestBlocks(self, blocks: list[int]) -> int:
# Write your solution here
pass
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Solution:
def erase_overlap_intervals(self, classes: list[list[int]]) -> int:
def dropClassConflicts(self, classes: list[list[int]]) -> int:
# Write your solution here
pass
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Solution:
def find_peak_element(self, readings: list[int]) -> int:
def pinpointPeak(self, readings: list[int]) -> int:
# Write your solution here
pass
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using namespace std;
*/
class Solution {
public:
ListNode* mergeFlightRosters(vector<ListNode*>& queues) {
ListNode* mergeCafeQueues(vector<ListNode*>& queues) {
// Write your solution here
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* }
*/
class Solution {
public ListNode mergeFlightRosters(ListNode[] queues) {
public ListNode mergeCafeQueues(ListNode[] queues) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Solution {
* @param {ListNode[]} queues
* @return {ListNode}
*/
mergeFlightRosters(queues) {
mergeCafeQueues(queues) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def __init__(self, val=0, next=None):
self.next = next

class Solution:
def merge_k_lists(self, queues: list[Optional[ListNode]]) -> Optional[ListNode]:
def mergeCafeQueues(self, queues: list[Optional[ListNode]]) -> Optional[ListNode]:
# Write your solution here
pass
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using namespace std;

class Solution {
public:
int minZoneEdits(string source, string target) {
int minCheatCodeEdits(string source, string target) {
// Write your solution here
}
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Solution {
public int minZoneEdits(String source, String target) {
public int minCheatCodeEdits(String source, String target) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Solution {
* @param {string} target
* @return {number}
*/
minZoneEdits(source, target) {
minCheatCodeEdits(source, target) {
// Write your solution here
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Solution:
def min_distance(self, source: str, target: str) -> int:
def minCheatCodeEdits(self, source: str, target: str) -> int:
# Write your solution here
pass
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List

class Solution:
def cheapest_path(self, grid: List[List[int]]) -> int:
def minWaitRoute(self, grid: List[List[int]]) -> int:
# Write your solution here
pass
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Solution:
def k_closest(self, stops: list[list[int]], k: int) -> list[list[int]]:
def selectNearestStops(self, stops: list[list[int]], k: int) -> list[list[int]]:
# Write your solution here
pass
Loading
Loading